Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple Start Aggregation Periods on Same Symbol

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

    Multiple Start Aggregation Periods on Same Symbol

    I am running a strategy on NQ Nasdaq Futures using a 2 hour bar. The trading hours are set to CME US Index Futures ETH. the start time is 5pm and the end time is 4pm the next day.

    with these settings I get a bar that ends at 5pm - 7pm - 9pm etc...

    I would like to add to this strategy by using a 2 hour bar that ends on a different time rotation. Basically have the bar close at 6pm - 8pm - 10pm etc...

    I was going to change the trading hour template but that doesn't allow me to run both start times.

    Is it possible to run a bar with the same aggregation period that begins and ends on different time periods on the same instrument.

    Thank you

    Stefan

    #2
    Hello sdauteuil,

    It is not currently possible to stagger the series like this using the same series. It would likely be easiest to instead use a 60 minute bar and add a logical switch to check this. For example each 1 hour change a bools value to the opposite value. If the bool is true, do one set of logic, and if the bool is false do the other set. This would cause alternating times to be used in the frequencies you noted. Here is a simple example:

    Code:
    bool isSecondLogic = false;
    protected override void OnBarUpdate()
    {
          isSecondLogic = !isSecondLogic;
    
          Print("isSecondLogic " + isSecondLogic + " " + Time[0]);
     }
    Which looks like:

    isSecondLogic False 7/24/2019 5:00:00 PM
    isSecondLogic True 7/24/2019 6:00:00 PM
    isSecondLogic False 7/24/2019 7:00:00 PM
    isSecondLogic True 7/24/2019 8:00:00 PM
    isSecondLogic False 7/24/2019 9:00:00 PM


    The isSecondLogic
    bool could be used after that point to do one or the other sets of logic.


    I look forward to being of further assistance.

    Comment


      #3
      Thank you

      I will work with that

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      56 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      132 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      73 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      45 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X