Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiinstrument for single instrument...

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

    Multiinstrument for single instrument...

    Greetings Ninja Gurus,

    I'm sure I've missed this somewhere but I'm using the multiinstrument code to add a second time frame filter to a strategy. For example;

    protected override void Initialize()
    {
    //adding a range chart filter
    Add("ES 09-09", PeriodType.Range, 4);
    // below is the regular add stuff
    Add //this and that to the chart

    CalculateOnBarClose = true;
    }

    ... and then the code looks at things in a x minute timeframe.

    Where I'm adding ES 09-09 in the code I'd prefer it adds the instrument of the chart I'm using... so if I call up an ES chart it adds the 4 range ES filter, if I call up a CL chart it adds the 4 range CL filter, etc. In the above example the 4-range filter will always be ES 09-09. Can you point me where to look? Thanks.

    Re reading my question it sounds like I'm on drugs but basically I'm trying to add a higher order time/range/volume or whatever filter to an instrument in a strategy.

    #2
    MXASJ, thanks for the post - unfortunately you can't dynamically add bars objects in the Initialize(). You would need to code this out for each instrument you need.

    Comment


      #3
      You can add a bars object in Initialize, and if you simply leave out the symbol it will default to the same symbol as the primary bars object, i.e.:

      protected override void Initialize()
      {
      CalculateOnBarClose = true;
      Add(PeriodType.Day,1); // Add bars object for daily bars

      }

      Then in OnBarUpdate you can have your filtering code run if (BarsInProgress ==1).

      This will add a daily bars object for the same symbol as the primary bars object. I've never tried it with range bars but I would expect it should work the same way.

      Unless I misunderstand your question I think this will do what you want...

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      656 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      371 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      109 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      574 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      579 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X