Preventing EA from taking subsequent trades after conditions are met

 

Hey guys,

I don't know if this is possible but I wanted to know if there exists such a condition/code that I could add to my current EA such that it does not enter a trade until my previously stated conditions are met AGAIN. 

For understanding purposes, let's pretend that my EA enters a buy if the RSI is above 50. Now, once the RSI is above 50, I enter a buy trade. Now let's pretend that moments later, my TP is hit but the RSI is still above 50 but higher (~80 zone), technically, my EA would enter another buy trade although I would like it to wait out until the RSI goes down below 50 and reaches back up.

Any ideas?


Thanks a lot!

 
You could try setting up a counting system for when it crosses 50 and only open if the count changes...
 
Louisemileg: my EA enters a buy if the RSI is above 50.
  1. Your signal is RSI>50
  2. Don't look for a signal. Look for a change in signal
    static bool isSignal=false;
    bool wasSignal = isSignal; isSignal = RSI > 50;
    if(isSignal && !wasSignal) ..


 

Okay great thanks guys I think that might have fixed it!

Reason: