Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Take into consideration, the Stops Level, the Freeze Level and the price alignment to tick size.
Forum on trading, automated trading systems and testing trading strategies
getting error "Invalid Price Length 13" when placing an order
Fernando Carreiro, 2023.06.17 23:15
Also pay attention to the following ... courtesy of Vladimir Karputov
Forum on trading, automated trading systems and testing trading strategies
Tick size vs Point(), can be a little tricky in Multicurrency EA
Fernando Carreiro, 2022.03.09 12:11
Tick Size and Point Size can be very different especially on stocks and other symbols besides forex.
Always use Tick Size to adjust and align your prices, not the point size. In essence, make sure that your price quotes, are properly aligned to the Tick size (see following examples).
... double tickSize = SymbolInfoDouble( _Symbol, SYMBOL_TRADE_TICK_SIZE ); ... double normalised_price = round( price / tick_size ) * tick_size; ... // Or use a function double Round2Ticksize( double price ) { double tick_size = SymbolInfoDouble( _Symbol, SYMBOL_TRADE_TICK_SIZE ); return( round( price / tick_size ) * tick_size ); };
Also read the following ...
The checks a trading robot must pass before publication in the Market
MetaQuotes, 2016.08.01 09:30
Before any product is published in the Market, it must undergo compulsory preliminary checks in order to ensure a uniform quality standard. This article considers the most frequent errors made by developers in their technical indicators and trading robots. An also shows how to self-test a product before sending it to the Market.
I still get the following error:
OrderSend error 4756
retcode=10015 deal=0 order=0
#property description "Example of placing pending orders" #property script_show_inputs #define EXPERT_MAGIC 123456 // MagicNumber of the expert input ENUM_ORDER_TYPE orderType=ORDER_TYPE_BUY_LIMIT; // order type //+------------------------------------------------------------------+ //| Placing pending orders | //+------------------------------------------------------------------+ void OnStart() { //--- declare and initialize the trade request and result of trade request MqlTradeRequest request={}; MqlTradeResult result={}; //--- parameters to place a pending order request.action =TRADE_ACTION_PENDING; // type of trade operation request.symbol =Symbol(); // symbol request.volume =0.5; // volume of 0.1 lot request.deviation=4; // allowed deviation from the price request.magic =EXPERT_MAGIC; // MagicNumber of the order int offset = 50; // offset from the current price to place the order, in points double price; double stoplimit; // order triggering price double point=SymbolInfoDouble(_Symbol,SYMBOL_POINT); // value of point int digits=SymbolInfoInteger(_Symbol,SYMBOL_DIGITS); // number of decimal places (precision) //--- checking the type of operation if(orderType==ORDER_TYPE_BUY_LIMIT) { request.type =ORDER_TYPE_BUY_LIMIT; // order type price=SymbolInfoDouble(Symbol(),SYMBOL_ASK)-offset*point; // price for opening request.price =NormalizeDouble(price,digits); stoplimit=SymbolInfoDouble(Symbol(),SYMBOL_BID)-offset*point; Print(price, "-",stoplimit); // normalized opening price request.stoplimit==NormalizeDouble(stoplimit,digits); } if(!OrderSend(request,result)) PrintFormat("OrderSend error %d",GetLastError()); // if unable to send the request, output the error code //--- information about the operation PrintFormat("retcode=%u deal=%I64u order=%I64u",result.retcode,result.deal,result.order); } //+------------------------------------------------------------------+
Did you lookup the error codes and their meanings?
4756
Trade request sending failed
10015
Invalid price in the request
What do you mean by "still"?
Why are you are not applying the advice given?
- Where are you checking and adjusting the price to the Tick Size?
- Where are you checking and adjusting for the Stops Level?
- Where are you checking and adjusting for the Freeze Level?
In other words, you did not apply any of the advice given to you in my previous post.
Also on a side note, you are also not checking the volume against the minimum, maximum and step values, as explained in the Article I linked for you.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I tried BuyLimit comand on my EA using Deriv account to trade but i always get Invalid Price error message, I tried to add +- my corrected_price to add slippage (also Ask price, Above market price etc..) but it doesnt accept my order. Any idea on Deriv on Crash 300 Index ?
> trade.BuyLimit(0.50, corrected_price, _Symbol, 0, 0, ORDER_TIME_GTC, 0, "TestDemoStrategy");