i set the indicator plot and i check at the firsttickofbar on next bar to see if i have a plot, then i write to a file. this logic does not work as i write for every bar even though i dont see the plot every bar
i expect the logic behind if(Plot0[1]>0 && !Historical) to write to fiel only if i had plotted it in the code highlighted in red.
.
protected override void OnBarUpdate() { if( CurrentBar < 5) return; if(FirstTickOfBar) { [COLOR="Red"]alarmonce=true; if(Plot0[1]>0 && !Historical) {[/COLOR] STSPullbacktrade a=new STSPullbacktrade(); a.entrytime=DateTime.Now; a.signal="Pullback"; a.instrument=Instrument.FullName; using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\temp\" + Instrument.FullName + "signals.txt", true)) { file.WriteLine(string.Format("{0},{1},{2}",a.instrument,a.signal,a.entrytime)); } } } // Use this method for calculating your indicator values. Assign a value to each // plot below by replacing 'Close[0]' with your own formula. [COLOR="Red"]if(High[0] <High[1] +TickSize && Low[0] >Low[1] -TickSize ) { Plot0.Set(Close[0]);[/COLOR] if(Bars.PercentComplete >.95 && alarmonce ) { Alert(Instrument.FullName + CurrentBar,NinjaTrader.Cbi.Priority.High, "Getready for insider", "Alert1.wav", 10, Color.Black, Color.Yellow); alarmonce=false; } } else Plot0.Reset(); }
Comment