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
isnt the if line made redundant by the first loop? ie i>= 0
i >= 0 is basically "standard" for iterating "backward" in a loop, where 0 is the merely the first number of the count, so no.
Also, remember that in that custom function, nothing runs unless PositionsTotal() >= 1.
Also, remember that in that custom function, nothing runs unless PositionsTotal() >= 1.
[H]ence my query about it being redundant.
I just saw your EDIT. In your code, you have no limiting condition so yes, your code will run on every tick.
To be clear, that limiting condition can be in OnTick() just the same (together with your actual close all conditions).sym0 = position.Symbol();The global "sym0" is used, for example, in the following situations:
In the Tester, with only one active symbol, this does not generate problems. However, in a demo account, if there is any open position of another symbol (from another instance of the EA, another EA, or manual order), "sym0" will be contaminated during the loop and will subsequently use the ask, bid, and pnt values of the wrong symbol. Therefore, I think you should standardize the SELL check to be the same as the BUY check:
3) In openNewTrade(), the parameters "buy4" and "sel4" are int, but they are receiving bool values (big2buy and big2sel):
Since these values become 0 or 1, the conditions "sel4 > 2" and "buy4 > 2" within openNewTrade() are always false. That is, the third lot (iStart3Lots) is never reached - neither for buy nor for sell. I think you should pass "totalsel" and "totalbuy" (which are integers and increment):
4) The variables "buyMxg" and "buyMng" are being initialized incorrectly (lines 288-289):
This way, the comparisons "position.PriceOpen() > buyMxg" and "position.PriceOpen() < buyMng" are never true - so "buyMxg" and "buyMng" are never updated. I think you should correct it to:
5) To facilitate the identification of possible future errors during demo testing, add a Print statement right before the lot calculation in openNewTrade(), within the SELL block:
That's all for now... Happy testing! 😊
That's all for now... Happy testing! 😊
well! WOW WEEE! thanks a lot mate! only read half of it so far, busy with day job, but will do the sym0 change tonight, around 8 hours from now. and it makes sense, that I will make the change on the ea that is trading, rather than a new ea. thanks a lot! i will also add a if tester line before the setAsynch just because it is another fast mod. i will read the rest in 6 hours from now!
after reading point 3, i feel dumb. so i changed that as it was set to the wrong variable, instead of big2buy, big3sel, these should have been totalbuy, totalsel, and the above mentioned mods. will read the remainder tonight in 6 hours.
thanks again. i am surprised that it was even working on buy trades!