saurabhB: Currently I am using following code to take trade on open position of new bar. I would like to take trade on closing price of current bar. (instead of opening price of next bar) Closing price of current candle and opening price of next candle may sound same but it gives ton of false backtesting results in "Line break chart" Anybody here knows how to do it?
Not possible! You can only know what is the closing price of a bar, once the the opening time of a new bar comes about. And even then, there is no guarantee to open a trade with that exact price because there is always slippage and in the case of Buy order, there is also the spread to consider. The close price on the chart is a Bid price, but a Buy order will open with the Ask price.

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
Currently I am using following code to take trade on open position of new bar.
I would like to take trade on closing price of current bar. (instead of opening price of next bar)
Closing price of current candle and opening price of next candle may sound same but it gives ton of false backtesting results in "Line break chart"
Anybody here knows how to do it?
thank you in advance.
regards,
Saurabh