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 traderqz, Yesterday, 12:06 AM
      11 responses
      27 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by PaulMohn, Today, 03:49 AM
      0 responses
      8 views
      0 likes
      Last Post PaulMohn  
      Started by inanazsocial, Today, 01:15 AM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_Jason  
      Started by rocketman7, Today, 02:12 AM
      0 responses
      11 views
      0 likes
      Last Post rocketman7  
      Started by dustydbayer, Today, 01:59 AM
      0 responses
      4 views
      0 likes
      Last Post dustydbayer  
      Working...
      X