MTF : amount of orders drops dramatically if I divide the strategy in 2 TF?

Forums ProRealTime English forum ProOrder support MTF : amount of orders drops dramatically if I divide the strategy in 2 TF?

Viewing 15 posts - 1 through 15 (of 19 total)
  • #90866

    Hello,

    I’m trying to develop a strategy on the Dax, TF15min. I have some encouraging results, but wanted to improve the position management thank to the MTF. My idea was simply to take position on a signal given on the TF15min, and exit the position on the UT5min.

    When I backtest the strategy only on the TF15min , I get in two years several hundred of trades. Logically, adding a code snippet for managing existing position on the TF5min shouldn’t impact the number of trades, or marginally. However, I get down to only 5 trades on the same period. Can someone confirm they have the same behaviour, or do I do something wrong?

     

    Here below a very simple strategy that aims to explain my problem. If you run this code on the TF15min, you get hundred of trades, If you run the same one on the TF5min but with the code in comment uncomment, you get far less trades…

     

     

     

    #90872

    Mmm weird … I think I am getting the opposite of what you say??

    I get loads more trades on 5m TF??

     

    #90875

    Did you uncomment the code snippet here below when you tested on the 5min?

    //timeframe (15 minutes, updateonclose)

    ……………..

    //timeframe (5 minute, updateonclose)
    //myMA5=average[7](close)
    //if longonmarket and myMA5<myMA5[1] then
    //sell at market
    //elsif shortonmarket and myMA5>myMA5[1] then
    //exitshort at market
    //endif
    #90876

    I agree with GraHal, add a “0” to your initial capital.

    #90880

    I test it on my demo account, and indeed working fine.

    But on my live account, which is activated for MTF, this doesn’t work! So here is the bug. Nicolas?

    #90882

    First, try to GRAPH your buylevel and selllevel with dummy trading conditions that don’t trigger any order.

    Do it with and without “timeframe (15 minutes, updateonclose)”, in order to see if the levels are calculated the same way and to incriminate the TIMEFRAME instruction or not.

    #90883

    Ok, I have been able to isolate the code line which is causing trouble. Nothing to do with Demo or Live account, sorry my mistake. The code I provided here above was an example, which was very different from most of the original code with which I have some trouble. So the code here above works fine, the code here below doesn’t work because in the conditions to take a position, I added “barindex-tradeindex(1)>=3”, which is a pretty standard code snippet. Any idea why this condition doesn’t work with the MTF?

     

     

    #90884

    With code immediately above I get results below.

    15 min TF results are with the lines of code out … via  // inserted.

    5 min with code in … via  // removed

    3rd image is on 5 min TF with code out via … // inserted again

    #90891

    BarIndex and TradeIndex are determined by the lowest TF (which is the MAIN or Default one). So in your case it’s the index to bars in the 5-minute TF, no matter where you place that line!

    If you need to count bars elapsed in the 15-minute TF you should add your own variables to mimick BarIndex and TradeIndex or replace 3 with 9 (three 5-minute bars are required for each 15-minute bar).

     

    #90892

    Thx Robertogozzi for the info, didn’t know. However, multiplying by 3 the factor doesn’t change the issue. Storing the barindex of the trade seems to work better (via the onmarket not onmarket snippet).

    So this code seems now to work fine. However, the fact that tradeindex function isn’t working smoothly with MTF remains a bug for me, or do I miss something?

     

    #90893

    BarIndex and TradeIndex DO work smoothly… according to the default TF.

    If you use 9, instead of 3 you can keep using TRADEINDEX, my suggestions were ORed, but this won’t affect the strategy, so you can leave it as is now.

    #90895

    Ok but if it works smoothly, can you rework a code using tradexindex and which would work under MTF ? Because I can’t, and the workaround with storing the barindex of the trade is actually not working exactly as the tradeindex function.

    #90896

    Here you are stefou102 … might encourage you .. I get attached!

    I’ll set it going on Demo Forward Test

    Thank You for Sharing

    #90899

    Yes, just forget your custom variable and just change the numeric constant:

    it would be 12 in a 1-hour TF or 60 in a 1-hour TF with a 1-minute DEFAULT TF, and so on…

    MTF requires that you change the way you think of TF’s. The main one, the one setting the pace, is the LOWEST which guarantees that ANY TF used will at least be executed once when its own bar closes and that’s why all TF’s must be multiple of the default (or main) one.

    If, in your case, the 15-minute TF would set the pace, how could ProOrder guarantee that the 1-minute code is executed every minute? Instead, letting the 1-minute TF set the pace, your 15-minute code will be executed every minute and it’s granted it will be executed when the 15-minute bar closes!

    This has some drawbacks:

    • you have less history data
    • you have to do some math to count elapsed bars

    But advantages are far more!

    MTF is just a new feature, which you can take advantage of or not. You may still write strategies with a single TF because MTF may not be beneficial to them, while other strategies you write do improve when using MTF.

    But if tou want to use MTF you must write your code in accordance with it.

     

     

     

    #90901

    Well Understood, but I maintain that using

    barindextradeindex(1)>=9 

    doesn’t work in my code, almost no position are taken anymore…Or are the instruction to place orders always to be inserted in the lowest TF??

    Carefull Grahal, but the code I posted was just to solve the problem, there is no way it can be profitable.

Viewing 15 posts - 1 through 15 (of 19 total)

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