The OrderSend has a parameter to give the expiration date. it is the one before the color. For calculation see the example in this thread: "OrderExpiration with Ordersend..."
cori
cori
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
extern double Lots = 0.1;
extern double Limits = 35;
extern double TakeProfit = 35;
extern double StopLoss = 25;
int start()
{
int cnt, ticket, total;
int StartHour = TimeHour(CurTime());
int StartMinute = TimeMinute(CurTime());
if(Bars<100)
{
Print("bars less than 100");
return(0);
}
if(TakeProfit<10)
{
Print("TakeProfit less than 10");
return(0); // check TakeProfit
}
total=OrdersTotal();
if(total<1)
{
if(AccountFreeMargin()<(100*Lots))
{
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
if(StartHour == 14 && StartMinute == 25)
{
ticket=OrderSend(Symbol(),OP_BUYSTOP,Lots,Ask+Limits*Point,0,(Ask+Limits*Point)-StopLoss*Point,(Ask+Limits*Point)+TakeProfit*Point,"Buy",0,0,White);
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);
}
}
}