Sell and Buy Limit orders are giving 'Invalid Price' error
If it’s a mistake, print at least three parameters: Ask price, Bid price, and freeze level.
If it’s a mistake, print at least three parameters: Ask price, Bid price, and freeze level.
Thank you fo taking the time to reply,
I'm not sure what you mean, can you please explain?
Thanks.
If it’s a mistake, print at least three parameters: Ask price, Bid price, and freeze level.
Okay, so I modified the error to print out the FREEZE_LEVEL also. This is the Journal output that I get
2020.03.13 14:56:27.696 Core 01 2015.01.01 22:05:00 failed sell limit 0.01 AUDCAD at
0.94420 sl: 0.95483 tp: 0.91940 [Invalid price]
2020.03.13 14:56:27.696 Core 01 2015.01.01
22:05:00 CTrade::OrderSend: sell limit 0.01 AUDCAD at 0.94420 sl: 0.95483 tp: 0.91940 [invalid price]
2020.03.13
14:56:27.696 Core 01 2015.01.01 22:05:00 Error opening SELL position by AUDCAD:
'Invalid price'
2020.03.13 14:56:27.696 Core 01 2015.01.01 22:05:00 Open parameters:
price=0.944200, SL=0.954830, TP=0.919400, ASK=0.949690, BID=0.949300, FREEZE=0.000000
Here's the code change that I made.
if (m_trade.SellLimit(lot_size, price, _Symbol, sl_value, tp_value, ORDER_TIME_SPECIFIED_DAY, 5, NULL)) { printf("Position by %s to be opened", _Symbol); } else { printf("Error opening SELL position by %s: '%s'", _Symbol, m_trade.ResultComment()); printf("Open parameters: price=%f, SL=%f, TP=%f, ASK=%f, BID=%f, FREEZE=%f", price, sl_value, tp_value, SymbolInfoDouble(_Symbol, SYMBOL_ASK), SymbolInfoDouble(_Symbol, SYMBOL_BID), SymbolInfoInteger(_Symbol, SYMBOL_TRADE_FREEZE_LEVEL)); }
Okay, so I modified the error to print out the FREEZE_LEVEL also. This is the Journal output that I get
2020.03.13 14:56:27.696 Core 01 2015.01.01 22:05:00 failed
sell limit 0.01 AUDCAD at 0.94420 sl: 0.95483 tp: 0.91940 [Invalid price]
2020.03.13 14:56:27.696
Core 01 2015.01.01 22:05:00 Open parameters: price=0.944200
, SL=0.954830, TP=0.919400, ASK=0.949690 , BID=0.949300,
FREEZE=0.000000
Are you trying to place a Sell limit BELOW the Ask price!
What is Sell limit:
Aaaah, I see. Thanks for pointing that out. I'm still new to all this.
What I'm trying to do is expecting the price to drop lower and when it does, open a position. How would I go about doing this?
Aaaah, I see. Thanks for pointing that out. I'm still new to all this.
What I'm trying to do is expecting the price to drop lower and when it does, open a position. How would I go about doing this?
m_trade.SellStop(lot_size, price, _Symbol, sl_value, tp_value, ORDER_TIME_SPECIFIED_DAY, TimeCurrent()+96*60*60, NULL)Thanks a lot for pointing me in the right direction.

- 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 this is the code I have for opening a SellLimit order
But this is what I get in the Journal
2020.03.13 13:41:18.997 Core 01 2015.01.01 22:05:00 failed sell limit 0.01 AUDCAD at 0.94420 sl: 0.95483 tp: 0.91940 [Invalid price]
2020.03.13 13:41:18.997 Core 01 2015.01.01 22:05:00 CTrade::OrderSend: sell limit 0.01 AUDCAD at 0.94420 sl: 0.95483 tp: 0.91940 [invalid price]
2020.03.13 13:41:18.997 Core 01 2015.01.01 22:05:00 Error opening SELL position by AUDCAD: 'Invalid price'
2020.03.13 13:41:18.997 Core 01 2015.01.01 22:05:00 Open parameters: price=0.944200, SL=0.954830
I've made sure that the price is actually below the current price but for the life of me I can't figure out why this error is coming up.
The only thing I can see is that if you look at the last line "Open parameters: price=0.944200, SL=0.954830" it seems like it's adding an additional zero to the price. If that's the reason, why is it adding an extra zero and how do I get this to work?
Thanks in advance.