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

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

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    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.

    Leave a comment:


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

    Leave a comment:


  • mate41
    replied
    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.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    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.

    Leave a comment:


  • mate41
    replied
    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.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    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?)

    Leave a comment:


  • mate41
    started a topic indicator with 1min & 5min volumes

    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.

Latest Posts

Collapse

Topics Statistics Last Post
Started by DJ888, 04-16-2024, 06:09 PM
6 responses
18 views
0 likes
Last Post DJ888
by DJ888
 
Started by Jon17, Today, 04:33 PM
0 responses
1 view
0 likes
Last Post Jon17
by Jon17
 
Started by Javierw.ok, Today, 04:12 PM
0 responses
6 views
0 likes
Last Post Javierw.ok  
Started by timmbbo, Today, 08:59 AM
2 responses
10 views
0 likes
Last Post bltdavid  
Started by alifarahani, Today, 09:40 AM
6 responses
41 views
0 likes
Last Post alifarahani  
Working...
X