First and second order process, then I get a big delay with forex.com.
Does anyone know how to put a small delay between the orders being sent.
Thankyou for any help.
Dale
//#property show_inputs
double RiskPercent = 0.70;//
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
string TicketComment2X = StringConcatenate(TicketComment2X, Period(),"-","2X");
string TicketCommentManageOne = StringConcatenate(TicketCommentManageOne, Period(),"-","MANAGEONE");
string TicketCommentManageTwo = StringConcatenate(TicketCommentManageTwo, Period(),"-","MANAGETWO");
int Expiration=(CurTime()+(Period()*60));
int SpreadPointss = MarketInfo(Symbol(),MODE_SPREAD);
double SpreadPoints = (SpreadPointss*Point);
double OnePoint = (1*Point);
double TwoPoint = (2*Point);
double Risk = RiskPercent / 100;
double MyStopLoss = ( (High[1]+(SpreadPoints + OnePoint)) - (Low[1]-(((SpreadPoints+SpreadPoints/2))- OnePoint) ) ) / Point;
double GetTarget = ( (High[1]+(SpreadPoints + OnePoint)) - (Low[1]- (((SpreadPoints + SpreadPoints/2))- OnePoint) ) ) ;
double TargetShort = NormalizeDouble((Low[1]-GetTarget),Digits);//testing Digits
double Lots = NormalizeDouble( AccountBalance()*Risk/MyStopLoss/(MarketInfo(Symbol(), MODE_TICKVALUE)),2);
double LotsDivided = ((Lots/2));
double LotsTimesFour = ((Lots*4));
double GetBid = MarketInfo(Symbol(),MODE_BID);
double Allowable = (OnePoint*5);
double AutoAllowable = (OnePoint*MarketInfo(Symbol(),MODE_STOPLEVEL));
double EntryPrice;
double BIDANDPOINTS = (GetBid - OnePoint);
double LOWANDPOINTS = (Low[1]- TwoPoint);
if (BIDANDPOINTS < LOWANDPOINTS+AutoAllowable)
{
EntryPrice = BIDANDPOINTS-AutoAllowable;
} else
{
EntryPrice = LOWANDPOINTS;
}
if(Lots > 0)
OrderSend(Symbol(),OP_SELLSTOP, Lots, EntryPrice,3,(High[1]+(SpreadPoints+(SpreadPoints/2)+TwoPoint)) , 0, TicketComment2X, 0, NULL, LimeGreen);
OrderSend(Symbol(),OP_SELLSTOP, LotsDivided, EntryPrice,3,(High[1]+(SpreadPoints+(SpreadPoints/2)+TwoPoint)) , 0, TicketCommentManageOne, 0, NULL, LimeGreen);
OrderSend(Symbol(),OP_SELLSTOP, LotsDivided, EntryPrice,3,(High[1]+(SpreadPoints+(SpreadPoints/2)+TwoPoint)) , 0, TicketCommentManageTwo, 0, NULL, LimeGreen);
return(0);
}
//+-------------------------------
Does anyone know how to put a small delay between the orders being sent.
Thankyou for any help.
Dale
//#property show_inputs
double RiskPercent = 0.70;//
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
string TicketComment2X = StringConcatenate(TicketComment2X, Period(),"-","2X");
string TicketCommentManageOne = StringConcatenate(TicketCommentManageOne, Period(),"-","MANAGEONE");
string TicketCommentManageTwo = StringConcatenate(TicketCommentManageTwo, Period(),"-","MANAGETWO");
int Expiration=(CurTime()+(Period()*60));
int SpreadPointss = MarketInfo(Symbol(),MODE_SPREAD);
double SpreadPoints = (SpreadPointss*Point);
double OnePoint = (1*Point);
double TwoPoint = (2*Point);
double Risk = RiskPercent / 100;
double MyStopLoss = ( (High[1]+(SpreadPoints + OnePoint)) - (Low[1]-(((SpreadPoints+SpreadPoints/2))- OnePoint) ) ) / Point;
double GetTarget = ( (High[1]+(SpreadPoints + OnePoint)) - (Low[1]- (((SpreadPoints + SpreadPoints/2))- OnePoint) ) ) ;
double TargetShort = NormalizeDouble((Low[1]-GetTarget),Digits);//testing Digits
double Lots = NormalizeDouble( AccountBalance()*Risk/MyStopLoss/(MarketInfo(Symbol(), MODE_TICKVALUE)),2);
double LotsDivided = ((Lots/2));
double LotsTimesFour = ((Lots*4));
double GetBid = MarketInfo(Symbol(),MODE_BID);
double Allowable = (OnePoint*5);
double AutoAllowable = (OnePoint*MarketInfo(Symbol(),MODE_STOPLEVEL));
double EntryPrice;
double BIDANDPOINTS = (GetBid - OnePoint);
double LOWANDPOINTS = (Low[1]- TwoPoint);
if (BIDANDPOINTS < LOWANDPOINTS+AutoAllowable)
{
EntryPrice = BIDANDPOINTS-AutoAllowable;
} else
{
EntryPrice = LOWANDPOINTS;
}
if(Lots > 0)
OrderSend(Symbol(),OP_SELLSTOP, Lots, EntryPrice,3,(High[1]+(SpreadPoints+(SpreadPoints/2)+TwoPoint)) , 0, TicketComment2X, 0, NULL, LimeGreen);
OrderSend(Symbol(),OP_SELLSTOP, LotsDivided, EntryPrice,3,(High[1]+(SpreadPoints+(SpreadPoints/2)+TwoPoint)) , 0, TicketCommentManageOne, 0, NULL, LimeGreen);
OrderSend(Symbol(),OP_SELLSTOP, LotsDivided, EntryPrice,3,(High[1]+(SpreadPoints+(SpreadPoints/2)+TwoPoint)) , 0, TicketCommentManageTwo, 0, NULL, LimeGreen);
return(0);
}
//+-------------------------------
Attached File(s)
SELL Quest.mq4
2 KB
|
252 downloads