Backtesting Range Bars - Not Getting Correct Bar Volume
Backtesting Range Bars - Not Getting Correct Bar Volume
05 Sep 2024, 12:54
Hi
New to CTrader Algo and running my first backtest on ticks from the server.
If I select minute bars, tick bars or Heikin Ashi, Bars.Last(0).TickVolume
returns the volume as expected.
If I select Range or Renko, TickVolume
always returns the value 1.
I'm seeing this for the OnBar()
event and for the OnBarClosed()
event.
Very disappointing. I thought that we finally had workable range bar backtesting, but unless I'm missing something, this looks like a show stopper.
Please advise.
Replies
scotpip
09 Sep 2024, 17:51
( Updated at: 10 Sep 2024, 05:12 )
The workaround!
No response :-(
I've noticed from the Suggestions forum that this has been an issue for years now, so it's not me being dim as I first thought.
Is there really no move to get this fixed? It seems like a pretty ugly anti-feature.
In an algo, there is the workaround I mentioned where we can calculate volume ourselves using the OnTick()
event. But we can't see volume on the charts when trading manually or checking our algo trades.
I was about to write an indicator, but a kind soul in the community got there first. For anyone who stumbles on this thread, here's the fix:
https://ctrader.com/algos/indicators/show/3045/
@scotpip
PanagiotisCharalampous
10 Sep 2024, 05:17
Hi there,
We do not plan to support this feature at the moment.
Best regards,
Panagiotis
@PanagiotisCharalampous
scotpip
05 Sep 2024, 14:16 ( Updated at: 05 Sep 2024, 22:44 )
Struck me that I should also check volume in live demo mode.
Same problem - Range Bar volume is always set at 1 in both
OnBar()
andOnBarClosed()
.I really do hope I'm missing something, or CTrader won't be viable for me.
EDIT:
I've realised that I could calculate the volume myself in the
OnTick()
event - so not a show stopper. But not ideal either - I'd still appreciate a solution.@scotpip