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: ...
- www.mql5.com
Did you check that latest_price is valid?
If its not too much trouble, could you show me an example of how to use and fill up the commands in OrderCheck()? I'm new to this and don't really know how to do any of these things haha
Did you open the help for sure?
Open and read - there are only two parameters.
OrderCheck
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 );
- www.mql5.com
how do you check if the latest price is valid? Sorry, I'm pretty new to this whole thing
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.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
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?