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

indicator with 1min & 5min volumes

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

    indicator with 1min & 5min volumes

    Hi,
    i've some problem finish the plot section/

    Code:
    //variables
    private DataSeries myDataSeries;
    // initialize
    Add(new Plot(new Pen(Color.Red, 2), PlotStyle.Line, "VolumeFast"));  // 1min plot
    Add(new Plot(new Pen(Color.Blue, 2), PlotStyle.Line, "VolumeSlow"));  // 5min plot
    Add(PeriodType.Minute, 5);
    // OnBarUpdate
    VolumeFast.Set(Volumes[0][0]);    // plot the 1min volume
    VolumeSlow.Set(Volumes[1][0]);    // plot the 5min volume
    It plots a "ladder line".
    How can i plot the 2 lines: 1 red, 2th blue.
    Thanks
    Attached Files
    Last edited by mate41; 02-26-2016, 08:37 AM.

    #2
    Hello mate41,

    There are two plots that are added as line plots. These will connect each point and will not be straight. This type of plot is the type of plot used for the SMA.

    I am unsure of the ladder line you are describing. Can you include a screenshot of this?

    To send a screenshot with Windows 7 or newer I would recommend using Window's Snipping Tool.
    Click here for instructions

    Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screen shot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.
    Click here for detailed instruction


    Also, in the script you are setting VolumeFast and VolumeSlow. Are these public plots declared in the properties region of the script?
    May I see the code for this as well?
    (Does your script compile without error?)
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I've added a screenshot in 1st post.
      Code:
      [Browsable(false)]    // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
              [XmlIgnore()]        // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
              public DataSeries VolumeSlow
              {
                  get { return Values[0]; }
              }
      
              [Browsable(false)]    // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
              [XmlIgnore()]        // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
              public DataSeries VolumeFast
              {
                  get { return Values[0]; }
              }
      There is no more code than indicated.
      Last edited by mate41; 02-26-2016, 08:52 AM.

      Comment


        #4
        Hello mate41,

        Public DataSeries are declared in the Properties region.

        Please open the MACD indicator and view lines 79 through 84 where a public DataSeries is declared to return the internal plot created by NinjaTrader.

        Tools -> Edit NinjaScript -> Indicator... -> MACD -> OK
        Click the plus to expand #region Properties
        View lines 79 to 84

        This makes the plot public so that it can be accessed from outside of the script. In the MACD likes 79 through 84 is how the Avg plot is created. This is so that Avg.Set() can be used instead of Values[1].Set().

        In your script, both VolumeFast and VolumeSlow are returning Values[0]. This means that Values[1] is never being set in your script.

        Thus only one plot will ever appear.

        I believe you intended for VolumeSlow to return Values[1] as this is the second plot.

        Below is a link to the help guide on Values.
        http://ninjatrader.com/support/helpG...nt7/values.htm


        With your screenshot in post 1 I am not understanding how this is a ladder. Can you further explain how the plot line is a ladder?
        Last edited by NinjaTrader_ChelseaB; 02-26-2016, 08:57 AM.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by mate41 View Post
          I've added a screenshot in 1st post.
          Code:
          [Browsable(false)]    // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
                  [XmlIgnore()]        // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
                  public DataSeries VolumeSlow
                  {
                      get { return Values[0]; }
                  }
          
                  [Browsable(false)]    // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
                  [XmlIgnore()]        // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
                  public DataSeries VolumeFast
                  {
                      get { return Values[0]; }
                  }
          There is no more code than indicated.
          Sorry, found the problem if it is right:
          Code:
           get { return Values[0];
          corrected with :
          Code:
           get { return Values[1];
          now there are 2 lines, a red and a blue.

          Comment


            #6
            After a cleanup the indicator don't display the lines anymore.
            Here is the code. What could be wrong ?
            thanks
            Attached Files

            Comment


              #7
              Hi mate41,

              Are you getting any errors in the Log tab of the Control Center?

              I see that you have a secondary series added to your script of 5 minutes.

              Remember that if your second data series is 5 minutes and your primary data series is a 1 minute. There will be 4 - 1 minute bars before there is any 5 minute bar.

              In other words, are you calling an index that doesn't exist?
              (Are you trying to call the volume of a 5 minute series before its been 5 minutes?)

              Try adding a check to your code that both series have at least 1 bar.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Thanks Chelsia,
                with the cleanup, I removed mistakenly the "CurrentBar control of 5 OnBarUpdate's".
                B.R.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by algospoke, Yesterday, 06:40 PM
                2 responses
                23 views
                0 likes
                Last Post algospoke  
                Started by ghoul, Today, 06:02 PM
                3 responses
                14 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by jeronymite, 04-12-2024, 04:26 PM
                3 responses
                45 views
                0 likes
                Last Post jeronymite  
                Started by Barry Milan, Yesterday, 10:35 PM
                7 responses
                21 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by AttiM, 02-14-2024, 05:20 PM
                10 responses
                181 views
                0 likes
                Last Post jeronymite  
                Working...
                X