michelpmcdonald / Ninjatrader

Ninjatrader indicators
GNU General Public License v3.0
21 stars 8 forks source link

relvolavg indicator #1

Open jjavilp opened 3 years ago

jjavilp commented 3 years ago

Hello, I found your RelVolAvg indicator for ninjatrader very interesting, but when testing it I have not been able to show it in the 1 minute time frame. Do you know why? Thanks

michelpmcdonald commented 1 year ago

Hi, sorry for the very late response, just noticed you issue.

Not really working on Ninjatrader stuff too much these days, but, the issue with the relvolavg crashing is usually missing history.

SO, for example, for relvol on a 15 minute chart for the bar starting at 9:30, I go back in "history" and try to grab the 9:30 bar for X previous days.....lets say I can't find the 9:30 bar for 2 days ago, i throw an exception.

I have a few ideas on how to deal with a missing history bar...like for example: Just skip it, so if your relvol period is 5 days, and your missing day 3, just calc the average period volume for 4 days. Or average the bar before and the bar after the missing bar and use that for the missing bars volume.

Here is a link to where I throw an exception for missing history, so that would be the spot in the code to start to deal with it if you want to give it a go:

https://github.com/michelpmcdonald/Ninjatrader/blob/caa3c217114bd6e8bc20b2229ed6ab62c8566fb4/RelVolAvg/RelVolAvg.cs#L211