What is it?
mrequest.tp = NormalizeDouble (latest_price.bid - latest_price.bid, _Digits );
Maybe after all:
mrequest.tp = NormalizeDouble (latest_price.bid - TKP*_Point, _Digits );
What is it?
mrequest.tp = NormalizeDouble (latest_price.bid - latest_price.bid, _Digits );
Maybe after all:
mrequest.tp = NormalizeDouble (latest_price.bid - TKP*_Point, _Digits );
What is it?
Maybe after all:
Try this tip: OrderSend
It is recommended to check the request before sending it to a trade server. To check requests, use the OrderCheck() function. It checks if there are enough funds to execute the trade operation, and returns many useful parameters in the results of trade request checking: ...
Did you open the help for sure?
Open and read - there are only two parameters.
The OrderCheck() function checks if there are enough money to execute a required trade operation. The check results are placed to the fields of the MqlTradeCheckResult structure.
bool OrderCheck( MqlTradeRequest& request, // request structure MqlTradeCheckResult& result // result structure );
Instead of latest_price use this, temporarily, just to make sure bid and ask are valid:
MqlTick tick; SymbolInfoTick(_Symbol,tick); // replace latest_price.bid with tick.bid and latest_price.ask with tick.askSelling:
mrequest.price = NormalizeDouble(tick.bid,_Digits); mrequest.sl = NormalizeDouble(tick.bid + STP*_Point,_Digits); mrequest.tp = NormalizeDouble(tick.bid - TKP*_Point,_Digits);Buying:
mrequest.price = NormalizeDouble(tick.ask,_Digits); mrequest.sl = NormalizeDouble(tick.ask - STP*_Point,_Digits); mrequest.tp = NormalizeDouble(tick.ask + TKP*_Point,_Digits);
And check that STP and TKP are sufficiently large, for 5 digit symbols _Point is ten times smaller than a pip.
You agree to website policy and terms of use
Hi, recently I started getting error 4756 messages saying that my buy or sell order could not be placed. Is there something wrong with my code?