CT
Topics
Forum Topics not found
Replies
ctid6737874
18 Jun 2024, 18:49
( Updated at: 19 Jun 2024, 04:57 )
Why LoadMoreHistory is needed
We have a bot that trades on Renko timeframes. We wanted to add multi timeframe rsi values, but the backtesting didn't load enough data. So now we're resorting to running dummy bots to dump out the RSIs to text file so we can use them while backtesting. It's quite hackish. The feature should be symmetric, in that LoadMoreHistory should work the same as in live trading. Right now it's essentially broken for multi timeframe indicators and bot backtests…
@ctid6737874
ctid6737874
20 Jun 2024, 20:45 ( Updated at: 20 Jun 2024, 20:50 )
RE: RE: Load more History on Backtest
eynt said:
I'm seeing the same thing. LoadMoreHistory hangs inside indicators and doesn't pull enough data in backtests. I even started the backtest way earlier so I could accumulate enough points to drive 1440 * 14 candles for a daily RSI using minute data. I'm also getting discrepancies between multi timeframe RSI on tradingview vs ctrader. I made a bunch of RSIs: 1m, 5m, 15m, 30m, 1h, 2h, 4h, 1d based off of the 1 min chart by using periods 1*14, 5*14, 30*14… etc. I can't seem to get enough data loaded so that the chart looks right. When I use Bars.GetMarketData(tf) it never loads enough either.
edit: here's the pine script i used to compare
//@version=5
indicator("Multi Timeframe RSI", overlay=false)
// Input parameters
rsiLength = input.int(14, title="RSI Length")
// Function to calculate RSI for a given timeframe
rsiTF(tf) =>ta.rsi(close, rsiLength)
// Calculate RSI for different timeframes
rsi_1m = request.security(syminfo.tickerid, "1", rsiTF("1"))
rsi_5m = request.security(syminfo.tickerid, "5", rsiTF("5"))
rsi_15m = request.security(syminfo.tickerid, "15", rsiTF("15"))
rsi_30m = request.security(syminfo.tickerid, "30", rsiTF("30"))
rsi_1h = request.security(syminfo.tickerid, "60", rsiTF("60"))
rsi_2h = request.security(syminfo.tickerid, "120", rsiTF("120"))
rsi_4h = request.security(syminfo.tickerid, "240", rsiTF("240"))
rsi_1d = request.security(syminfo.tickerid, "1440", rsiTF("1440"))
plot(rsi_1m, title="RSI 1M", color=color.new(color.red, 0), linewidth=1)
plot(rsi_5m, title="RSI 5M", color=color.new(color.yellow, 0), linewidth=1)
plot(rsi_15m, title="RSI 15M", color=color.new(color.orange, 0), linewidth=1)
plot(rsi_30m, title="RSI 30M", color=color.new(color.fuchsia, 0), linewidth=1)
plot(rsi_1h, title="RSI 1H", color=color.new(color.green, 0), linewidth=1)
plot(rsi_2h, title="RSI 2H", color=color.new(color.blue, 0), linewidth=1)
plot(rsi_4h, title="RSI 4H", color=color.new(color.purple, 0), linewidth=1)
plot(rsi_1d, title="RSI 1D", color= color.new(color.silver, 0), linewidth=1)
@ctid6737874