Multi timeframe – MTF indicators for ProRealTime

Forums ProRealTime English forum ProBuilder support Multi timeframe – MTF indicators for ProRealTime

  • This topic has 71 replies, 26 voices, and was last updated 4 weeks ago by avatardruby.
Currently, there are 1 user and 1 guest visiting this topic.
View all attachments
Viewing 12 posts - 61 through 72 (of 72 total)
  • #166677 Report

    Thanks Nicolas,

    Agreed, it seems that the strategy back test is more accurate than the multi time frame computing within indicators. That is good to know.

    It means also that when you do calculation with MTF with recursive indicators, you may need to display a huge number of bars to get an accurate result.

    20 k bars of 1 minutes are approx 1333 bars of 15 minutes.

    I slightly changed the indicator to add a count of the number 15 minute  bars in the 1 minute graph.

    I created also an indicator to simply count the barindex on the M15 unit chart.

    Result is follows, and might explain :

     

     

    Attachments:
    #166707 Report

    Actually there is another thing that seems constant but I have not seen it documented anywhere. May be I missed something. I yes, please send me the link to the documentation.
    It seems there are always an extra 1000 bars loaded in the strategy tester / Back test WHATEVER the time frame. 1000 bars on M15, 1000 bars on M5, 1000 bars on M1 and so on.

    Is there a parameter for this setting?

     

    I modified the backtest as follows to add the number of bars seen in the BT on M15 and M1 timeframes:

    sNbBarsM15 = barindex

    and

    sNbBarsM1 = barindex

    Result is that there are 1000 more bars in the BT than displayed by an indicator :

     

     

    Attachments:
    #166718 Report

    Use

    2K are loaded by default to make sure it can calculate indicators from the first bar.

    You can also increase that numer up to 10K.

     

    1 user thanked author for this post.
    #166743 Report

    Thanks Roberto,

    I know this setting for indicators. It cannot be used inside a strategy.

    I was more speaking of what I found out for the Strategy back tester those 1000 bars added to each individual timeframe engine.

    I think that in a backtest using MTF, there are as many isolated calculation engines as the number of time frames : one engine for each time frame, and each engine has 1000 extra bars are allocated at strategy launch.

    Variables can be queried  only from another time frame space.

    I have seen no setting to change that extra 1000 bars number.

     

    #166744 Report

    That setting is for strategies, not indicators.

     

    1 user thanked author for this post.
    #166745 Report

    Thanks Roberto,

    My mistake I tested it, it does change the number of bars preloaded on strategies

    DEFPARAM PreLoadBars = 4000

    gives 4000 bars preloaded for each time frame. and

    DEFPARAM PreLoadBars = 0

    gives the same number of bars on the indicator and on the strategy. Good to double check to check indicators and backtest computing are aligned.

    it seems the default is 1000

     

     

     

    #171286 Report

    Hi guys,

    apologies of this is a dumb question but i am new to MTF coding & hope that i have it correct.

    question is: if i have a 2 bollinger bands from 2 different time frames (say 1 min & 10 min) does it overlay the 10min onto the 1 min chart or does it  get data from the 10min chart ie: the close & the bollinger from the 10min?

    hoping this makes sense.

    #171290 Report

    The way you placed your TIMEFRAMEs count is updated every 10 minutes as it’s part of that TF.

    Move lines 1-3 to just below line 6 to make lines 8-10 part of the default TF (you can remove UpdateOnClose from the default TF, as it sets the pace and nothing can be updated there other than at closing time).

    There you go:

    #171366 Report

    Thanks Roberto, that makes sense. The TF above any code is used until a new TF is placed.

    Legend keep up the good fight ☺️

    1 user thanked author for this post.
    #173070 Report

    Been looking into MTF. I set up the following to verify my understanding of MTF operations but the results were not what I was expecting.

    The setup…           2 charts, see screenshot, 1 and 2 minute both with basic price candles and default supertrend.

    Below the main chart added a custom indicator, see code, to both, to give a binary indication of the price ‘close’ crossing the supertrend line.

    Further, to the 1 min chart a second custom indicator using the same code as other but prefixed with ‘timeframe(2mn)’.

    The chart labeling…     Charts – 1Minute and  2Minute            Indicators – A, B and C            Areas of Interest – 1, 2 and 3

    What I expected…   On 1min and 2min charts, indicators [A]  and [C]’s changes align up with the ‘close’, crossing the supertrend.

    At this point I was expecting indicator [B] on 1min to display the same as [C] but it didn’t in several ways.

    Problems…

    a) When [B] goes low at beginning of area 1, [C] is high, and the close doesn’t break supertrend.

    b) Why does [B] stay low when [C] stays High cover area 1.

    b) When [B] goes high at beginning of area 2, [C] goes high but not at same time.

    c) Why when [B] goes low at end of area 2, [C] now does the same.

    d) Why when [B] goes high then low at area 3, [C] also does.

    e)  bgnfgnstg    (Banged head on keyboard!)

    Investigation…         After a bit of prodding and poking, here what i found.

    After comparing the closing candles of both charts with the 2min supertrend  I found that the unexpected changes on [B],(a)(c) aligned up with the close of 1min candles breaking the 2min supertrend before the 2min candles did. This also accounted for (c)(d) since the 1min candles didn’t’ reach the 2min supertrend before the 2min candles, the opposite.

    However, I could find an explanation for (b) and why when the 2min prices closed above the 2min supertrend that [B] didn’t go back high but stay low until area 2 though it would have gone low prior to area 2.

    Conclusion…       In the scope of the TimeFrame(x) command, it appears that  ‘close’, in this case, doesn’t refer to the (x) timeframe but the default or timeframe of the chart the indicators is in. Since price is an indicator I would expect this, but since a 2min candle is made up of two 1min candles it makes sense that the close of the first minute of a 2min candle could be lower of higher than the 2 minute.

    Regarding (b) and why it stops low when all indications show it should have gone high I have no idea.

    Over to you…

     

    Attachments:
    #173078 Report

    Can you explain what you want to achieve with that indicator?

    On which TF’s do you want to use?

    It appears you are not using any TF, why did you comment it out?

     

    #173086 Report

    Thanks for replying.

    • I was trying to understand how to use the TF function worked and verify results, not particularly creating an specific indicator.
    • Getting 2minute data, indicator [C] results in the 1minute timeframe.
    • Regarding the commented TF in the code. It is un-commented in the custom indicator for [B] but commented in [A][C] just copied same code when created NEW indicators .

    Since sleeping on it and reading documentation it appears that most of problems I saw were  because of not using the ‘MODE’ parameter in the TF syntax. In my code for indicator [B] it used the default TF update’s rather than update’s from the selected TF. This created a scenario  were  certain 1min close’s on the default TF triggered the condition in the selected TF code before the 2min closes could.

    Using the Mode ‘UPDATEONCLOSE’ gave the results what I was originally expecting.

    So problem solved. Thanks for responding

     

     

    Attachments:
Viewing 12 posts - 61 through 72 (of 72 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login