PDA

View Full Version : Indicator using mixed colors


kgillis23
05-22-2007, 09:18 PM
I am using an indicator which draws multiple chart lines (in this case a Bollinger) and need to set the draw properties (color, thickness, etc.) different for one part of the indicator (the Bollinger Middle) from the other parts. I have found how to do this modifing the properties of the indicator on the chart but I need to do it using Ninjascript in my strategy. How could I do this?

NinjaTrader_Ray
05-23-2007, 08:26 AM
You can try something like the following in the Initialize() method.


Bollinger myBollinger = Bollinger(2, 14); // Assign the indicator to a temp variable
myBollinger.Plots[1].Pen = new Pen(Color.Red, 2); // Change the pen of the middle plot to a color of red and width of 2
Add(myBollinger); // Add the indicator to the chart for display

kgillis23
05-23-2007, 11:21 AM
Thanks, it worked great. I guess the secret is knowing that the Plots array is zero based and in the order of the Plots listed when you edit an indicator (hope that make sense to everyone else).

NinjaTrader_Ray
05-23-2007, 11:44 AM
Correct although for clarification, the are indexed based on how they are added withing the indicator source code Initalize() method.

NinjaTrader_Josh
05-23-2007, 01:52 PM
So we can make commands that modify individual indicator's properties. Can we also make commands that modify the overall chart properties? For instance, I am not use to seeing dates as dd.mm.yyyy on the x-axis and would like to be able to change it to mm.dd.yyyy

Better yet, is there a way I can change the default settings for this so I don't have to do it manually every time?

NinjaTrader_Ray
05-23-2007, 02:07 PM
Within the chart properties dialog (double click on the chart canvas) you can change the format of the x-axis. Once done, right click in the chart and select the menu Templates > Save As Default.