Using MTF for trailing stop

Forums ProRealTime English forum ProOrder support Using MTF for trailing stop

Viewing 7 posts - 1 through 7 (of 7 total)
  • #80547

    Hi,

    First of all, big thanks again for the quality of this forum and the excellence of PRT in implementing progressively new functionalities.

    MTF (MultiTimeFrame) looks like a very promising one.

    I got the idea of using it for a purpose which is not exactly the one it was built for, as far as I understand.

    My idea would be to have a strategy opening positions in a TIME FRAME #1 (ie : 15 minutes), BUT to have an associated trailing stop function managed in a (shorter) TIME FRAME #2 (ie. : 1 minute)

    In my example 15′ should be the “default” time frame… but based on my trial it looks like it is not working because TimeFrame#2 should be a multiple of TIMEFRAME#1 (default).

    Does somebody think there would be a way to manage it so that it is working as per my expectation ?

    Any ideas welcome.

    BR,

     

    #80548

    TF # 1 – 15 mins is a multiple of TF 2 – 1 mins so either I have misunderstood what you are saying or your problem is something else??

    You would need to be running the System on a Chart TF of 1 min.

    If you are trying run on Chart TF of 15 mins then you would get the error message that you got.

    #80557

    You cannot have a 1-minute TF to do something, then launch the default mode on a 15-minute TF, because of these two requirements:

    • all TFs need to be multiple of the default TF
    • the default (which is the main one, the one to which BarIndex, TradeIndex, history data, …. are related) TF has to be be the lowest one

    You’ll have to do the opposite, use the 15-minute TF to run your strategy and launch the default TF on a 1-minute chart to trail SL.

    1 user thanked author for this post.
    #80695

    Thank you for your answers. I will try to explain better my case and for this I will use a real example.

    So let’s imagine that my goal is to run a strategy which would be the following : from 9am, on DAX UT=15min, I am looking to go short as soon as the lowest and the highest of the current candle are lower than the previous highest and lowest. As soon as the condition is there, the system sets a STOP order 1 point below the close of the current candle. And then I am willing to drive this with a classical “10 points trailing stop”, on a 1 minute timeframe basis (to make a closer monitoring of my position). Clear enough ?

    Well, my 1st approach of this is to build the program in the default TF = 15′. And to add at the beginning of the program a TF=1′ section including the trailing stop function only.

    If I do this, I am unable to even run a back test : the system returns an error. Somethin like : “All timeframes in the code must be multiples of the graph’s timeframe

    So that I try it the other way around (code attached) with 1′ time frame as default (trailing stop only) and 15′ time frame including main part of the code. Running this program on the 1′ TF leads to positions taken in the 1′ timeframe in fact… (ie. : 5th September at 9.14am, 5th Sept at 11.25am, at 11.38 am, etc.)

    Is there a way to program in order to obtain what I am willing to get :

    • 15′ TF for positions opening
    • 1′ TF for trailing stop management on open positions

       

    #80700

    It’s because the code is read each minute. Since conditions on the 15-minute TF are valid 15 times, lines 16-18 will be executed each minute. You cannot rely on BARINDEX, since it always refers to the default TF (UT), so you have to work it around as follows:

    1. at line 6 insert these lines to mimick BARINDEX:

    2. replace line 16 with

    3. between line 25 and 26 insert these lines:

    This will prevent more than one trade to be entered within the same 15-minute bar.

     

     

    #80701

    This is the complete code:

     

    1 user thanked author for this post.
    #80702

    Smart !

    Thank you very much Roberto !

Viewing 7 posts - 1 through 7 (of 7 total)

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