• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom IDataSeries in multi-timeframe

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

    Custom IDataSeries in multi-timeframe

    Hi, I have a custom BoolSeries, myBoolSeries, that has its value set when BarsInProgress == 1.


    I want to check its value when BarsInProgress == 0.


    Presumably, the following …


    Code:
    bool myValue = this.myBoolSeries[0];
    … won't work, as it will pick the value in BarsInProgress == 0.


    What will work instead?


    Thanks.
    Last edited by AnotherTrader; 04-29-2014, 08:36 AM.

    #2
    AnotherTrader,

    Thank you for your post.

    How are you setting the BoolSeries in the script?

    Additionally, how is it being synchronized as well? Usually in the Initialize()
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Cal View Post
      ...

      How are you setting the BoolSeries in the script?

      Additionally, how is it being synchronized as well? Usually in the Initialize()

      Hi, Cal

      As below ...


      Code:
       
       
       #region Variables 
       private BoolSeries myBoolSeries; 
       #endregion
        
       protected override void Initialize()
       {
       this.myBoolSeries = new BoolSeries(this);
       }
        
        
       protected override void OnBarUpdate()
       {
       if (this.BarsInProgress == 0)
       { 
       bool myValue = this.myBoolSeries[0];??????
       }
       
       if (this.BarsInProgress == 1)
       { 
       this.myBoolSeries.Set(0, true);
       } 
       }





      Last edited by AnotherTrader; 04-29-2014, 11:09 AM.

      Comment


        #4
        Hi,

        Any further thoughts on this?

        Thanks.

        Comment


          #5
          AnotherTrader,

          There is a synchronization conflict with the logic. Since, BarsInProgress 1 is getting called first before the myBoolSeries has been set, it returns a default false. However, since BarsInProgress 1 gets called more often than BarsInProgress 2 does, it will try to create a new running instance of the myBoolSeries which is why you see the different results.

          You would need to run the myBool Series through a dummy indicator and then you would be able to set the new series to the added BarsArray in your logic.

          Instead of setting the synchronization in the Initialize you would set it the OnBarUpdate()
          Code:
          if(myBoolSeries == null)
          {
               myBoolSeries = new BoolSeries(dummyindicator(BarsArray[1]));
          }
          You can also check out the SampleDataSeries script from our forum page.
          http://www.ninjatrader.com/support/f...ead.php?t=3572
          Cal H.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Udimuz, Today, 06:24 AM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Started by derivtrader, Today, 07:19 AM
          0 responses
          5 views
          0 likes
          Last Post derivtrader  
          Started by MarthaClines, Yesterday, 06:20 PM
          1 response
          13 views
          0 likes
          Last Post NinjaTrader_Jim  
          Started by danitralla, Today, 01:23 AM
          4 responses
          44 views
          0 likes
          Last Post NinjaTrader_DrewO  
          Started by Longhornmark, Today, 06:52 AM
          0 responses
          2 views
          0 likes
          Last Post Longhornmark  
          Working...
          X