I want to run backtest that buy/short stock at the end of the day (e.g. last 5 minutes).
Running the strategy on a daily timeframe will buy at the open of the next day, so I'm running it on 5 minute chart and when the time is the last 5 minutes, then I place an order.
Let's assume that my strategy is checking for daily RSI(2) and triggers according to it.
The problem is that when running on intraday data, I can't access daily indicators, because it will return the previous day data (since the day wasn't ended yet).
So...
I need to calculate current daily RSI 2 (and I can't write RSI(2,1)[0] because it will return yesterday RSI) - how can I do it?
I know that there is the formula in many places to calculate RSI, but when I calculate RSI 2 after 2 days up, then the RSI is 100 - but it should be something else.
Does anyone have a code that calculate daily RSI on intraday?
Btw, I'm using Ninjatrader 7.
Thanks,
Comment