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

Use Closes[X][y] to export multiple data series?

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

    Use Closes[X][y] to export multiple data series?

    is this possible? I am trying to export EOD closing values from the daily timeframe. i can export data from the initial data series no prob, total can of worms trying to export from the secondary.

    ES ##-## on top
    YM ##-## on bottom

    Code:
     
    protected override void Initialize()
    {
    Add("YM ##-##", PeriodType.Day, 1);
    CalculateOnBarClose = true;
    ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
    MaximumBarsLookBack = MaximumBarsLookBack;
    }
    protected override void OnBarUpdate()
    {
     
    if (CurrentBar < 2)
    return;
     
    string data = (Time[0] + dataSeparator + Close[0] + dataSeparator + Time[0] + Closes[0][1]);
     
     
    sw.WriteLine(data);
     
    } 
     
    protected override void OnTermination{
    sw.Close();
    }
    Error is "unable to start market data for instrument YM ##-##. Provider does not support market data". I'm connected to Kenetic EOD

    Also how do i get the Time[0] to index properly to the 2nd data series? is it Time[0][1]?

    #2
    tortexal, for a MultiSeries script you would use Times[bip][index] - if you create a standalone chart of YM continuous - does it work without an issue?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Times[X][X] works great for the 2nd data series, no more ""unable to start market ..." errors

      however, it now exports duplicates for every date and symbol, any idea why?

      new code:
      Code:
       
      protected override void Initialize()
      {
      Add("YM ##-##", PeriodType.Day, 1);
      CalculateOnBarClose = true;
      ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
      MaximumBarsLookBack = MaximumBarsLookBack;
      }
      protected override void OnBarUpdate()
      {
      
      if (CurrentBar < 2)
      return;
      
      string data = (Time[0] + dataSeparator + Close[0] + dataSeparator + Times[0][1] + dataSeparator + Closes[0][1]);
      
      sw.WriteLine(data);
      
      } 
      
      protected override void OnTermination{
      sw.Close();
      }

      Comment


        #4
        Great, you're OnBarUpdate() is called for both series / BarsInProgress, you need to limit it to one to get no duplicates since you export both series in one call.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          can someone please help with an indicator conversion from 6.5 to 7
          there are 4 lines that are having errors the lines are listed below
          thanks

          DrawText(CurrentBar.ToString() + "le", true,

          DrawLine(CurrentBar.ToString() + "sts", 0, sLongPrice[0], 0, Math.Abs(sLongPrice[0] -
          Math.Abs(vAvg - vLongEntry)), iEntryColor, DashStyle.Dash, 1);

          DrawText(CurrentBar.ToString() + "se", true,

          DrawLine(CurrentBar.ToString() + "lts", 0, sShortPrice[0], 0, Math.Abs(sShortPrice[0] + Math.Abs(vAvg - vShortEntry)), iEntryColor, DashStyle.Dash, 1)

          thanks

          Comment


            #6
            Welcome to our forums here - the overloads changed slightly going to NT7, I would suggest steppging through them with Intellisense to see what needs fixing exactly -





            For the future, please create a new thread in the appropriate section for your issues and requests - thanks in advance
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Bertrand View Post
              Great, you're OnBarUpdate() is called for both series / BarsInProgress, you need to limit it to one to get no duplicates since you export both series in one call.
              Can you post a link on how to do that?

              Comment


                #8
                Hello,

                Sure please do the following:



                Please see the following sections:

                Entering, Exiting and Retrieving Position Information

                Let me know if I can be of further assistance.

                Comment


                  #9
                  Thank you got it to work perfectly!
                  Last edited by tortexal; 02-09-2011, 07:59 PM.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Rapine Heihei, Today, 08:19 PM
                  1 response
                  8 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by Rapine Heihei, Today, 08:25 PM
                  0 responses
                  6 views
                  0 likes
                  Last Post Rapine Heihei  
                  Started by f.saeidi, Today, 08:01 PM
                  1 response
                  9 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by Rapine Heihei, Today, 07:51 PM
                  0 responses
                  8 views
                  0 likes
                  Last Post Rapine Heihei  
                  Started by frslvr, 04-11-2024, 07:26 AM
                  5 responses
                  98 views
                  1 like
                  Last Post caryc123  
                  Working...
                  X