I developing a strategy with the wizard and want to trigger a buy order when the diff line from the MACD indicator crosses over the "zero line". However, the indicator wizard doesn't allow me to select the zero line because it's not a plot line. (It's just a line.) I tried to change the "new line" code to "new Plot" but that resulted in removing the line all together.
In other attempts I changed the name "zero line" to just "zeroline" because Ninja doesn't line the space. And got a CS0117 error that sys 'double' does not contain a definition for 'Set'
Below is some of the MACD indicator code.
protected override void Initialize()
{
Add(new Plot(new Pen(Color.Yellow, 1), PlotStyle.Line, "Diff"));
Add(new Plot(new Pen(Color.Blue, 2), PlotStyle.Bar, "DiffUp"));
Add(new Plot(new Pen(Color.Red, 2), PlotStyle.Bar, "DiffDown"));
Add(new Plot(new Pen(Color.Cyan, 1), PlotStyle.Line, "DiffAvg"));
Add(new Line(new Pen(Color.Red, 1), 0, "Zero line"));
I think the strategy code would be something like below where "XXXX" is the zero line.
// Condition set 1
if (CrossAbove(MACDScalp(5, 5, 34, 5).Diff, MACDScalp(5, 5, 34, 5).XXXX, 1))
{
EnterLong(DefaultQuantity, "LONG 1A");
Does anyone know what is the best solution to this???
Thanks for your help!!!
Comment