if I understand correctly, then why not just move the while inside if( iCustom(...)
not known what SelectTheOrder555() does, presume looks in open orders trade pool for next magic=x
so:
//When iCustom() signal is true: modify/close all orders with same magic number
//
if( signal==true )
{
while(select...)
{
if(Ask<=Open...)
modify(..
else
close(...
}//while(select...)
}//if(signal==true)
(humpf... guess not yet learned howto use that code formatting - boy thicko or what? :)
help... what me doing that's not allowing formatting? maybe syntax has to be valid? or...?
if I understand correctly, then why not just move the while inside if( iCustom(...)
not known what SelectTheOrder555() does, presume looks in open orders trade pool for next magic=x
so:
//When iCustom() signal is true: modify/close all orders with same magic number
//
if( signal==true )
{
while(select...)
{
if(Ask<=Open...)
modify(..
else
close(...
}//while(select...)
}//if(signal==true)
(humpf... guess not yet learned howto use that code formatting - boy thicko or what? :)
help... what me doing that's not allowing formatting? maybe syntax has to be valid? or...?
Thank you a lot.
But it was not so easy peasy.
if( iCustom(NULL,0, "GaussP_test7", 14, 100000, 1,1) >= Low[1] ) { for(int cnt=OrdersTotal();cnt>0;cnt--) { if(OrderMagicNumber()==5555) { OrderSelect(cnt,SELECT_BY_TICKET); Print(OrderOpenPrice()); if(Bid<=OrderOpenPrice()) OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),OrderOpenPrice()+(MarketInfo("EURJPY",MODE_SPREAD)*Point+2*Point),0,Brown);} else OrderClose(OrderTicket(),OrderLots(),Bid,3,Blue); } } }
The Order Selected through your example is none but one of the total amount open and marked by the MagicNumber 5555.
- So when I tried to do OrderModify, error 1 was outputed. Thus, I had to make the function recognize each ticket, one by one. This is the sense of the for cycle.
- In these situations for(int cnt=OrdersTotal();cnt>0;cnt--)
{
if(OrderMagicNumber()== )
{
is a fundamental way to fucus only on open positions (all of them, one by one) of the type you decided via the MagicNumber.
SA
agreed - think was fussing more with the input box lack of formatting then having brain in gear! orderstotal + mapping only orders according to your criteria is indeed key to success :)
an aside: have you considered what to do if one or more trade op call fails? eg, retry loops etc...
anyways, glad you found your solution!
- 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,
The question is simple: attached my attempt.
while(SelectTheOrder5555()==true) { if( iCustom(NULL,0, "GaussP_test7", 14, 100000, 1,1) >= Low[1] ) { if(Ask<=OrderOpenPrice()) OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),OrderOpenPrice()+2*Point,0,Brown); else OrderClose(OrderTicket(),OrderLots(),Bid,3,Blue); break; } break; }
It modifies/closes only the LAST chronologically opened position of a sequence of 3 or 4 Opened Orders and I want to modify/close all of them at that signal.
Can you give me an example?
Thanks a lot!
SA