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

Problem plot

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

    Problem plot

    hi guy,

    in my code ..(i do an stupid example)


    int t;
    double s;

    Protected override void OnStateChange()
    {
    AddPlot(Brushes.Green, "Mt");

    AddPlot(Brushes.Green, "Flag");

    }

    protected override void OnBarUpdate()
    {

    t=CurrentBar;

    s=High[0]

    Value[0]=t; =====> this plot the first



    }

    How can i plot the second?

    if i plot : Values[1]=s; ===> is not corret...it accept a dataseries and the variable "s" is'n it
    Last edited by turbofib; 02-26-2016, 04:03 AM.

    #2
    Hello turbofib,

    Thanks for your post.

    As this is an NT8 question, please post future NT8 questions in the NT8 beta forums.

    There are multiple answers to your question.
    Value refers to the first plot
    Value[0] refers to the Current bar on the first plot
    Value[1] refers to the previous bar in the first plot

    Values allows you to refer to multiple plots but you must put both the plot number as well as the bar index so you can use:
    Values[0][0] - First plot, current bar
    Values[1][0] - 2nd plot, current bar
    Values[0][1] - First plot, previous bar

    An alternative way, that I think reads better in the script, is to use the names of the plots (using your examples):

    Mt[0]
    Flag[0]

    So here Mt is the same as saying as Values[0] and Mt[0] is the same as saying Values[0]0]. Flag is the same as saying Values[1] and Flag[0] is the same as saying Values[1][0].

    To finish with your examples:

    Mt[0] = t;
    Flag[0] = s;

    or you can use:

    Values[0][0] = t;
    Values[1][0] = s;

    or you can use:

    Value[0] = t;
    Values[1][0] = s;


    Value: http://ninjatrader.com/support/helpG...-us/?value.htm
    Values: http://ninjatrader.com/support/helpG...us/?values.htm
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      [QUOTE=NinjaTrader_Paul;450171]Hello turbofib,

      Thanks for your post.

      As this is an NT8 question, please post future NT8 questions in the NT8 beta forums.

      Excuse me
      I was wrong to post


      An alternative way, that I think reads better in the script, is to use the names of the plots (using your examples):

      Mt[0]
      Flag[0]

      So here Mt is the same as saying as Values[0] and Mt[0] is the same as saying Values[0]0]. Flag is the same as saying Values[1] and Flag[0] is the same as saying Values[1][0].

      To finish with your examples:

      Mt[0] = t;
      Flag[0] = s;

      I can't write Mt[0] ...it will not let me
      It don't recognizes Mt

      Last edited by turbofib; 02-26-2016, 07:48 AM.

      Comment


        #4
        Hello turbofib,

        Thanks for your reply.

        Can you show what you have for properties that would relate to the plot Mt?

        This is what I would be looking for(assuming Mt is the first plot):

        Code:
        		
        		#region Properties
                        [Browsable(false)]
        		[XmlIgnore]
        		public Series<double> Mt
        		{
        			get { return Values[0]; }
        		}
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          [QUOTE=NinjaTrader_Paul;450200]Hello turbofib,


          Can you show what you have for properties that would relate to the plot Mt?

          None.....i don't write properties...because if i write : value[0] it work the same

          Comment


            #6
            Hello turbofib,

            Thanks for your reply.

            So if you want to use Mt[0] you would have to add the properties, otherwise continue to use Value[0] which is automatically associated with the first plot.
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              This is possible only with 1 plots ( Use Value[0] direct) ?

              Comment


                #8
                Hello turbofib,

                Thanks for your reply.

                Yes, that is correct.
                Paul H.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by inanazsocial, Today, 01:15 AM
                1 response
                5 views
                0 likes
                Last Post NinjaTrader_Jason  
                Started by rocketman7, Today, 02:12 AM
                0 responses
                6 views
                0 likes
                Last Post rocketman7  
                Started by dustydbayer, Today, 01:59 AM
                0 responses
                1 view
                0 likes
                Last Post dustydbayer  
                Started by trilliantrader, 04-18-2024, 08:16 AM
                5 responses
                22 views
                0 likes
                Last Post trilliantrader  
                Started by Davidtowleii, Today, 12:15 AM
                0 responses
                3 views
                0 likes
                Last Post Davidtowleii  
                Working...
                X