TD Sequential

Viewing 15 posts - 1 through 15 (of 43 total)
  • Author
    Posts
  • #42024 quote
    baaz
    Participant
    Average

    Hi’ guys,

    I’ve been looking for a TD Sequential code for ProReal some time, but without luck. Hence, I started to code it myself… but I must admit that since then my understanding of the TD sequential has expanded. I already see, that adding TDST support and TD countdown will be difficult for me as I have to store it. I’ve found this code on MetaTrade, which would be useful, if someone can help convert it.

    I think, I got the TD Setup correct, but missed the TD flip prior to it. Further, I need to:

    1. Add TDST support/resistance lines
    2. Add TD Countdown both for buy and sell
    3. Add TD Countdown perfection signal
    4. Add actual buy/sell signal
    DEFPARAM CUMULATEORDERS = FALSE
    //DEFPARAM FLATBEFORE = 080000
    DEFPARAM FLATAFTER = 230000
    
    //indicators
    
    Indicator1 = Volume
    
    //Buy Conditions
    
    b0 = Indicator1 > 500
    
    // Detection of TD Setup buy signal
    
    b1 =  Close < Close[5] AND Close [2] < Close[6] AND Close[3] < Close[7] AND Close[4] < Close[8] AND Close[5] < Close[9] AND Close[6] < Close[10] AND Close[7] < Close[11] AND Close[8] < Close[12] AND Close[9] < Close[13]
    
    // Detection of TD Setup buy signal - perfection
    b2 = Close OR Close[2] < Low[6]
    b3 = Close OR Close [2] < Low[7]
    
    // TD Countdown (Buy)
    b4 = 0
    For ****
    
    BuyConditions = b0 AND b1 AND b2 AND b3 AND b4 
    
    
    // Conditions to enter long positions
    IF NOT LongOnMarket AND BuyConditions THEN
    BUY 1 CONTRACTS AT MARKET
    ENDIF
    
    // Conditions to exit long positions
    //If LongOnMarket AND YourConditions THEN
    //SELL AT MARKET
    //ENDIF
    
    // ***** Short Conditions *****
    
    s0 = Indicator1 > 500
    
    // Detection of TD Setup Sell signal
    
    s1=  Close < Close[5] AND Close [2] > Close[6] AND Close[3] > Close[7] AND Close[4] > Close[8] AND Close[5] > Close[9] AND Close[6] > Close[10] AND Close[7] > Close[11] AND Close[8] > Close[12] AND Close[9] > Close[13]
    
    // Detection of TD Setup Sell signal - perfection
    s2 = Close OR Close[2] > Low[6]
    s3 = Close OR Close [2] > Low[7]
    
    
    // TD Countdown (Sell)
    s4 = 0
    For i=0 **** 
    
    ShortConditions = s0 AND s1 AND s2 AND s3 AND s4
    
    // Conditions to enter short positions
    IF NOT ShortOnMarket AND ShortConditions THEN
    SELLSHORT 1 CONTRACTS AT MARKET
    ENDIF
    
    // Conditions to exit short positions
    //IF ShortOnMarket AND YourConditions THEN
    ///EXITSHORT AT MARKET
    //ENDIF
    
    // Stops and targets : Enter your protection stops and profit targets here
    
    SET TARGET PPROFIT xx
    
    SET STOP PLOSS xx
    
    
    // **** Stops and targets ***
    
    //DYNAMIC TRAILING STOP
     
    myATR = averagetruerange[14](close)
    TGL =1*myATR //DYNAMIC TRAILING
    TGS=13*myATR //DYNAMIC TRAILING
    if not onmarket then
    MAXPRICE = 0
    MINPRICE = close
    PREZZOUSCITA = 0
    ENDIF
    if longonmarket then
    MAXPRICE = MAX(MAXPRICE,close)
    if MAXPRICE-tradeprice(1)>=TGL*pointsize then
    PREZZOUSCITA = MAXPRICE-TGL*pointsize
    ENDIF
    ENDIF
    if shortonmarket then
    MINPRICE = MIN(MINPRICE,close)
    if tradeprice(1)-MINPRICE>=TGS*pointsize then
    PREZZOUSCITA = MINPRICE+TGS*pointsize
    ENDIF
    ENDIF
    if onmarket and PREZZOUSCITA>0 then
    EXITSHORT AT PREZZOUSCITA STOP
    SELL AT PREZZOUSCITA STOP
    ENDIF
    
    
    
    //TRAILING STOP
    
    //trailingstop = t2
     
    // * resetting variables when no trades are on market
    //if not onmarket then
    //MAXPRICE = 0
    //MINPRICE = close
    //priceexit = 0
    //endif
     
    // *case SHORT order
    //if shortonmarket then
    //MINPRICE = MIN(MINPRICE,close) //saving the MFE of the current trade
    //if tradeprice(1)-MINPRICE>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then
    //priceexit = MINPRICE+trailingstop*pointsize //set the exit price at the MFE + trailing stop price level
    //endif
    //endif
     
    // *case LONG order
    //if longonmarket then
    //MAXPRICE = MAX(MAXPRICE,close) //saving the MFE of the current trade
    //if MAXPRICE-tradeprice(1)>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then
    //priceexit = MAXPRICE-trailingstop*pointsize //set the exit price at the MFE - trailing stop price level
    //endif
    //endif
     
    // *exit on trailing stop price levels
    //if onmarket and priceexit>0 then
    //EXITSHORT AT priceexit STOP
    //SELL AT priceexit STOP
    //endif
    
    
    // DONCHIAN STOP
    //IF LONGONMARKET THEN
    //DC= s1
    //ENDIF
    
    //IF SHORTONMARKET THEN
    //DC= s2
    //ENDIF
    //e= Highest[DC](high)
    //f=Lowest[DC](low)
    //if longonmarket  then
    //laststop = f[1]
    //endif
    //if shortonmarket  then
    //laststop = e[1]
    //endif
    //if onmarket then
    //sell at laststop stop
    //exitshort at laststop stop
    //endif
    

    In addition, I am trying to test which stop/profit formula would be best including a dynamic trailing. Ideally, the stop level should be slightly lower than the TDST support.

     

    I would also highly appreciate view of others on Demark indicators and the performance hereof in day trading.

    Looking forward to your suggestions.

    #42867 quote
    baaz
    Participant
    Average

    Wondering if there is no interest in the TD Sequential as indicator?

    #42902 quote
    Despair
    Blocked
    Master

    Do you have a description of the system in pseudo code or plain english?

    #42931 quote
    baaz
    Participant
    Average

    What I like about the indicators from DeMark is the timing signal. E.g. on a trend reversal….however, there are many rules to look for.

    See following links: This article or this blog.

    or  the best link (which I am following to produce the code): here

     

    The book describes the indicators available on Bloomberg among few other platforms. If we can get these indicators coded for ProReal, I think it would be powerful. Hope to see more interest or opinions on why it is not a good indicator.

    #46865 quote
    rosed777
    Participant
    New

    Hi Baaz,

     

    Yes! DeMark sequential is a really powerful indicator – if you can crack it that would be really awesome.

    Could you write the code just to show the green 9s & red 13s?

    I’d like to keep in touch and follow your progress.

    this guy is a great source of knowledge on DeMark

    #46866 quote
    Despair
    Blocked
    Master

    I forgot about this one. I can code this tomorrow.

    #46867 quote
    rosed777
    Participant
    New

    That’s awesome despair. Be great to see it on PRT.

    The basic definitions that I have are:

    From Jason Perl Book book

     

    TD Setup

     

    The prerequisite for a TD Buy Setup is a Bearish TD Price Flip, which

    indicates a switch from positive to negative momentum.

     

     

    Bearish TD Price Flip

    A Bearish TD Price Flip occurs when the market records a close greater than the

    close four bars earlier, immediately followed by a close less than the close four bars

    earlier.

     

    TD Buy Setup

    After a bearish TD Price Flip, there must be nine consecutive closes, each one less

    than the corresponding close four bars earlier.

     

    If, at any point, the sequence—of nine consecutive closing prices less

    than the closing price four bars earlier (up to and including the close of

    TD Buy Setup bar nine)—is interrupted, the developing TD Buy Setup

    will be canceled and must begin anew.

     

    TD Setup vs. TD Sequential countdown

     

    Once TD Setup is complete,TD Countdown can begin, from the close

    of bar nine of TD Setup (inclusive), onward.

     

    The distinction between the two strategies is this:

     

    • TD Setup compares the current close with the corresponding close

    four bars earlier,

    Whereas

    • TD Countdown compares the current close with the low two bars

    earlier for a potential buy, and compares the current close with the

    high two bars earlier for a prospective sell.This price relationship is

    an important distinction from TD Setup, because the market must

    be trending for TD Countdown to objectively identify the likely

    exhaustion point for a trend reversal.

     

    One can start looking for the first bar of a TD Buy Countdown

    when a TD Buy Setup is in place.

     

    To Initiate TD Buy Countdown

     

    After

     

    TD Buy Setup is in place, look for the initiation of a TD Buy Countdown.

     

    If

    Bar nine of a TD Buy Setup also has a close less than, or equal to, the low two bars

    earlier,

     

    Then,

    Bar nine of a TD Buy Setup becomes bar one of a TD Buy Countdown.

    If

    That condition is not met,

    Then

    TD Buy Countdown bar one is postponed until it does, and the TD Buy Countdown

    continues until there are a total of thirteen closes, each one less than, or equal to,

    the low two bars earlier.

     

    & then I guess it’s the opposite for sell setups.

    Are you interested in trading off the countdowns or will you just use it to highlight potential trades?

    #46868 quote
    Despair
    Blocked
    Master

    Tomorrow… 🙂

    #46878 quote
    baaz
    Participant
    Average

    Highly appreciated Despair.

     

    Looking forward to see it.

     

    I am thinking of using the countdown as the timing and combine with other reversal indicators, perhaps purely price action based on bars, for trading purpose.

    #46907 quote
    Despair
    Blocked
    Master

    OK, I read this article and it seems a little bit over confident in this setup, “the secret of the professionals blablabla” :-). Anyway I will code it and then we will see what is on it…

    #46925 quote
    Despair
    Blocked
    Master

    So far it doesn’t look that promising. Also the informati0ns at the different links you send are varying a little bit. None makes useful points where to put the SL in all cases. None mentions profit targets either. So I tried a trailing stop.

    Then I found no reference to which timeframe this is supposed to run on. If I look at the links they show daily charts but on daily charts it doesn’t work at all. On 1h-chart I get some results but also nothing really exciting. Probably one has to read the book to get all information.

    Another aspect is that this setup needs really long time to build. The first TD Setup needs 9 bars and generates trades but the second TD countdown doesn’t generate a single trade for me and well honestly it would take at least 22 bars to build (can be much longer for the countdown).

    #46927 quote
    baaz
    Participant
    Average

    Hi’,

    Should work in any time frame, but I would suggest 5 min.

    As for the target and SL – I think the suggestion is TDST support resistance lines. Mentioned in the link I initially added: here

    #46928 quote
    baaz
    Participant
    Average

    A suggestion to short cut this is…maybe start converting the code from MT code (link) and then adjust it where needed.

    #46936 quote
    rosed777
    Participant
    New

    Hi Despair,

    The indicator should work over any timeframe, I have definitely seen it work on hourly, daily & weekly.

    This is a link to the jason perl book

    https://goo.gl/H53osX

    He talks about the risk management for the setups around page 62, hth.

    I’m going to try & add a couple of screenshots with the demark indicators from a Bloomberg screen, the etf XLP and the DXY index

    Screenshot-2017-09-22-13.36.22.png Screenshot-2017-09-22-13.36.22.png unnamed.png unnamed.png
    #46954 quote
    rosed777
    Participant
    New

    It’s not really a black box indicator setting rigid profit tgts, I think the most successful traders use it a confirmatory tool alongside their own risk management/sizing criteria.

    If you can get the setup & countdown 9s & 13s to work that would be awesome & I will ask a few of the traders I know if they use any specific S/L & profits tgts when they trade with it.

Viewing 15 posts - 1 through 15 (of 43 total)
  • You must be logged in to reply to this topic.

TD Sequential


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
baaz @baaz Participant
Summary

This topic contains 42 replies,
has 8 voices, and was last updated by grimweasel47
7 years, 5 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 07/30/2017
Status: Active
Attachments: 8 files
Logo Logo
Loading...