The first obvious thing, your loops . . .
for(cnt=0;cnt<total;cnt++)
. . . if you are closing orders within these loops you MUST count down not up.
How close are you stop and TP ?
thanx Raptor Ill adjust that.
the SL and TP are further than 10 pips as a standard
thanx Raptor Ill adjust that.
the SL and TP are further than 10 pips as a standard
sorry i didnt make myself clear...i am using in excess of 10 pips on a 5 digit broker.
i draw the lines approx 10-15 pips for target 1 and 20-30 pips for target 2
same R:R for the SL's
the strange thing is it closes the sell orders perfectly according to the target1&2 and stop1&2 levels...
works no problem... but wont do the same for buy orders... it just closes them the moment i open the buy order
the strange thing is it closes the sell orders perfectly according to the target1&2 and stop1&2 levels...
works no problem... but wont do the same for buy orders... it just closes them the moment i open the buy order
ill try that thank you Erzo. I hope it fixes the issue.
strange thing is when i changed the ++ to -- in the for loop...now it wont do anything at all.
maybe the fact that it closed sell orders was a fluke ...im going to work thru the code again and see if i can fix it with all your suggestions.
thanx guys
ill try that thank you Erzo. I hope it fixes the issue.
strange thing is when i changed the ++ to -- in the for loop...now it wont do anything at all.
You need to do a little more than that . . .
for(cnt=0;cnt<total;cnt++) to for(cnt=total-1; cnt>=0; cnt--)
thank you, i was just searching thru one of my MQL tutorials looking for just that...i remembered there was something else to do in the for loop, couldnt remember exactly what is was tho
much appreciated
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi guys,
I know there are tons of these sorts of EA's out there but I wanted to code one to learn how to do it.
I have managed to put it together with very "childish" coding logic and skill. but it seems to work perfectly with the Sell orders but will not work at all on BUY orders...
can anyone help me understand why it closes the SELL orders perfectly according to the levels but as soon as I enter a BUY order it closes it immediately.
this confuses me as the logic for the BUY orders is the same as for the SELL (just in reverse) orders, so it should work exactly the same.
I would appreciate any assistance
thanks guys