Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 helpwanted, Today, 03:06 AM
      1 response
      10 views
      0 likes
      Last Post sarafuenonly123  
      Started by Brevo, Today, 01:45 AM
      0 responses
      7 views
      0 likes
      Last Post Brevo
      by Brevo
       
      Started by aussugardefender, Today, 01:07 AM
      0 responses
      5 views
      0 likes
      Last Post aussugardefender  
      Started by pvincent, 06-23-2022, 12:53 PM
      14 responses
      242 views
      0 likes
      Last Post Nyman
      by Nyman
       
      Started by TraderG23, 12-08-2023, 07:56 AM
      9 responses
      385 views
      1 like
      Last Post Gavini
      by Gavini
       
      Working...
      X