Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

add data series

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

    add data series

    hello, im trying to add multi data series to calculate from but when im adding more then one data series something not working..
    im useing the code:

    protected override void Initialize()
    {
    Add("$AUDUSD", PeriodType.Minute, 1); //1
    Add("$CADUSD", PeriodType.Minute, 1); //2
    }

    protected override void OnBarUpdate()
    {
    if (BarsInProgress == 0){Print("0");
    if (BarsInProgress == 1{Print("1");
    if (BarsInProgress == 2){Print("2");
    }

    nothing happen...
    tnx for help

    #2
    Hello,

    Thank you for the post.

    I wanted to check, have you removed the script from the chart and re added it after making this change? In the case you had not, the script may not have added the secondary series yet and caused an error. Could you try this if you have not already?

    If that is not the case, are you able to pull up 1 minute charts for the instruments you have used?

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      tnx for replay

      i did have removed the script from the chart and re added it, not working.

      im not sure what u mean "pull up 1 minute charts for the instruments you have used"

      but if i use only one instrument:
      protected override void Initialize()
      {
      Add("$AUDUSD", PeriodType.Minute, 1); //1
      }

      the indicator run and i can use :
      if (BarsInProgress == 0){Print("0");
      if (BarsInProgress == 1{Print("1");

      but when im add the third instrument none of the "barsinprogress" working..

      Comment


        #4
        Hello,

        Thank you for the reply.

        By pull up a 1 minute chart I had meant, can you create a new chart for the instrument that is not working, and can you view the chart with its historical data in the chart?

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          tnx for replay

          yes i can pullup any chart with is history data as well. the problme is not a specific instrument, the problme when i add more then one instrument to the indicator nothing is working.. not even "BarsInProgress 0"

          Comment


            #6
            Hello,

            Thank you for the reply.

            Could you provide the script you are using for me to review? After looking at what has already been provided I am unsure how this is compiling for you. The code you provided is missing curly braces which would be required for the code to be valid:

            Code:
            if (BarsInProgress == 0){Print("0"); [B]}[/B]
            if (BarsInProgress == 1{Print("1");[B] }[/B]
            if (BarsInProgress == 2){Print("2"); [B]}[/B]
            Please attach the .cs file you are using, it can be found in the folder: Documents\NinjaTrader 7\bin\Custom
            It would be located in the folder for what type this is, if it is an indicator it would be in the Indicator folder. If you do not wish to share the code on the forum, please instead email me at our platform support [at] ninjatrader.com address and provide a link to this post.

            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              my file

              i have attach my indicator here
              Attached Files

              Comment


                #8
                Hello,

                Thank you for providing the file.

                In my test I had typed in the instruments myself and had not noticed that one of the instruments you are trying is not valid. CADUSD is not an instrument but USDCAD is, could you try using the following instead?

                Add("$USDCAD", PeriodType.Day, 1);

                If you are using a Instrument that is not valid from NinjaScript, there is no error it would be assumed that you are trying the correct instrument. After changing this, I do see the prints occurring. I had also removed the historical check to allow historical bars to print, this way I did not have to wait for incoming data to see it was working.



                Please let me know if I may be of further assistance.
                JesseNinjaTrader Customer Service

                Comment


                  #9
                  Tnx!

                  tnx! working perfect!
                  but only on regular timeframes, if i try it on custom timefrime (12sec) not working..

                  Comment


                    #10
                    Hello tomas1983,

                    Thank you for your response.

                    Can you provide an example of the custom timeframe added in code?

                    I look forward to your response.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by helpwanted, Today, 03:06 AM
                    1 response
                    10 views
                    0 likes
                    Last Post sarafuenonly123  
                    Started by Brevo, Today, 01:45 AM
                    0 responses
                    9 views
                    0 likes
                    Last Post Brevo
                    by Brevo
                     
                    Started by aussugardefender, Today, 01:07 AM
                    0 responses
                    5 views
                    0 likes
                    Last Post aussugardefender  
                    Started by pvincent, 06-23-2022, 12:53 PM
                    14 responses
                    242 views
                    0 likes
                    Last Post Nyman
                    by Nyman
                     
                    Started by TraderG23, 12-08-2023, 07:56 AM
                    9 responses
                    387 views
                    1 like
                    Last Post Gavini
                    by Gavini
                     
                    Working...
                    X