Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi instrument strategies

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

    Multi instrument strategies

    Hi! I have some questions on multi instrument strategies.

    First a general question:
    1. Will the the following two statments generate different results in:
    a) real time
    b) back testing?
    Code:
    ADX(BarsArray[2], 14)[0]
    ADX(Closes[2], 14)[0]
    I have a multi instrument strategy with a setup that depends on three different bar series. All three bar series are in the 3 min time frame.
    2 a) Is it correctly understood that there will be a 1 bar difference between the following two print statments when backtesting?
    Code:
    if (BarsInProgress == 0)
                        {
                            Print( Closes[1][0] );
                        }
                    else if (BarsInProgress == 1)
                        (
                            Print( Closes[1][0] );
                        )
    2 b) If so, that it is very importand that I put my entry conditions in (BarsInProgress == 2) when i backtest my strategy?
    2 c) Can there be a difference in real time too between the two statements abvoe, let's say 1Tick?

    I have compared my three bar series from the start of my tradingsession with the GetBar() method. This shows that after a while one series has less bars then the other two.
    3 a) How can this be?
    3 b) Is there a need to sync these bar series some how? If so, how can I do that?

    (At 18:09 series B has one bar less than the other two series and loses another bar at 18:18
    Code:
    2010-03-04 18:03:00  |  BarsInProgress:  2
    Bar Series A:    | Highs[0][0]: 1119,5| GetBar: 41
    Bar Series B:    | Highs[1][0]: 19,14| GetBar: 41
    Bar Series C:    | Highs[2][0]: 94|  GetBar: 41
    
    2010-03-04 18:06:00  |  BarsInProgress:  2
    Bar Series A:    | Highs[0][0]: 1119| GetBar: 42
    Bar Series B:    | Highs[1][0]: 19,2| GetBar: 42
    Bar Series C:    | Highs[2][0]: 63|  GetBar: 42
    
    2010-03-04 18:09:00  |  BarsInProgress:  2
    Bar Series A:    | Highs[0][0]: 1118,5| GetBar: 43
    Bar Series B:    | Highs[1][0]: 19,2| GetBar: [B][COLOR=Red]42[/COLOR][/B]
    Bar Series C:    | Highs[2][0]: -1|  GetBar: 43
    
    2010-03-04 18:12:00  |  BarsInProgress:  2
    Bar Series A:    | Highs[0][0]: 1118,5| GetBar: 44
    Bar Series B:    | Highs[1][0]: 19,21| GetBar: [B][COLOR=Red]43[/COLOR][/B]
    Bar Series C:    | Highs[2][0]: -3|  GetBar: 44
    
    2010-03-04 18:15:00  |  BarsInProgress:  2
    Bar Series A:    | Highs[0][0]: 1118,75| GetBar: 45
    Bar Series B:    | Highs[1][0]: 19,2| GetBar: [B][COLOR=Red]44[/COLOR][/B]
    Bar Series C:    | Highs[2][0]: -8|  GetBar: 45
    
    2010-03-04 18:18:00  |  BarsInProgress:  2
    Bar Series A:    | Highs[0][0]: 1118,75| GetBar: 46
    Bar Series B:    | Highs[1][0]: 19,2| GetBar: [COLOR=Red][B]44[/B][/COLOR]
    Bar Series C:    | Highs[2][0]: 12|  GetBar: 46
    5. Do bars in different bar series of the same time frame always close att the excatly same time?

    /Regards

    #2
    poseidon_sthlm,

    1. Those would work both realtime and backtesting.

    2. Yes, series are updated sequentially, BIP 2 would then be the last one.

    3. Have you rechecked after a data reload already? There might be missing bars in the server data as well...they would already be in sync as they are all 3 min series. What exact GetBar code did you use? Did you counter check with CurrentBar?

    4. Yes, they all would share the same end time stamp then.

    Comment


      #3
      Thanks for the prompt reply!

      I have used this code to generate the print in the previous post.

      Code:
      else if ( BarsInProgress == 2)
                      {
                          Print(Time[0] + "  |  BarsInProgress: " +BarsInProgress);
                          Print( "Bar Series A: " + " | Highs[0][0]: " + Highs[0][0] + " | GetBar: " + GetBar(0, new DateTime(2010, 03, 04, 16, 00, 00, 00)) );
                          Print( "Bar Series B: " + " | Highs[1][0]: " + Highs[1][0] + " | GetBar: " + GetBar(1, new DateTime(2010, 03, 04, 16, 00, 00, 00)) );
                          Print( "Bar Series C: " + " | Highs[2][0]: " + Highs[2][0] + " | GetBar: " + GetBar(2, new DateTime(2010, 03, 04, 16, 00, 00, 00)) );
                      }
      And yes, it wont change when I reload the data.

      When you say "Did you counter check with CurrentBar?" do you mean that I should put Print(CurrentBar) in each BarsInProgress-section? Or can you use CurrentBar with different bar series like GetBar(1, Closes[1])?

      Comment


        #4
        Yes, CurrentBar would work in BIP context as well -

        Code:
         
        if (BarsInProgress == 0)
        Print("Primary" + " " + CurrentBar);
        
        if (BarsInProgress == 1)
        Print("Secondary" + " " + CurrentBar);
        
        if (BarsInProgress == 2)
        Print("Third" + " " + CurrentBar);

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        649 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        370 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
        573 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        576 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X