Color the Price Bars.

This lesson teaches us to call an indicator, the ADX indicator in our example, and tracks whether it is rising or falling. When Rising we wish to paint the color of the bars Blue and when Falling would like paint the bars Magenta. Otherwise, when the ADX is falling we paint the bars Gray. This sounds all well and good but anyone that has used the ADX will know that the ADX rises in both cases, on a long push and on a short push. So how do we distinguish between long and short colors for the bars using the ADX. Follow along on this lesson to see how we can do so.

 How to shade background on Price Chart based on a Rising or Falling Oscillator

This lesson will teach us to modify the very popular and my favourite indicator the SuperTrend.  The SuperTrend indicator shows the changing of trend based on the sensitivity settings of a computed Average True Range. The bars on the chart change from long to short once the price goes through the volatility stop. In this lesson we will call the MACD oscillator and depending if it average is rising or falling we will paint the background one color or another. This exercise will allow us to be able to provide the user the ability to select their own colors for the background, for the longs and the shorts. When we use the built in Plot functions this colour serialization occurs automatically for us. However, in this case we must do additional coding to provide the user the ability to select from the available color list in NinjaTrader. It can appear confusing at first but not after you have someone explain the how and the why.

 Adding an Alert to an Oscillator.

This lesson teaches us how to add a number of parameters to the Variables and Properties Regions and to define the WAV files and flags to turn the audio on and off, depending on the criteria the user selected in the user dialog box. We will talk about Historical bars and how our indicator should avoid alerting us on those historical bars. We will also add a horizontal line to our oscillator for the zero line.  In addition, we will demonstrate how to create your own personal ALERT WAV file using a FREE utility. The Alert will say: "CL 200 CCI alert" in our example but it could be anything of your choosing. We will learn and use the following reserved words: PlaySound, Historical, Overlay parameter, and Line plot.

Adding an alert to an indicator was the very first inidcator modification I wanted to do on the NinjaTrader platform. We believe this lesson will make it very easy for someone to be able to do so, especially with the background material we have already covered.

 Adding Rising, Falling, and Neutral Colors for a Moving Average

This lesson will teach us to create three individual plot lines to color code the moving average. We will use the reserved words Rising and Falling. Also, we will cover some of the not so clear reasons to plot 1 bar back on a color change. There are many sophisticated methods to plot a moving average colours depending on whether the average is rising or falling. In this lesson we will restrict ourselves to the basic manner to do so as the other methods are to complex at this point.

 

 Adding the choice of which Moving Average to Plot on the Price Chart.

In the previous lesson we added a moving average to the chart. In lesson 3  we will provide the user of the indicator the choice of which moving average type plot in the user dialog box. This selected moving average will be plotted on the Price chart. We will learn about the enum C# function and switch statement ( which is a C# case statement). Finally, we will spend more time on the PLOT statement.

Just a note on the enum function used in NinjaScript Indicators. It is a great feature to allow the user to select from a list but internally there is a fair but going on, which will be explained in detail. If you have ever tried to save an indicator which has an enum as another name, on compilation you will get errors relating to a duplicate name. In this lesson, we will show you how to get around this problem.  

More Articles...

  1. courses-3-art2
  2. courses-3-art1
  3. courses-2-builder
  4. courses-1-whats

Page 2 of 7