gulzaar:
Hi everyone - this is the OrderSelect() loop that I am using - the idea behind trade management here is that as soon as the bollinger band has been pierced, the EA moves the stops to the last low, provided it is greater than/less than the current stop.
For some reason, the EA only takes 3 trades(all buys - no sells for some reason), and when it modifies the trade, instead of the low, the journal shows it modified to 1.0000 - any ideas?
Did your OrderSelect work or not ? you MUST test these things . .
Is ModStop an int ?
RaptorUK:
Did your OrderSelect work or not ? you MUST test these things . .
Is ModStop an int ?
how do you test if orderselect worked or not?
- gulzaar:
how do you test if orderselect worked or not?
for(int iPos = OrdersTotal()-1; iPos >= 0 ; iPos--) if ( OrderSelect(iPos, SELECT_BY_POS) // Only my orders w/ && OrderMagicNumber() == magic.number // my magic number && OrderSymbol() == Symbol() // and my pair. ){
if(Close[1] > UpperBB || High[1] > UpperBB) BandPierced = true; if(BandPierced)
Is BandPierced ever set to false?bool BandPierced = Close[1] > UpperBB || High[1] > UpperBB; if(BandPierced) ...
Why are you looking at the close. If the close is above, then so is the high - always.
- Always test return codes
//OrderModify(OrderTicket(),OrderOpenPrice(),ModStop,0,0,CLR_NONE); if (!OrderModify(OrderTicket(),OrderOpenPrice(),ModStop,0,0,CLR_NONE)) Alert("OrderModify failed: ", GetLastError());
gulzaar:
how do you test if orderselect worked or not?
It returns a bool . . . if it works it returns true, if it doesn't work it returns false
how do you test if orderselect worked or not?
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 everyone - this is the OrderSelect() loop that I am using - the idea behind trade management here is that as soon as the bollinger band has been pierced, the EA moves the stops to the last low, provided it is greater than/less than the current stop.
For some reason, the EA only takes 3 trades(all buys - no sells for some reason), and when it modifies the trade, instead of the low, the journal shows it modified to 1.0000 - any ideas?