It gives error Result.retcode : 10016 - Invalid stops in the request. Can anybody explain what it means or simply say what is wrong with my OrderSend?
In other words I need just working simple OrderSend sample. I have seen
samples but I want to start with easiest one. Because I didn't find easy
one I am trying to create it myself.
MQL5: language of trade strategies built-in the MetaTrader 5 Trading Platform, allows writing your own trading robots, technical indicators, scripts and libraries of functions
My code is (in attachment also):
//+------------------------------------------------------------------+
//| MakeDeal.mq5 |
//| Copyright 2014, MetaQuotes Software Corp. |
//| http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link "http://www.mql5.com"
#property version "1.00"
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void MakeDeal(string Side) {
double Volume=10.0;
MqlTradeRequest Request;
MqlTradeResult Result;
Request.action=TRADE_ACTION_DEAL;
Request.symbol="EURUSD";
Request.type_filling=ORDER_FILLING_FOK;
Request.volume=Volume;
Request.tp=Volume/10;
Request.sl=Volume/10;
Request.price=14.0;
Request.deviation=0.0;
Request.type_time=ORDER_TIME_SPECIFIED;
Request.expiration=6*60;
if(Side=="Up") {Request.type=ORDER_TYPE_BUY;}
if(Side=="Down") {Request.type=ORDER_TYPE_SELL;}
if (!OrderSend(Request,Result)) {
Print(" error: order rejected : " + IntegerToString(Result.retcode));
}
}
void OnStart()
{
//---
MakeDeal("Up");
}
//+------------------------------------------------------------------+
It gives error Result.retcode : 10016 - Invalid stops in the request. Can anybody explain what it means or simply say what is wrong with my OrderSend?
In other words I need just working simple OrderSend sample. I have seen samples but I want to start with easiest one. Because I didn't find easy one I am trying to create it myself.
Thanks!