/*[[ Name := SuperHair Author := Copyright © 2002, Company Link := http://www.company.com/ Notes := Update on every tick := Yes Enable Alerts := Yes Disable alert once hit := No Lots := 1 Stop Loss := 15 Take Profit := 20 Trailing Stop := 15 ]]*/ vars: Slippage(2),MATrendPeriod(60); defines: CountBars(2),CauntPeriods(2); vars: sl(0),tp(0); defines: Y(3),Z(1),W(1); vars:ADX1(0),ADX2(0); var: s(0); var: b(0); vars : cnt(0),first(0); If Bars<100 or TakeProfit<10 then Exit; If IsIndirect(Symbol)=TRUE then Exit; b=Low[Highest(MODE_High,CountBars,CauntPeriods)]; s=High[Lowest(MODE_LOW,CountBars,CauntPeriods)]; Y=3; Z=1; W=1; //tp=High[Highest(MODE_High,10,10)]; If TotalTrades<1 then { sl=Bid+25*Point; if High[Z](b+Y*Point) then { SetOrder(OP_BUY,Lots,Ask,Slippage,sl,Ask+TakeProfit*Point,RED); Exit; }; }; for cnt=1 to TotalTrades { if OrderValue(cnt,VAL_TYPE)<=OP_SELL and // это открытая позиция? OrderValue(cnt,VAL_SYMBOL)=Symbol then // позиция с 'нашего' графика? { if OrderValue(cnt,VAL_TYPE)=OP_BUY then { if Low[W]0 then // если трейлинг-стопы используются { If (Bid-OrderValue(cnt,VAL_OPENPRICE))>(Point*TrailingStop) then { If OrderValue(cnt,VAL_STOPLOSS)<(Bid-Point*TrailingStop) then { ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_OPENPRICE), Bid-Point*TrailingStop,OrderValue(cnt,VAL_TAKEPROFIT),Red); Exit; }; }; }; }; } else { if High[Z]>High[3] then { CloseOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_LOTS),Ask,Slippage,Violet); Exit; }; If TrailingStop>0 then // если трейлинг-стопы используются { If (OrderValue(cnt,VAL_OPENPRICE)-Ask)>(Point*TrailingStop) then { If OrderValue(cnt,VAL_STOPLOSS)>(Ask+Point*TrailingStop) then { ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_OPENPRICE), Ask+Point*TrailingStop,OrderValue(cnt,VAL_TAKEPROFIT),Red); Exit; }; }; }; }; };