Download MetaTrader 5
To add comments, please log in or register
Track all payments in your profile. It is easy!
ForexTrader17
1041
ForexTrader17 2014.10.30 17:48 

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. 

Carl Schreiber
6161
Carl Schreiber 2014.10.30 18:34  

Look at the mt4 examples (Moving Average & MACD) in your expert folder how they deal with orders or go to the codebase for a sample code to change it.

You have the book and the docs that will help you.

ForexTrader17
1041
ForexTrader17 2014.10.30 18:41  

I have the custom indicator. I just need to know how to implement it in the logic so it it will not take the third buy or sell in a row. Max Buys/Sells opens several trades at the same time and so am not using it.

Thank you. 

whroeder1
13982
whroeder1 2014.10.30 19:44  
Eric1704: I have the custom indicator. I just need to know how to implement it in the logic so it it will not take the third buy or sell in a row.
I only see <, >, =, !=, <= and >= in MT4.
  1. Indicators can not trade so your statement makes no sense
  2. You do not see "=" in Operations of Relation - MQL4 Documentation
  3. learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.10.31 00:47  
Eric1704:

I have the custom indicator. I just need to know how to implement it in the logic so it it will not take the third buy or sell in a row. Max Buys/Sells opens several trades at the same time and so am not using it.

Thank you. 

Create a loop and count the open trades. Done.
ForexTrader17
1041
ForexTrader17 2014.10.31 01:11  
deysmacro:
Create a loop and count the open trades. Done.
Got it. I did that and now it will return a true/false value to use in the EA.
/
To add comments, please log in or register