mql - Order Sent Failed with Error #130 -
i'm trying insert takeprofit , stoploss argument in sendorder() function, i'm getting next error:
order sent failed error #130 this code:
extern double takeprofit = 30.0; extern double stoploss = 20.0; stoploss = normalizedouble( stoploss, 5 ); // set stop loss print( "stoploss", stoploss ); takeprofit = normalizedouble( takeprofit, 5 ); // set take turn a profit ticket = ordersend( symbol(), op_sell, lotsize, ask, 100, stoploss, takeprofit, 0, 0, 0, clr_none ); if ( ticket < 0 ) { print( "order send failed error #", getlasterror() ); } else print( "order send sucesso!!" ); i checked documentation function normalizedouble(), i'm still getting error.
what should do?
a ) comply mql4 ordersend() syntax requirements int anordertkt; // declare int double anorderlotsize; // declare double string anordercommentstring; // declare string anordertkt = ordersend( _symbol, // cpu-glitch, faster calling symbol(), op_sell, // xto.type anorderlotsize, // xto.size [lt]s bid, // xto.entryprice { op_buy: inquire | op_sell: bid } 100, // xto.slippage [pt]s 0, // xto.sl_price 0, // xto.tp_price, anordercommentstring, // xto.comment 0, // xto.magnum# 0, // xto.pendingorderexpire clr_none // gui.markercolor ); // ==> { empty | atkt# }
your code fails @ setting right short trade entry-price, shall read rather bid, not ask ( error hidden masked-out rather cosmic distance of 100 points in tolerable slippage distance said cost ).
your code fails @ assigning int ( 0 ) in place, string expected.
you shall verify broker few details:
does terms & conditions allowordersend() one-stop-instruction, incl, tp & sl, or broker t&c require first open trade-position & after happens allow ordermodify() instruction setup tp & sl price-levels? in either case, check broker t&c settings stoplevel & freezelevel distances, within broker rejects tp & sl setup(s) or modification(s) thereof. c) practice not assign extern iterator-variables while not root-cause trouble, accustomed industry best practices, 1 of not assign value declared extern. rather declare own variable, command scope & assignments thereof, leave extern(s) un-touched code side.
mql mql4
No comments:
Post a Comment