http://209.85.129.132/translate_c?hl=it&u=http://subscribe.ru/archive/fin.forex.forexprog/200903/20031533.html&usg=ALkJrhiLF0DU2JacV7r_9GXrCymjPgTIjg
bool b, s, bs, ss;
double LevelSell,LevelBuy; doppio LevelSell, LevelBuy;
//-- / / --
for(b=false,s=false,bs=false,ss=false,i=OrdersTotal()-1;i>=0;i--) for (b = false, s = false, bs = false, ss = false, i = OrdersTotal () -1; i> = 0; i -)
{ (
if(!OrderSelect(i,SELECT_BY_POS)) continue; if (! OrderSelect (i, SELECT_BY_POS)) continue;
if(OrderSymbol()!=Symbol() || OrderMagicNumber()!=MAGIC) continue; if (OrderSymbol ()! = Symbol () | | OrderMagicNumber ()! = MAGIC) continuare;
if(OrderType()==OP_SELL) if (OrderType () == OP_SELL)
{ (
LevelSell=NormalizeDouble(OrderStopLoss(),Digits); LevelSell = NormalizeDouble (OrderStopLoss (), Digits);
s=true; s = true;
} else ) Else
if(OrderType()==OP_BUY) if (OrderType () == OP_BUY)
{ (
LevelBuy=NormalizeDouble(OrderStopLoss(),Digits); LevelBuy = NormalizeDouble (OrderStopLoss (), Digits);
b=true; b = true;
} else ) Else
if(OrderType()==OP_SELLSTOP) ss=true; else if (OrderType () == OP_SELLSTOP) ss = true; altro
if(OrderType()==OP_BUYSTOP) bs=true; if (OrderType () == OP_BUYSTOP) bs = true;
} )
//-- / / --
if(s && !bs) if (s & &! bs)
{ (
if(StopLoss if (Stoploss
else sl=NormalizeDouble(LevelSell-StopLoss*pnt,Digits); altro sl = NormalizeDouble (LevelSell-Stoploss * pnt, Digits);
if(TakeProfit if (TakeProfit
else tp=NormalizeDouble(LevelSell+TakeProfit*pnt,Digits); altro tp = NormalizeDouble (LevelSell + TakeProfit * pnt, Digits);
tick=OrderSend(Symbol(),OP_BUYSTOP,Lot,LevelSell,0,sl,tp,CMM,MAGIC,0,Red); tick = OrderSend (Symbol (), OP_BUYSTOP, Lotto, LevelSell, 0, sl, tp, CMM, MAGIC, 0, rosso);
if(tick>0) if (barrare> 0)
{ (
ticknum=0; ticknum = 0;
while(ticknum<90 && !OrderSelect(tick,SELECT_BY_TICKET)) while (ticknum <90 & &! OrderSelect (barrare, SELECT_BY_TICKET))
{ (
ticknum++; Sleep(2000); ticknum + +; Sleep (2000);
} )
} )
} )
if(b && !ss) if (b & &! ss)
{ (
if(StopLoss if (Stoploss
else sl=NormalizeDouble(LevelBuy+StopLoss*pnt,Digits); altro sl = NormalizeDouble (LevelBuy + Stoploss * pnt, Digits);
if(TakeProfit if (TakeProfit
else tp=NormalizeDouble(LevelBuy-TakeProfit*pnt,Digits); altro tp = NormalizeDouble (LevelBuy-TakeProfit * pnt, Digits);
tick=OrderSend(Symbol(),OP_SELLSTOP,Lot,LevelBuy,0,sl,tp,CMM,MAGIC,0,Blue); tick = OrderSend (Symbol (), OP_SELLSTOP, Lotto, LevelBuy, 0, sl, tp, CMM, MAGIC, 0, Blu);
if(tick>0) if (barrare> 0)
{ (
ticknum=0; ticknum = 0;
while(ticknum<90 && !OrderSelect(tick,SELECT_BY_TICKET)) while (ticknum <90 & &! OrderSelect (barrare, SELECT_BY_TICKET))
{ (
ticknum++; Sleep(2000); ticknum + +; Sleep (2000);
} )
} )
} )
Inviato da: pippocor2
il 12/08/2008 alle 23:54
Inviato da: barbona0
il 12/08/2008 alle 23:33