Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Need help Converting brief math and logic into Ninjascript syntax, VolumeUpDown
First of all I have to thank BigMike for creating the slickest forum I've come across and for fostering such a positive comminity for traders, which is really a rare thing.
I'm struggling to create an indicator that I've made previously in much simpler platforms than Ninjatrader. I know the logic and the math is simple enough, but how to get it into the right syntax seems dauting, looking at the code for the simple indicators in Ninja mine is based on or similar to: VOLMA, ATR, VolumeUpDown. I'm slowly figuring things out through the NT tutorials, but this should be easy for someone with more experience.
Ideally it would look almost identical to the VolumeUpDown indicator that comes with NT, except ofourse with the appropriate calculated values. Looking at the code for that indicator though, it isn't intuitive to me how it relates the change from the previous close to the color of the bar for that condition.
If someone experienced in coding would be willing to lend a hand, it would easily save me a few days figuring out C#, so I could get back to actually working on my trading. Thanks.
Can you help answer these questions from other members on NexusFi?
The VolumeUpDown indicator uses two DataSeries objects. The first data series is used to hold the positive volume bars, in case that the volume is downvolume it is set to zero via Reset(). The second data series is used for the negative volume bars in the same way.
This is NinjaTrader 6.5. coding. With NinjaTrader 7 you would code an indicator with a single data series and then just paint it according to any condition. But let it be, as it works the way it has been coded.
Your definition of the move is not similar to the average true range. I have tried to code the indicator, but it gives strange results, maybe the definitions are not correct.
Wow, thank you Fat Tails, I really wasn't expecting anyone to actually code it for me, your generousity has easily saved me many hours. I understand that ATR is calculated differently than my definition of 'Move' above, I ment that they are similar in that they are both simple math operations applied to the HLC of the current and previous bar. I hoped that I could decipher the math and logical syntax of the stock ATR indicator and apply it to what I wanted to accomplish, but I didn't find the code very intuitive.
Thank you also for the explanation of the VolUpDown coloring, I don't think I could replicate it but I don't foresee myself delving any deeper in to NT coding, since my trading is based on price action patterns and volume largely.
I'd agree that the results are strange, but it is similar to what I was looking for. This is actually a variation of the original one I used on daily charts. The original used price change(%) divided by the volume surge(SMA period 50).
To change it to my original and make it look a bit less wierd:
Here's what you coded(which is exactly what I asked for by the way, no fault on your part):
Here's how I changed it to make it like my original, which was easy to do since you provided the syntax and did all the work:
I've overlayed the 2 in the same panel with the new version in pink/neon green and the original in Dark green/red. A problem with the new version is that it makes bars with small ranges and very small volume relative to the SMA look enormous, due to the math of dividing by a small fraction. Going forward I will likely only use my original version which is really just a tweak of what you made.
Since you took the time to code it for me I'll explain how I use it. I've just recently switched my focus to intraday trading and I am surprised at how well my strategies work on lower time frames. Now I'm using the 1min like my daily and the 5min like my weekly. It isn't an indicator in the traditional sense that provides me with signals, I use it in addition to price and volume analysis. I generally try to trade breakouts from ranges. In my experience what price will do is make a clean 'curl' like action within a range before breaking free from it, and forming a new trend. Often times the bar that completes the curl will have a large range and relatively low volume. The indicator helps to highlight these bars in addition to their size and placement in price action.
In my experience it is a fallacy that significant moves in price are always accompanied by volume when they start. This is at least the case with stocks on a position trading timeframe. The trends that I traded in stocks start by having relatively large bars with lower volume. That is not to say there are not false positives, I only use this to give me more confidence in the price patterns I trade. I've attached a few charts where I think this indicator(which I prefer to call LR, short for Least Resistance) is useful in anticipating a positive expectancy area to enter in price action in the transition from ranging to trending.
A couple hours after I wrote the above:
After some subjective backtesting, it doesn't appear as useful for trading futures intraday as it was for position trading stocks. Looks like I'll just stick to price action patterns and Vol. But thanks anyways Fat Tails, it would have been bugging me for a while if I couldn't actually test it.