bouboufx
bouboufx
bouboufx
MQL5.communityに登録されました
bouboufx
bouboufx
Hello
when I execute the EA, the purchase order is created but the error message 130(invalid stop loss) is displayed for the function ordermodify () ? can you hep me please.


------------------------------------------------------------------+
//| bb2.mq4 |
//| Copyright 2019, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
extern int TakeProfit=10;
extern int StopLoss=10;
extern bool condition=true;

int OnInit()
{


//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---

}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
if(condition)
{
double TakeProfitLevel=Bid + TakeProfit*Point;
double StopLossLevel= Bid - StopLoss*Point;

int buyticket=OrderSend("EURUSD",OP_BUY,0.01,Ask,10,0,0,"my 1st order!");
if(OrderSelect(buyticket,SELECT_BY_TICKET))
{
Print("ticket=",OrderTicket(),"openprice=",OrderOpenPrice());
bool buymodify=OrderModify(OrderTicket(),OrderOpenPrice(),Bid-10*Point,Bid+10*Point,0,clrNONE);
}
condition=false;
Print("erreur" , GetLastError());
}



}
//+------------------------------------------------------------------+