Hello,
I created an EA using the "expert advisor builder" that's available on the web and then made some modifications to it for fine tuning which worked great. I have some programming experience from a distant past.
I am now stuck however as I try to program into the EA to cut my Lot level in half following 2 consecutive losses and then returning to the original Lot level following 2 consecutive wins.
This is what I have been trying to use:
If Buy or Sell signal is generated then
If OrderProfit() < 0 then
Losses = Losses + 1
Wins = 0
If Order Profit() > 0 then
Wins = Wins + 1
Losses = 0
If (Losses == 2) then reduce Lot Level by 50%
If (Wins == 2) then return Lot Level to prior manual amount
No errors generate when I compile but the Losses and Wins values don't increase? It seems as though the Losses and Wins values are not being stored properly or something as each time the EA returns to this code it should be increasing the value of Losses or Wins by 1?
Any input, ideas, or suggestions of better ways you would code this would be greatly appreciated. I'm posting the EA so you can see it. (Notice however that for testing purposes I have modified my code to give me a no trade signal when Losses = 2 or Wins = 2).
Thanks in Advance,
Scott Nelson
I created an EA using the "expert advisor builder" that's available on the web and then made some modifications to it for fine tuning which worked great. I have some programming experience from a distant past.
I am now stuck however as I try to program into the EA to cut my Lot level in half following 2 consecutive losses and then returning to the original Lot level following 2 consecutive wins.
This is what I have been trying to use:
If Buy or Sell signal is generated then
If OrderProfit() < 0 then
Losses = Losses + 1
Wins = 0
If Order Profit() > 0 then
Wins = Wins + 1
Losses = 0
If (Losses == 2) then reduce Lot Level by 50%
If (Wins == 2) then return Lot Level to prior manual amount
No errors generate when I compile but the Losses and Wins values don't increase? It seems as though the Losses and Wins values are not being stored properly or something as each time the EA returns to this code it should be increasing the value of Losses or Wins by 1?
Any input, ideas, or suggestions of better ways you would code this would be greatly appreciated. I'm posting the EA so you can see it. (Notice however that for testing purposes I have modified my code to give me a no trade signal when Losses = 2 or Wins = 2).
Thanks in Advance,
Scott Nelson
Attached File(s)
200ema slope scalp.mq4
10 KB
|
334 downloads