Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Cannot apply inexing for Multi Time Frame Strategy

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

    Cannot apply inexing for Multi Time Frame Strategy

    Hi all,

    I am just beginning to construct a multi time frame strategy and am having some trouble starting off.

    I am just looking to set a series of doubles for certain time periods but get the error message "cannot apply indexing with [] to an expression of type 'double'".

    As is usual, it is probably a simple error, but would appreciate any advice as to how to obtain the required doubles so they can be utilised for the strategy.

    The required code is written below.
    PHP Code:
            protected override void Initialize()
            {
            
                // add a 1 day bars object - BarsInProgress index = 1
                Add(PeriodType.Day, 1);
                
                // Add a 100 tick Bars object - BarsInProgress index = 2 
                Add(PeriodType.Minute, 1); 
                
              
                //Check to see the importance of the BuySellPressure
                //BuySellPressure().CalculateOnBarClose = false; 
    
                // Sets a trail stop of 2 percent 
                SetTrailStop(CalculationMode.Percent, 0.02); 
                
                CalculateOnBarClose = true;
    
            }
    
            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
                // Checks if OnBarUpdate() is called from an update on the primary Bars 
                if (BarsInProgress == 0) 
                {
                    double lastDayHigh = High[1][0];
                    double secondLastTick = Close[2][1];
                    double lastTick = Close[2][0]; 
    

    Many thanks for any advice

    4blue

    #2
    Please use Highs and Closes in a multiseries context then -



    Comment


      #3
      Thank you very much for the quick response.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      630 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      364 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      566 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X