TD Sequential

Viewing 15 posts - 16 through 30 (of 43 total)
  • Author
    Posts
  • #46955 quote
    Despair
    Blocked
    Master

    I have the setup working but it doesn’t produce good results on any TF I tested. The TD countdown doesn’t generate any trades at all. I can forge it into an indicator so you can play around with it yourself.

    However thank you very much for the book! I will have a look into it.

    #46963 quote
    Despair
    Blocked
    Master

    Here you find the indicator:

    TD Sequential -Setup

    #46998 quote
    rosed777
    Participant
    New

    Hi Despair,

    Just waiting for the setup code to be reviewed to take a look.

    If you could do the countdown for me I’d be most grateful & I’ll play around with it.

    Cheers

    #46999 quote
    Despair
    Blocked
    Master

    You can download the TD Setup indicator from the pro builder forum.

    I see not really a point in making the countdown indicator because it never comes true. 🙁 It didn’t generate any trade for me.

    #47003 quote
    rosed777
    Participant
    New

    That’s the bit I don’t understand, I get a newsletter from Tom Thornton & from his Bloomberg DeMark screener

    Here are stocks that currently have triggered 13’s on the countdown today….

    DAILY UPSIDE 13:    AES, APD, HCSG, IRM, SHLM, WPX, XEC

    DAILY DOWNSIDE 13:    APOG, ESRX, LEN, LPNT, THS

    So I don’t understand why your code has not highlighted them.

    If it’s an indicator they should be visible?

    #47004 quote
    baaz
    Participant
    Average

    @Despair… don’t despair. 🙂

    Maybe you can show some screenshots? I agree, the number of identified trades would be low, but they will be there. Which instrument did you test?

    As a sample, I’ve put in a TD Setup combined with Engulfing, which I am running in the Demo environment for some weeks now. The low amount of trades is due to my “over optimization”.  I believe, if we by using countdown can time the “reverse” trading more accurately and with TDST support/resistance as SL and targets… it will be powerful.

    TD-setup.png TD-setup.png
    #47008 quote
    Despair
    Blocked
    Master

    Ok Ok 🙂 here comes the new version of the indicator. Now also showing TD Countdown (blue arrows). I will post the indicator in the indicator forum.

    TD-SetupCountdown.png TD-SetupCountdown.png
    #47019 quote
    RomanNumerals
    Participant
    Junior

    Naaaaice work… will run it over the weekend. Thank you Despair for programming this!

    #47067 quote
    rosed777
    Participant
    New

    Can’t access the code as my laptop will not read itf files. The both TD codes are awaiting review so I can’t download them til they have been signed off I guess. The Meander Bands from 4 days ago is readable though.

    #47083 quote
    Despair
    Blocked
    Master

    The code must be reviewed by Nicolas before it pops up in the library. But if you look here:

    TD Sequential -Setup

    You will find the code for download (scroll all the way down for the latest version).

    I always post indicators in the probuilder forum and not here in proorder.

    #47091 quote
    Despair
    Blocked
    Master

    New version also showing the stop loss for the TD Countdown setup.

    TD-CountdownSL-1.png TD-CountdownSL-1.png
    #65052 quote
    afvaz
    Participant
    New

    Hi Baaz,

     

    I’ve started studying Demark indicators very recently, as they are not so known here in Brazil. I’ve got interested in your setup TD countdown with engulfing. Could you tell more about this setup and optimizations?

    #65054 quote
    Despair
    Blocked
    Master

    Check the links in post #42931

    There are elaborate explanations.

    #68637 quote
    baaz
    Participant
    Average

    Hi’ guys,

     

    Some feedback on this topic. I’ve tested the code written by @Despair with a slight modfication, where I added:  Bullish Engulfing, Aroon Up/Down and volume.  Further, I tried to add the Support and Resistance lines as defined by Demark, but without any luck – hence code is disabled.  Also, I added some exit conditions.

     

    It started out very well for the first three months, but then the performance worsened. Pictures added.

     

    However, I still see a potential in it…so maybe we can collaborate around an enhanced version, where we add:

     

    1. Support and Resistance lines as defined by Demark and ensure the TDemark setup only triggers if the price stays within these lines
    2. Add enhanced 2nd and 3rd “confirming” signals
    3. Add improved exit conditions, profit and SL

     

    Code is here:

    //-------------------------------------------------------------------------
    // Main code : TDemark_DAX v2 1m
    //-------------------------------------------------------------------------
    DEFPARAM CUMULATEORDERS = FALSE
    //DEFPARAM FLATBEFORE = 080000
    //DEFPARAM FLATAFTER = 230000
    
    /////******  TDE SETUP / COUNTDOWN
    
    
    once TDSL=0
    once TDSS=0
    once BuySetup=0
    once SellSetup=0
    Once BuyCountdown=0
    once SellCountdown=0
    
    Once BuyConditionTDSetup = 0
    Once BuyConditionTDSetup = 0
    Once BuyConditionTDCount = 0
    Once ShortConditionTDCount = 0
    
    if close[1]>close[5] and close<close[4] then
    bearishflip=1
    bullishflip=0
    elsif close[1]<close[5] and close>close[4] then
    bullishflip=1
    bearishflip=0
    endif
    if close<close[4] and bearishflip then
    TDSL=TDSL+1
    TDSS=0
    elsif close>close[4] and bullishflip then
    TDSS=TDSS+1
    TDSL=0
    endif
    //if TDSL>0 and TDSL<10 then
    //SetSellLimit1 = Lowest[TDSS](price)
    //TDSTSupport = Lowest[TDSS](Close)  //drawtext("#TDSL#",barindex,low-10*pipsize) coloured(0,255,0)
    //endif
    if TDSL=9 then
    L=(low<low[3] and low<low[2]) or (low[1]<low[2] and low[1]<low[3])
    bearishflip=0
    TDSL=0
    BuySetup=1
    if L then
    BuyConditionTDSetup = 1 //DRAWARROWUP(barindex,low-20*pipsize) coloured(0,255,0)
    endif
    endif
    //if TDSS>0 and TDSS<10 then
    //SetBuyLimit1 = Highest[TDSL](price)
    //TDSTResistance = Highest[TDSL](Close)  //drawtext("#TDSS#",barindex,high+10*pipsize) coloured(255,0,0)
    //endif
    if TDSS=9 then
    S=(high>high[2] and high>high[3]) or (high[1]>high[3] and high[1]>high[2])
    bullishflip=0
    TDSS=0
    SellSetup=1
    if S then
    ShortConditionTDSetup = 1 //DRAWARROWDOWN(barindex,high+20*pipsize) coloured(255,0,0)
    endif
    endif
    if BuySetup then
    if close<=low[2] then
    BuyCountdown=BuyCountdown+1
    //drawtext("#BuyCountdown#",barindex,low-10*pipsize) coloured(0,0,255)
    endif
    if BuyCountdown=8 then
    Bar8=barindex
    elsif BuyCountdown=13 then     // TD Countdown perfection buy
    if low<=close[barindex-Bar8] then
    BuyConditionTDCount = 1 //DRAWARROWUP(barindex,low-20*pipsize) coloured(0,0,255)
    endif
    BuySetup=0
    BuyCountdown=0
    endif
    elsif SellSetup then
    if close>=high[2] then
    SellCountdown=SellCountdown+1
    //drawtext("#SellCountdown#",barindex,high+10*pipsize) coloured(0,0,255)
    endif
    if SellCountdown=8 then
    Bar8=barindex
    elsif SellCountdown=13 then  //TD Countdown perfection sell
    if high>=close[barindex-Bar8] then
    ShortConditionTDCount = 1 //DRAWARROWDOWN(barindex,high+20*pipsize) coloured(0,0,255)
    endif
    SellSetup=0
    SellCountdown=0
    endif
    endif
    
    
    //OTHER indicators
    
    
    //indicator1 = SMI[11,3,5](close)
    //Indicator1 = Stochastic[11,3](close)
    //Indicator2 = Average[5](indicator1)
    //Indicator1 = Volume
    //indicator1, indicator2, indicator3 = CALL "Super BandPass(1)"
    //Indicator4 = Williams[11](close)
    //Indicator5 = RSI[11](close)
    
    Indicator6 = AroonUp[9]
    Indicator7 = AroonDown[9]
    Indicator8 = Volume
    
    //Buy Conditions
    
    b0 = BuyConditionTDSetup = 1
    b1 = BuyConditionTDCount = 1
    //b2 = Lowest[t1](close)>TDSTSupport
    
    // Detection of TD Setup buy signal
    //b0 = Close[10]>Close[14] AND Close[9]< Close[13]
    //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]
    
    // Bullish Engulfing
    b2 = Close[2]>Close[3]
    b3 = Close[1]>Open[2] AND Open[1]<Close[2]
    b4 = Open>Close[1]
    
    //b5 = Indicator3 CROSSES OVER Indicator1
    //b4 = Indicator1 CROSSES OVER Indicator3
    //b4 = Indicator1 CROSSES OVER Indicator2 //AND Indicator1 > t5 ///Indicator1 CROSSES OVER Indicator2 AND
    //b5 = Indicator4 < - t3
    //b6 = Indicator5 < t2
    
    b7 = Indicator6 > 70
    b8 = Indicator7 < 30
    b9 = Indicator8 > 400
    
    BuyConditions = b0 AND b1 AND b2 AND b3 AND b4 AND b7 AND b8 AND b9 //AND b4 //b2 AND b3 AND b4 AND b5
    
    
    // Conditions to enter long positions
    IF NOT LongOnMarket AND BuyConditions THEN
    BUY 1 CONTRACTS AT MARKET
    ENDIF
    
    
    // Conditions to exit long positions
    be1 = Open[1]>Close[2] AND Close[1]<Open[2] AND Open<Open[1]
    //be2 = POSITIONPERF > 1.5 AND Lowest[7](Close) < Lowest[14](Close)
    
    be2 = Average[20](close) CROSSES UNDER Average[55](Close)
    
    /// Close > Average[20](Close)
    
    
    
    LongExitConditions = be1 AND be2//AND be2
    
    If LongOnMarket AND LongExitConditions THEN
    SELL AT MARKET
    ENDIF
    
    // ***** Short Conditions *****
    
    s0 = ShortConditionTDSetup = 1
    s1 = ShortConditionTDCount = 1
    //s3 = Highest[t1](close) < TDSTResistance
    
    // Detection of TD Setup Sell signal
    //s0 = Close[10]<Close[14] AND Close[9]>Close[13]
    //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]
    
    
    // Engulfing
    s2 = Close[2]<Close[3]
    s3 = Close[1]<Open[2] AND Open[1]>Close[2]
    s4 = Open<Close[1]
    //s5 = Indicator3 CROSSES UNDER Indicator2
    ///s5 = Indicator4 > -t1
    //s6 = Indicator5 > t4
    //s4 = Indicator1 CROSSES UNDER Indicator2
    //s4 = Indicator1 CROSSES UNDER Indicator2 //AND Indicator1 < 80 //Indicator1 CROSSES UNDER Indicator2 AND Indicator1 < t2
    
    s7 = Indicator6 < 30
    s8 = Indicator7 > 70
    s9 = Indicator8  > 400
    
    ShortConditions = s0 AND s1 AND s2 AND s3 AND s4 AND s7 AND s8 AND s9// AND s5 //s2 AND s3 AND s4 AND s5
    
    // Conditions to enter short positions
    IF NOT ShortOnMarket AND ShortConditions THEN
    SELLSHORT 1 CONTRACTS AT MARKET
    ENDIF
    
    //// ***** SHORT EXIT CONDITIONS
    se1 = Open[1]<Close[2] AND Close[1]>Open[2] AND Open>Open[1]
    //se2 = Close>Open AND High = Close AND (Open-Low) >= 3*(Close-Open)
    //se3 = POSITIONPERF > t1 AND Highest[7](Close) > Highest[14](Close)
    
    se2 = Average[20](close) CROSSES OVER Average[55](Close)
    
    
    ShortExitConditions = se1 AND se2 //AND se3 //OR se2) AND se3
    
    // Conditions to exit short positions
    IF ShortOnMarket AND ShortExitConditions THEN
    EXITSHORT AT MARKET
    ENDIF
    
    // Stops and targets : Enter your protection stops and profit targets here
    
    //IF LongOnMarket Then
    //SET TARGET PPROFIT SetLimit1
    //SET STOP LOSS SetLimit2
    //ENDIF
    
    //IF ShortOnMarket Then
    //SET TARGET PROFIT SetLimit1
    //SET STOP LOSS SetLimit2
    //ENDIF
    
    
    SET TARGET PROFIT 100 //90//prof
    SET STOP PLOSS 40 //30 //los1// 30
    
    
    // **** Stops and targets ***
    
    //DYNAMIC TRAILING STOP
    
    SL = 40 //30 //los1 //30 // Initial SL
    //TP = 30
    TSL = 1 // Use TSL?
    TrailingDistance = Round(0.85*SL) //Round(0.5*SL) // Distance from close to TSL
    TrailingStep = 9 //15 //3 // Pips locked at start of TSL
    
    //************************************************************************
    IF TSL = 1 THEN
    
    //reset the stoploss value
    IF NOT ONMARKET THEN
    newSL = 0
    CAND = 0
    ENDIF
    
    //manage long positions
    IF LONGONMARKET THEN
    //first move (breakeven)
    IF newSL = 0 AND CLOSE - TRADEPRICE(1) >= TrailingDistance*PipSize THEN
    newSL = TRADEPRICE(1) + TrailingStep*PipSize
    ENDIF
    //next moves
    CAND = BarIndex - TradeIndex
    IF newSL > 0 AND CLOSE[1] >= HIGHEST[CAND](CLOSE) THEN
    newSL = CLOSE[1] - TrailingDistance*PipSize
    ENDIF
    ENDIF
    
    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL = 0 AND TRADEPRICE(1) - CLOSE[1] >= TrailingDistance*PipSize THEN
    newSL = TRADEPRICE(1) - TrailingStep*PipSize
    ENDIF
    //next moves
    CAND = BarIndex - TradeIndex
    IF newSL > 0 AND CLOSE[1] <= LOWEST[CAND](CLOSE) THEN
    newSL = CLOSE[1] + TrailingDistance*PipSize
    ENDIF
    ENDIF
    
    //stop order to exit the positions
    IF newSL > 0 THEN
    SELL AT newSL STOP
    EXITSHORT AT newSL STOP
    ENDIF
    SET STOP pLOSS SL
    ENDIF
    
    
    
    //trailing stop
    //longtrail = 13
    //shorttrail = 7
     
    //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>=shorttrail*pointsize then //if the MFE is higher than the trailingstop then
    //priceexit = MINPRICE+shorttrail*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)>=longtrail*pointsize then //if the MFE is higher than the trailingstop then
    //priceexit = MAXPRICE-longtrail*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
    TDemark_DAX-v2-1m_-1st-pic.png TDemark_DAX-v2-1m_-1st-pic.png TDemark_DAX-v2-1m_-2nd-pic.png TDemark_DAX-v2-1m_-2nd-pic.png
    #68665 quote
    Despair
    Blocked
    Master

    Hi Baaz,

    This was quite some time that I worked on this indicator but I remember that I found several small bugs in it after I uploaded it to the library. I corrected the indicator but I never uploaded the corrected version to the library. I attach now the new version here.

    Another thing you want to keep in mind when using this indicator is to disable IG’s sunday candle. Otherwise the counts are getting wrong.

    I also remember that I coded DeMarks support and resistance lines as he specifies but the results where not encouraging.


    @Nicolas
    : Maybe you can update the version in the library with this one here?

    TD-Sequential-V2.1.itf
Viewing 15 posts - 16 through 30 (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...