Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Print() doesn't get printed and please check

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Print() doesn't get printed and please check

    Hello.
    Could someone help me if this alert indicator is OK? Please help check. It's my first indicator and it doesn't work. Many print() doesn't get printed on output window. OnBarUpdate seems not to print those, only once a while.

    Thanks
    protectedoverridevoid Initialize()
    {
    Add(new Plot(Color.FromKnownColor(KnownColor.DodgerBlue), PlotStyle.Dot, "LongSignal"));
    Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Dot, "ShortSignal"));
    CalculateOnBarClose = false;
    Overlay = true;
    PriceTypeSupported = false;
    }
    protectedoverridevoid OnBarUpdate()
    {
    Print("test");
    double LongEMA = EMA(19)[0];
    double ShortEMA1 = EMA(8)[1];
    double ShortEMA = EMA(8)[0];
    //PriceType = PriceType.Close;
    LongSignal.Set(Low[0]);
    //ShortSignal.Set(High[0]);
    Print("ShortEMA " + ShortEMA.ToString());
    Print("ShortEMA1 " + ShortEMA1.ToString());
    Print("High[1] " + High[1].ToString());
    Print("High[0] " + High[0].ToString());

    if( (High[1] < EMA(8)[1]) && (High[1] < EMA(19)[1]) )
    {
    if( (High[0] >= EMA(8)[0]) || (High[0] >= EMA(19)[0] ) )
    {
    ShortSignal.Set(High[0]);
    Print("We got Short alert at " + Low[0].ToString() );
    Alert("ShortAlert", NinjaTrader.Cbi.Priority.High, "Short ALERT!", "Alert1.wav", 10, Color.Black, Color.Yellow);
    }
    }
    if( (Low[1] > EMA(8)[1]) && (Low[1] > EMA(19)[1]) )
    {
    if( (Low[0] <= EMA(8)[0]) || (Low[0] <= EMA(19)[0] ) )
    {
    LongSignal.Set(Low[0]);
    Alert("LONGAlert", NinjaTrader.Cbi.Priority.High, "LONG ALERT!", "Alert1.wav", 10, Color.Black, Color.Yellow);
    }
    }

    #2
    This may help: http://www.ninjatrader-support2.com/...ead.php?t=3170

    Also, please check Logs tab first whenever you encounter an unexpected behavior.

    Comment


      #3
      thanks, it works

      thanks, it works

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      213 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      127 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      145 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      229 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      190 views
      0 likes
      Last Post CarlTrading  
      Working...
      X