claudio.zeccolella:
Show the actual OnTick code, it could be a typo, in your example, count2 would always be resetted since you forgot to put braces around the if statement:Dear All ,
I'm facing my daily struggling with MQL4. I need to update a counter variable ONCE every time a condition is met.
I have created a 2D array which list all lot sizes and I'm trying to select those sizes according to OrderProfit <> 0.
For example :
Size[count1][count2];
if(OrderProfit() > 0) count1 ++ ; if (OrderProfit() < 0) count2 ++.
if(count1 == x || count2 == x)
count1 = 0
count2 = 0
The thing is , once a condition is met in OnTick () the counter variable keep increasing endlessly(of course).
Is there a way to fix this issue ? Thank you very much indeed.
if(count1 == x || count2 == x) { count1 = 0 count2 = 0 }I am suspecting you are doing the same error on the actual code.
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
Dear All ,
I'm facing my daily struggling with MQL4. I need to update a counter variable ONCE every time a condition is met.
I have created a 2D array which list all lot sizes and I'm trying to select those sizes according to OrderProfit <> 0.
For example :
Size[count1][count2];
if(OrderProfit() > 0) count1 ++ ; if (OrderProfit() < 0) count2 ++.
if(count1 == x || count2 == x)
count1 = 0
count2 = 0
The thing is , once a condition is met in OnTick () the counter variable keep increasing endlessly(of course).
Is there a way to fix this issue ? Thank you very much indeed.