Download MetaTrader 5

How to implement a logic in an EA.

To add comments, please log in or register
ForexTrader17
1041
ForexTrader17  

I have a custom indicator that keeps track of the consecutive buys and sells on a chart. So if the last 2 closed trades were buys then it will return "2" and if the last 2 closed trades were sells it will return"2" also. I want to use this logic in an EA. What I am trying to achieve is if "2" is returned then do not take the third trade in the same direction. I was trying to figure out which operator would help me do this in MT4. I only see <, >, =, !=, <= and >= in MT4. Which operator would be best to use here and how many logic statements can it be done in? I am using an EA builder to do this.

Thank you. 

Jack Thomas
2074
Jack Thomas  
Which operator would be best to use here and how many logic statements can it be done in?
I am using an EA builder to do this.


Check the documentation for the EA Builder you are using, it explains how to edit the code.

What you want to generally though is use standard operator logic.

For example say your indi returned the data and stored it in: results

Then it would be something like:  

if(results<2){
RefreshRates();
ticket==OrderSend(Symbol(),OP_SELL,0.01,Bid,5,0,0,"",0,0,clrRed);
}
To add comments, please log in or register