Where are you checking the Stops Level versus the current Ask/Bid prices? I am not checking that , do i need to that because i am placing a TRADE_ACTION_PENDING order
Where are you aligning prices to the tick size? I am not doing that, perhaps this is the issue?
What is the error code and trade result code? code 4756
Where are you checking the Stops Level versus the current Ask/Bid prices? I am not checking that , do i need to that because i am placing a TRADE_ACTION_PENDING order
Where are you aligning prices to the tick size? I am not doing that, perhaps is the issue?
What is the error code and trade result code? code 4756
Sell Limit Pending Order at 123.628 while Bid price is 132.629 (that is a 1 point difference). Even if Stops Level Freeze Level were to be 0 points (which might not be the case), the price to be filled can easily slip more than that and invalidade the order price, Do you really want to place a Pending order at 1 point difference? No, use a market order instead.
Yes, you should always check the Freeze Level and Stops Level.
Yes, you should always align prices with the tick size.
Error code 4756 means "Trade request sending failed", but what is the trade result code?
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.
There is no need to create pending orders in code.
The pending has the slight advantage, A) you are closer to the top of the queue (filled quicker), B) there's no round trip network delay (filled quicker.)
Don't worry about it unless you're scalping M1 or trading news.
Humans can't watch the screen 24/=7, so they use pending orders; EAs can, so no need for pending orders, have it wait until the market reaches the trigger price and just open an order.
please check below logs with bid and ask price and error
2023.06.18 00:21:53.281 2022.06.07 23:25:00 bid price132.629 ask price132.631
2023.06.18 00:21:54.339 2022.06.07 23:25:00 failed sell limit 3.08 USDJPY at 132.628 sl: 132.671 tp: 132.542 [Invalid price]
Answers to questions
please check below logs with bid and ask price and error
2023.06.18 00:21:53.281 2022.06.07 23:25:00 bid price132.629 ask price132.631
2023.06.18 00:21:54.339 2022.06.07 23:25:00 failed sell limit 3.08 USDJPY at 132.628 sl: 132.671 tp: 132.542 [Invalid price]
Answers to questions
Documentation:
You4 code should always check error codes and trade results codes and adjust to them.
You should learn to debug your own code and reference the documentation.
I have given you links, and suggestions. Now you need to do some research and put them into practice on your code.
Don't use pending orders so near to current market prices. Use Market orders instead.
NB! I did however make a mistake in my posts, You should in fact be checking the Freeze Level in respect to the open price of pending orders
The Stops Level is for checking against the Stop Prices, I have corrected my previous posts.
Make sure to read and apply the following ...
I have also tried with sell market order but still facing issue. will do some research based on your posts. thx for help
2023.06.18 01:06:16.473 2022.06.07 23:25:00 bid price132.629 ask price 132.631
2023.06.18 01:06:16.473 2022.06.07 23:25:00 Trade error code 10015
2023.06.18 01:06:16.474 2022.06.07 23:25:00 failed sell 0.09 USDJPY at market sl: 133.998 tp: 129.889 [Invalid price]
2023.06.18 01:06:16.474 2022.06.07 23:25:00 last error reported 4756
ansar9h #: I have also tried with sell market order but still facing issue. will do some research based on your posts. thx for hel
2023.06.18 01:06:16.473 2022.06.07 23:25:00 bid price132.629 ask price 132.631
2023.06.18 01:06:16.473 2022.06.07 23:25:00 Trade error code 10015
2023.06.18 01:06:16.474 2022.06.07 23:25:00 failed sell 0.09 USDJPY at market sl: 133.998 tp: 129.889 [Invalid price]
2023.06.18 01:06:16.474 2022.06.07 23:25:00 last error reported 4756
When you sell at market you use the current bid price not a different price.
2023.06.18 00:21:53.281 2022.06.07 23:25:00 bid price132.629 ask price132.631
2023.06.18 00:21:54.339 2022.06.07 23:25:00 failed sell limit 3.08 USDJPY at 132.628 sl: 132.671 tp: 132.542 [Invalid price]
A sell limit must be above the market by at least MODE_STOPLEVEL * _Point or SymbolInfoInteger(SYMBOL_TRADE_STOPS_LEVEL). Your sell price was below.
Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial
There is no need to create pending orders in code.
The pending has the slight advantage, A) you are closer to the top of the queue (filled quicker), B) there's no round trip network delay (filled quicker.)
Don't worry about it unless you're scalping M1 or trading news.
Humans can't watch the screen 24/=7, so they use pending orders; EAs can, so no need for pending orders, have it wait until the market reaches the trigger price and just open an order.
hey thanks both
working now after selling at market price