MTF Sequential Setup

Forums ProRealTime English forum ProOrder support MTF Sequential Setup

This topic contains 7 replies, has 3 voices, and was last updated by avatar GraHal 1 day, 18 hours ago.

View all attachments
Viewing 8 posts - 1 through 8 (of 8 total)
  • #102415

    The problem is how to develop a code that applies a sequential MTF setup ?


    In UT1 an event A is recognized then for a wile (as n periods), we are waiting for a new event B in UT2.

    Then repeat a few more sequential signals, waiting a new event C in UT3, then UT4…

    (UT1 > UT2 > UT3 > UT4)

    I tested several ideas with “summation[n](event)>0” “if event then timeevent = currenttime”, “barindex…”, but nothing works,

    due to the impossibility to mark a first eventA in UT1 and for n period to not detect new eventA

    then only to detect an eventB in UT2 and for n period not to detect again a new eventB

    then only to detect an eventC in UT3…


    There you go:





    Hi Robertogozzi,

    Thank you so much for your code proposal, that I immediately tried to understand 🙂

    • For starters I would just like to check that I have been clear enough in the explanation of my sequential signal need.

    The system need to detect event A in UT1 and to stop detection for n1 period.

    During those n1 period it need to detect envent B in UT2 and to stop detection for n2 period

    During those n2 period it need to detect event C in UT3 and to stop detection for n3 period

    Why to stop detection ? Because of the need to check barindexA < barindexB < barindexC. If the code doesnt stop detection, the sequential setup on the market could be right but not the barindex sequence, and vice versa.

    I can now try to understand your proposal and to discuss it :

    • If I’m right, it detect the eventX and save the bar number (I need that for compare barA<barB<barC<barD) and goes eventX variable from 0 to 1.

    But what happening if the eventX arrives again in the next bar ? Does it save again the new bar number and barX increases by 1 ?(I need him not to do it)

    • Also, if too many bars have elapsed, then it cancel eventX by going eventX variable from 1 to 0. (I need that for to no longer consider that the event took place in the recognition of the sequential signal)
    • Also, on a condition (you chose the opposite condition of the eventX) it goes eventX variable from 1 to 0.

    Would it be possible through a similar or a different method to block the detection of  event A for n periods once it has been detected a first time ?

    We could then get the right sequential purchase signal

    I look forward to reading you !


    This is a squential approach, it will test event B only if event A has occurred and so on for the next events.

    Event A will only last LookBackA bars, then it will be cleared, the same for all other events.

    In my first version I just added an opposite condition to cancel events, but it’s not mandatory, especially now that there is a cancellation due to elapsed bars.

    My first version did not detect the 4 events sequentially, just as they occurred. It only entered a trade when ALL events were true. When a new X event occurred, it simply updated its barindex value.

    This new version is a more strict coding of what you requested.



    Above code added to here

    Snippet Link Library

    1 user thanked author for this post.

    Thank you so much RobertoGozzi, I tried it, and after gaining more knowledge about proorder, I understand better your work and it look clever and simple (a very nice code)

    GraHal, that library is incredible !

    Have a nice Day


    1 user thanked author for this post.

    Now I need time for deep backtests with the complete strategy, and I’ll come here for feed backs


    I couldn’t resist! 🙂

    Changed only TF’s, SL /TP and LookBacks.

    Anybody please backtest on 200k bars and post results.

    Also post any improvements … looks like it has potential and be a shame to waste Philippe’s idea and Roberto’s excellent coding.

    Results attached are with spread = 4.

    ITF attached so you can quickly and easily use the settings in the Optimiser.

    1. PhilRob-MTFSeq-DJI-1M-v1.itf
    1 user thanked author for this post.
Viewing 8 posts - 1 through 8 (of 8 total)

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