here's my 2 cents:
1. have a loss count for both trade directions:
#define LOSSCOUNTTHRESHOLD 2
uint losscountbuy = 0;
uint losscountsell = 0;
2. trade according to signal if respective loss count not exceeded threshold value:
if((losscountbuy < LOSSCOUNTTHRESHOLD) && buysignal) buy();
else if((losscountsell < LOSSCOUNTTHRESHOLD) && sellsignal) sell();
3. whenever a trade ends in a loss, increase loss count in the respective direction:
4. on every new trade set opposite loss count to zero (in the respective trade function):
// in buy() function
losscountsell = 0;
// in sell() function
losscountbuy = 0;
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
I created my own EA but I wanted to know if there was a way to code the EA, so it there are 2 losses in a row it will not trade to trade in the same direction again until an oppsite order is executed. For instance my EA gives a sell signal & it gets stopped out. The EA will Open the Sell signal again if all my conditions are met. So sometimes I'm getting 3 or 4 losses in a row. Is there a code that will let the EA know that once it has 2 losses in a row not to keep trading in that direction. So what i want it to do is say I have 2 sell orders and their both losses,don't take any sell orders until a buy order is received. Then sell orders can be taken agian.
Thanks