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

21 Day Intraday Intensity on NT8

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

    21 Day Intraday Intensity on NT8

    Good day

    Kindly seeking assistance to create the 21 day Intraday Intensity volume indicator on NT8. I referred to previous posts on this site where the indicator was developed in earlier versions of NT. I attempted to convert the code to NT8 and it is compiling without errors. However, when I add the indicator to a chart, it returns nil values or blanks. Please tell me where I am going wrong. I have attached the cs file for your reference. Please help.

    public class bbIIPercent : Indicator
    {
    #region Variables
    private Series<double> IntensityAccumulator;
    private Series<double> VolumeAccumulator;

    #endregion


    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Volume indicator description";
    Name = "bbIIPercent";
    IsSuspendedWhileInactive = true;
    DrawOnPricePanel = false;
    AddPlot(new Stroke(Brushes.MediumBlue, 3), PlotStyle.Bar, "IINorm");
    AddLine(Brushes.Red, 0, NinjaTrader.Custom.Resource.NinjaScriptIndicatorZe roLine);

    }
    else if (State == State.Historical)
    {
    if (Calculate == Calculate.OnPriceChange)
    {
    Draw.TextFixed(this, "NinjaScriptInfo", string.Format(NinjaTrader.Custom.Resource.NinjaScr iptOnPriceChangeError, Name), TextPosition.BottomRight);
    Log(string.Format(NinjaTrader.Custom.Resource.Ninj aScriptOnPriceChangeError, Name), LogLevel.Error);
    }
    }
    }
    protected override void OnBarUpdate()
    {


    double high0 = High[0];
    double low0 = Low[0];
    double close0 = Close[0];
    double open0 = Open[0];

    IntensityAccumulator[0] = ((((2*close0)-high0-low0)/(high0-low0+0.000001))*Volume[0]);
    VolumeAccumulator[0] = Volume[0];
    double IIntensity = SUM(IntensityAccumulator, 21)[0];
    double INormalized = SUM(VolumeAccumulator, 21)[0];
    IINorm[0] = ((IIntensity/INormalized)*100);

    }

    #region Properties
    [Browsable(false)]
    [XmlIgnore()]
    public Series<double> IINorm
    {
    get { return Values[0]; }
    }
    #endregion
    }
    }
    Attached Files

    #2
    Hello trinitrader,

    While fully debugging user code so it works the way you would like it constitutes development and is beyond the support of the scope we can provide, I will leave this page up in case a member of the community is able to help. In the meantime, these questions usually help us answer your questions about indicators not behaving the way we expect. Could you answer as many as possible?

    • Do you see expected results when running the same test environment on the SMA indicator?
      • By expected results, I mean that the SMA indicator shows up on a chart, and larger (slower) periods result in arcs with longer wavelengths and lower frequencies

    • Who are you connected to? This is displayed in green on lower left corner of the Control Center window.
    • Are you connected to your data feed provider when testing your indicator?
    • What instrument(s) (and expiry if applicable) have you selected?
    • What Data Series Type have you selected? Example: Tick, Minute, Day
    • What dates are you reviewing on your chart?
    • For our notes: I see your indicator is a single-timeframe, single-instrument strategy
    • Do you receive an error on screen? Are there errors on the Log tab of the Control Center? If so, what do these errors report?
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      See if this version helps. I tested it on the latest version of NinjaTrader 8 and it worked for me.

      Originally posted by trinitrader View Post
      Good day

      Kindly seeking assistance to create the 21 day Intraday Intensity volume indicator on NT8. I referred to previous posts on this site where the indicator was developed in earlier versions of NT. I attempted to convert the code to NT8 and it is compiling without errors. However, when I add the indicator to a chart, it returns nil values or blanks. Please tell me where I am going wrong. I have attached the cs file for your reference. Please help.

      public class bbIIPercent : Indicator
      {
      #region Variables
      private Series<double> IntensityAccumulator;
      private Series<double> VolumeAccumulator;

      #endregion


      protected override void OnStateChange()
      {
      if (State == State.SetDefaults)
      {
      Description = @"Volume indicator description";
      Name = "bbIIPercent";
      IsSuspendedWhileInactive = true;
      DrawOnPricePanel = false;
      AddPlot(new Stroke(Brushes.MediumBlue, 3), PlotStyle.Bar, "IINorm");
      AddLine(Brushes.Red, 0, NinjaTrader.Custom.Resource.NinjaScriptIndicatorZe roLine);

      }
      else if (State == State.Historical)
      {
      if (Calculate == Calculate.OnPriceChange)
      {
      Draw.TextFixed(this, "NinjaScriptInfo", string.Format(NinjaTrader.Custom.Resource.NinjaScr iptOnPriceChangeError, Name), TextPosition.BottomRight);
      Log(string.Format(NinjaTrader.Custom.Resource.Ninj aScriptOnPriceChangeError, Name), LogLevel.Error);
      }
      }
      }
      protected override void OnBarUpdate()
      {


      double high0 = High[0];
      double low0 = Low[0];
      double close0 = Close[0];
      double open0 = Open[0];

      IntensityAccumulator[0] = ((((2*close0)-high0-low0)/(high0-low0+0.000001))*Volume[0]);
      VolumeAccumulator[0] = Volume[0];
      double IIntensity = SUM(IntensityAccumulator, 21)[0];
      double INormalized = SUM(VolumeAccumulator, 21)[0];
      IINorm[0] = ((IIntensity/INormalized)*100);

      }

      #region Properties
      [Browsable(false)]
      [XmlIgnore()]
      public Series<double> IINorm
      {
      get { return Values[0]; }
      }
      #endregion
      }
      }
      Attached Files

      Comment


        #4
        @TheIndicatorClub thank you very much for assistance. It works fine on NT8

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by kujista, Today, 05:44 AM
        0 responses
        5 views
        0 likes
        Last Post kujista
        by kujista
         
        Started by ZenCortexCLICK, Today, 04:58 AM
        0 responses
        5 views
        0 likes
        Last Post ZenCortexCLICK  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        172 responses
        2,281 views
        0 likes
        Last Post sidlercom80  
        Started by Irukandji, Yesterday, 02:53 AM
        2 responses
        18 views
        0 likes
        Last Post Irukandji  
        Started by adeelshahzad, Today, 03:54 AM
        0 responses
        8 views
        0 likes
        Last Post adeelshahzad  
        Working...
        X