You should sell at the Bid, not the Ask, for market orders. For limit and stop orders you certainly don't want them to execute at Bid/Ask, rather at
entryPrice.
lippmaje:
You should sell at the Bid, not the Ask, for market orders. For limit and stop orders you certainly don't want them to execute at Bid/Ask, rather at entryPrice.
Yes sorry thanks, I copied that from a previous version of the code where I didnt have OnChartEvent completed.
I have updated the code now. Any advice welcome on how to return OP_SELL or OP_BUY if the entry price is within 5pips above or below the current
market price.
You should sell at the Bid, not the Ask, for market orders. For limit and stop orders you certainly don't want them to execute at Bid/Ask, rather at entryPrice.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I have a button when clicked will create an immediate or pending buy order.
I have a function that determines whether the order should be a buy if the current price is within +- 5 pips of the entering price that is inputed by the user. If the entry price is greater than +- 5 pips of the current price then it is a pending order.
The problem is the logic is not sending an immediate buy order when the current price +- 5pips. When the price is greater than +- 5pips the pending orders seem ok. No errors.