Announcement

Collapse
No announcement yet.

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 Frank1000, Today, 03:05 AM
                0 responses
                2 views
                0 likes
                Last Post Frank1000  
                Started by ntdev, Today, 01:14 AM
                1 response
                7 views
                0 likes
                Last Post NT-Roland  
                Started by ct, Today, 02:22 AM
                0 responses
                5 views
                0 likes
                Last Post ct
                by ct
                 
                Started by yodaler, Yesterday, 06:12 PM
                3 responses
                11 views
                0 likes
                Last Post yodaler
                by yodaler
                 
                Started by sinpeople, 05-07-2021, 04:38 AM
                2 responses
                21 views
                0 likes
                Last Post hedgeplay  
                Working...
                X