I've been staring at the screen for hours and out of ideas. Desperate for help
I'd like to add simple up triangles when the fast smi crosses over the average smi and down triangles when it crosses lower. so when the SMI is > SMI average for the previous bar, and then the current bar SMI < SMI average hits for the current bar, the next bar will issue a sell signal.
Where I should start?
protected override void Initialize() { Add(new Plot(new Pen(Color.Green,2), PlotStyle.Line, "SMI"));//Plot0 Add(new Plot(new Pen(Color.Red,2), PlotStyle.Line, "AvgSMI"));//Plot1 Add(new Line(Color.Gray, -40, "Lower")); Add(new Line(Color.Gray, 40, "Upper")); rel_diff = new DataSeries(this); diff = new DataSeries(this); CalculateOnBarClose = false; AutoScale = false; } /// <summary> /// Calculates the indicator value(s) at the current index. /// </summary> protected override void OnBarUpdate() { if(CurrentBar < percentKLength || CurrentBar < percentDLength)return; double min_low = MIN(Low, percentKLength)[0]; double max_high = MAX(High, percentKLength)[0]; rel_diff.Set(Close[0] - (max_high + min_low)/2); diff.Set(max_high - min_low); double avgrel = EMA(EMA(rel_diff, percentDLength), percentDLength)[0]; double avgdiff = EMA(EMA(diff, percentDLength), percentDLength)[0]; smi.Set(avgrel/(avgdiff/2)*100); AvgSMI.Set(EMA(smi, percentDLength)[0]); }
Comment