Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy with Multiple Time Frames

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

    Strategy with Multiple Time Frames

    I have a 3000 tick strategy that has a 10 min and 2 min bars objects added. One of my methods draws triangle up and down when one indicator swings low and high. The swing is defined like this:

    //Low swing
    if(DmREIplusRSISmoothSlow(BarsArray[0],2,7,2)[0] > DmREIplusRSISmoothSlow(BarsArray[0],2,7,2)[1]
    && DmREIplusRSISmoothSlow(BarsArray[0],2,7,2)[1] < DmREIplusRSISmoothSlow(BarsArray[0],2,7,2)[2])
    {
    DrawTriangleUp("rplusrsmooth low swing" + CurrentBar, true, 1, Low[1] + -8 * TickSize, Color.Yellow);
    Print(Time[0].ToString());
    Print(DmREIplusRSISmoothSlow(BarsArray[0],2,7,2)[1]);
    }

    Typical code depicting the present bar higher then previous bar and previous bar lower then 2 bars ago.

    I was getting incorrect results in the way of swings indicated when there was no swing, ie, the oscillator did not conform to the code. After much painstaking work I have proved that if you have multiple bars objects in a strategy where the base object [0] is the 3000 tick and you add a 10 minute bars object [1], you have to stipulate BarsArray[0] for any method or condition that uses the base bars object.

    If I don't stipulate BarsArray[0], the software whacks out and prints signals in error.

    This is contrary to the help for Multi-Time frame examples where it shows using the base bars object and another BarsArray in a statement. The help does not show using BarsArray[0] in the formula when referencing the base bars object.

    Anyhow, finally figured this out and I don't know if NT developers think this is a bug or not but wanted to put this out there.

    The above example code is what fixes it, remove BarsArray[0] and false signals occur. You can reproduce this probably with any oscillator on a tick chart and adding just one BarsArray. You don't even have to use the second BarsArray in a condition or formula, it's mere presence causes the problem.

    NT7 64-bit 7.0.1000.27 version
    Last edited by gdavis74; 05-09-2015, 10:10 PM.

    #2
    Hello gdavis74,

    Thank you for your post.

    You can also use BarsInProgress to check which bars object is being ran, but yes you are correct - when calling an indicator's method in a multiple time frame or instrument script it is best to pass BarsArray as the Input for the primary or any other added series.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    559 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    546 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X