extern double TakeProfit = 150; extern double StopLoss = 70; extern double Lots = 0.1; //extern int HourTorg = 0; int start() { int cnt, ticket, total; total=OrdersTotal(); if(total<1) { // no opened orders identified if((Hour()==11 || Hour()==17) && Minute()==0 && Close[1]>Close[3] && Close[1]-Close[3]>3*Point) //if(Hour()==HourTorg && Minute()==0 && Close[1]>Close[3] && Close[1]-Close[3]>3*Point) { // check for long position (BUY) possibility ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,2,Ask-StopLoss*Point,Ask+TakeProfit*Point,"Sys",16384,0,LawnGreen); if(ticket>0) { if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice()); } else Print("Error opening BUY order : ",GetLastError()); return(0); } if((Hour()==11 || Hour()==17) && Minute()==0 && Close[1]<Close[3] && Close[3]-Close[1]>3*Point) //if(Hour()==HourTorg && Minute()==0 && Close[1]<Close[3] && Close[3]-Close[1]>3*Point) { // check for short position (SELL) possibility ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,2,Bid+StopLoss*Point,Bid-TakeProfit*Point,"Sys",16384,0,Red); if(ticket>0) { if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice()); } else Print("Error opening SELL order : ",GetLastError()); return(0); } return(0); } return(0); } //the 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 automatically opens orders when conditions are reached
Other Features: