Trade at bar open

Posted By: juanex

Trade at bar open - 04/13/23 19:43

Hello, I am trying to backtest an intraday / overnight strategy with daily bars and would like to set up trade functions at both candle open and candle close, from my understanding, BarOffset can be used to accomplish this however when I set it to trade at market open it still uses the closing price. I am also using Fill = 0 and have set(TICKS) just to compare the prices as close as possible to historical data

can someone guide me on how I can use the opening price as my traded price?

See attachment for trade logs and historical price.

Attached picture Screenshot 2023-04-13 154228.png
Attached picture Screenshot 2023-04-13 154202.png
Posted By: jcl

Re: Trade at bar open - 04/17/23 14:19

Fill = 3

https://zorro-project.com/manual/en/fill.htm
Posted By: juanex

Re: Trade at bar open - 04/17/23 14:57

I thought that something with Fill would be the answer, however, that would make every trade execute at the next candle open, ideally, I want to test the price movement between candle open to candle close and vice versa, not candle open to candle open.
Posted By: jcl

Re: Trade at bar open - 04/18/23 12:52

For testing the price movement, use M1 history. You need then no special fill mode. Just enter the position one minute after market open.
Posted By: juanex

Re: Trade at bar open - 04/28/23 15:07

Forgive me if this sounds like a dumb question but when you say use M1 history, are you referring to simply changing the BarPeriod from 1440 (for daily ) to 1 or are you talking about downloading 1-minute data? if it is the latter I only have daily data at the moment which is why I was trying to look for a workaround by using the opening price of the candle.
Posted By: AndrewAMD

Re: Trade at bar open - 04/28/23 15:21

Both. You need intraday history for intraday backtesting, and you need BarPeriod=1 for one minute bars.
Posted By: juanex

Re: Trade at bar open - 04/28/23 16:15

Yeah that would be the best option if I had that data at the moment.

But to go back to my original question, is there no way to test trading with the bar open price instead of the close?
© 2024 lite-C Forums