Open Mindset7of9 opened 1 year ago
Hi @Mindset7of9, sorry about the late response, just noticed.
If the code does not compile, I'm not sure what the issue is, guessing it's not a big deal, but my windows laptop broke, so I really don't have a way to check myself at this point.
If the code compiles, but crashes when it's run, i think it's missing history.
Not really working on Ninjatrader stuff too much these days, but, the issue with the relvolavg crashing is 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
Hi Copied and pasted your relvolavg code and it causes NT8 to crash FYI.