Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problem with strategy and two instruments

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

    Problem with strategy and two instruments

    Hi

    I am having trouble with referring to two instruments in a strategy. Using a single instrument YM chart I have added a custom strategy. I have added a second data series using

    protectedoverridevoid Initialize()
    {
    CalculateOnBarClose =
    true;

    Add(
    "ES 12-09", PeriodType.Minute, 5);
    }

    In On bar update I have the following lines:

    string1 etc = CurrentDayOHL().CurrentLow[0].ToString();
    This is returning the value of the second data series not the first ie YM

    string2 etc = Closes[
    1][0].ToString();

    This line is working correctly

    The question is how do I get string1 to equal the value relating to the first data series ie YM in this case?




    #2
    MicroAl,

    Please be sure you are working within the correct BarsInProgress context.

    if (BarsInProgress == 0) <-- you are in YM
    if (BarsInProgress == 1) <-- you are in ES
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Problem with strategy

      Josh

      Thanks. Used a check as suggested - solved problem

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      220 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      135 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      150 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      236 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      193 views
      0 likes
      Last Post CarlTrading  
      Working...
      X