NinjaTrader_Ray
01-03-2007, 02:20 AM
In a NinjaScriptindicator or strategy, you add plots via the Add() method:
For example:
protected override void Intialize()
{
Add(new Plot(Color.Green, "Plot1"));
Add(new Plot(Color.Red, "Plot2"));
}
Plots are automatically added to the Plots array. You can access individual plot objects and modify properties on them through this array.
The example code belowswitches the entire "Plot1" color betweengreen and red depending on the SMA values:
protected override void OnBarUpdate()
{
if (SMA(5)[0] > SMA(15)[0])
Plots[0].Pen.Color = Color.Green;
else
Plots[0].Pen.Color = Color.Red;
}
For example:
protected override void Intialize()
{
Add(new Plot(Color.Green, "Plot1"));
Add(new Plot(Color.Red, "Plot2"));
}
Plots are automatically added to the Plots array. You can access individual plot objects and modify properties on them through this array.
The example code belowswitches the entire "Plot1" color betweengreen and red depending on the SMA values:
protected override void OnBarUpdate()
{
if (SMA(5)[0] > SMA(15)[0])
Plots[0].Pen.Color = Color.Green;
else
Plots[0].Pen.Color = Color.Red;
}