Anybody help. i have a BUYLIMIT placed. when EA modify the order it reach me the above error "INVALID PRICE". attached JPEG message display my Ticket#, New BUYLIMIT, ctrade, CURRENT BID price. this is a 2days headache whats wrong of my BUYLIMIT price. I ask anybody to give me a any idea for this matter. thanks a lot in advanced.
Where is your code? Are you normalizing the price?
Where is your code? Are you normalizing the price?
void OnTick() { pB=NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_BID),_Digits); } void andriodTradingSell() { for(int i=OrdersTotal()-1; i>=0; i--) { int ticket=(int)OrderGetTicket(i); if(ticket>0) { if(OrderGetString(ORDER_SYMBOL)==ChartSymbol()) { if(OrderGetInteger(ORDER_TYPE)==ORDER_TYPE_SELL_LIMIT) { trade.OrderModify(OrderGetTicket(i) ,pB+5*_Point ,pB+setSL*_Point ,pB-setTP*_Point,ORDER_TIME_DAY,0,0); } } } } }
2021.04.09 06:56:47.718 AT210409 (GOLD,M15)
CTrade::OrderSend: modify #387560891 at
1754.73 (sl: 1753.73 tp: 1764.78) [invalid price]
2021.04.09 08:05:49.279 Trades '62114140': failed modify order #387560891
buy limit 0.01 GOLD at
1712.00000 sl: 0.00000 tp: 0.00000 expiration: gtc ->
1754.98000, sl: 1753.60000 tp: 1765.03000 expiration: day [Invalid price]
2021.04.09 08:38:47.767 AT210409 (GOLD,M15)
CTrade::OrderSend: modify #387560891 at
1754.51 (sl: 1752.81 tp: 1764.56) [invalid price]
2021.04.09 09:35:00.421 Trades '62114140': failed modify order #387583943
sell limit 0.01 GOLD at
1774.00000 sl: 0.00000 tp: 0.00000 expiration: day ->
1755.53000, sl: 1757.56000 tp: 1745.48000 expiration: day [Invalid price]
2021.04.09 09:35:00.421 AT210409 (GOLD,M15) 387583943
2021.04.09 09:35:00.421 AT210409 (GOLD,M15) 1755.48
2021.04.09 09:35:00.421 AT210409 (GOLD,M15) CTrade::OrderSend: modify #387583943 at 1755.53 (sl: 1757.56 tp: 1745.48) [invalid price]
***above text from my save notepad
**your knowledge help me to improve my Learning about MT5. thanks and im waiting your early reply.
This is the correct way to round order prices
void andriodTradingSell() { for(int i=OrdersTotal()-1; i>=0; i--) { int ticket=(int)OrderGetTicket(i); if(ticket>0) { if(OrderGetString(ORDER_SYMBOL)==ChartSymbol()) { if(OrderGetInteger(ORDER_TYPE)==ORDER_TYPE_SELL_LIMIT) { pB=SymbolInfoDouble(_Symbol,SYMBOL_BID); trade.OrderModify(OrderGetTicket(i) ,NormalizeDouble(pB+5*_Point,_Digits) ,NormalizeDouble(pB+setSL*_Point,_Digits) ,NormalizeDouble(pB-setTP*_Point,_Digits),ORDER_TIME_DAY,0,0); } } } } }
This is the correct way to round order prices
I cannot stress this enough, obviously.
My suggestion: RTFM. - It states precisly why you need to do an OrderSelect() before you rely on data given by OrderGet*().
https://www.mql5.com/en/docs/trading/orderselect
Function OrderSelect() copies data about an order into the program environment, and further calls of OrderGetDouble(), OrderGetInteger(), OrderGetString() return the earlier copied data.

- www.mql5.com

- www.mql5.com
Anybody help. i have a BUYLIMIT placed. when EA modify the order it reach me the above error "INVALID PRICE". attached JPEG message display my Ticket#, New BUYLIMIT, ctrade, CURRENT BID price. this is a 2days headache whats wrong of my BUYLIMIT price. I ask anybody to give me a any idea for this matter. thanks a lot in advanced.
According to this:
the price of the buy-limit has to be less than the actual price and SL and TP must not be to close to limit price. Print all the relevant prices and specifications and check it. Gold is different that than normal Forex.
According to this:
the price of the buy-limit has to be less than the actual price and SL and TP must not be to close to limit price. Print all the relevant prices and specifications and check it. Gold is different that than normal Forex.
Refering to: "Gold is different that than normal Forex. "
This is not always true. - There are brokers that have the calculations set to forex for gold. XAUUSD
My last concern
the invalid price maybe came from what?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Anybody help. i have a BUYLIMIT placed. when EA modify the order it reach me the above error "INVALID PRICE". attached JPEG message display my Ticket#, New BUYLIMIT, ctrade, CURRENT BID price. this is a 2days headache whats wrong of my BUYLIMIT price. I ask anybody to give me a any idea for this matter. thanks a lot in advanced.