extern string OpenTime = "12:00"; double Lots=0.1; int start() { int ob,os, b,s,i,err; double OB = ObjectGet("fb Line",1); double OS = ObjectGet("fs",1); double TP1 = ObjectGet("tp1 Line",1); double TP2 = ObjectGet("tp2 Line",1); double TP3 = ObjectGet("tp3 Line",1); double SLfe = ObjectGet("fe Line",1); if (OB>0 && Close[0]>OB && Close[0]<TP1)b=1; if (OS>0 && Close[0]<OS && Close[0]>TP1)s=1; //Print (Symbol(),"=",Close[0]," OB=",OB," OS=",OS," TP1=",TP1," SLfe=",SLfe," b=",b," s=",s); //------------------------------------------------------------------------ for (i = 0; i < OrdersTotal(); i++) { if (OrderSelect(i, SELECT_BY_POS)) { if (OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (Close[0]<SLfe || Close[0]>TP2 ) OrderClose(OrderTicket(), OrderLots(), Bid, 0, CLR_NONE); } if (OrderType() == OP_SELL) { if (Close[0]>SLfe || Close[0]<TP2) OrderClose(OrderTicket(), OrderLots(), Ask, 0, CLR_NONE); } if (OrderType() == OP_SELL ) os=1; if (OrderType() == OP_BUY ) ob=1; } } } { if (CurTime()>StrToTime(OpenTime)) { if (b==1 && ob==0 && AccountFreeMargin()>Lots*AccountLeverage()*10) OrderSend(Symbol(), OP_BUY, Lots, Ask, 5,0,0,0,0,0,CLR_NONE); if (s==1 && os==0 && AccountFreeMargin()>Lots*AccountLeverage()*10) OrderSend(Symbol(), OP_SELL, Lots, Bid, 5, 0,0,0,0,0,CLR_NONE); } } }//end
Sample
Analysis
Market Information Used:
Series array that contains close prices for each bar
Indicator Curves created:
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Checks for the total of open orders
It Closes Orders by itself
It automatically opens orders when conditions are reached
Other Features: