//+------------------------------------------------------------------+ //| Pricetor v2.mq4 | //| Copyright © 2009, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2009, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" extern bool check=false; extern int PeriodP=12; extern double TrailingStop = 35;// ðàññòîÿíèå ïîñëå êîòîðîãî áóäåì óñòàíàâëèâàòü áåçóáûòîê extern double X=5;//óñòàíîâêà â + 5 ïóíêòîâ! //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { double P_up0, P_down0, P_up1, P_down1; int cnt, total; P_up0=iCustom(Symbol(),Period(),"Öåíîâîé êàíàë",PeriodP,0,0); P_down0=iCustom(Symbol(),Period(),"Öåíîâîé êàíàë",PeriodP,1,0); P_up1=iCustom(Symbol(),Period(),"Öåíîâîé êàíàë",PeriodP,0,1); P_down1=iCustom(Symbol(),Period(),"Öåíîâîé êàíàë",PeriodP,1,1); for(cnt=OrdersTotal()-1;cnt>=0;cnt--) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if(OrderType()<=OP_SELL && OrderSymbol()==Symbol()) { if(OrderType()==OP_BUY) { if(P_down1>P_down0) { OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); return(0); } if(TrailingStop>0) { if(Bid-OrderOpenPrice()>Point*TrailingStop) { if(OrderStopLoss()<Bid-Point*TrailingStop && OrderStopLoss()!=OrderOpenPrice()+X*Point) { OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+X*Point,OrderTakeProfit(),0,Green); return(0); } } } } else { OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet); return(0); } if(TrailingStop>0) { if((OrderOpenPrice()-Ask)>(Point*TrailingStop)) { if(NormalizeDouble(OrderStopLoss(),Digits) != NormalizeDouble(OrderOpenPrice()-X*Point,Digits)) { OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-X*Point,OrderTakeProfit(),0,Red); return(0); } } } } } if (check) Order_Open(); return(0); } //+------------------------------------------------------------------+ void Order_Open(){ if (OrdersTotal()<=1) { OrderSend(Symbol(),OP_BUY,0.1,Ask,3,0,0,"",20080421,0); OrderSend(Symbol(),OP_SELL,0.1,Bid,3,0,0,"",20080421,0); } } //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Indicator Curves created:
Indicators Used:
Custom Indicators Used:
Ценовой канал
Order Management characteristics:
Checks for the total of open orders
It Closes Orders by itself
It can change open orders parameters, due to possible stepping strategy
It automatically opens orders when conditions are reached
Other Features: