TD D-waves in Amibroker

trendtrade

niftytrader12
#1
I am posting this thread based on the posts made in another thread, located here -

http://www.traderji.com/community/threads/general-trading-chat.96368/page-7134



Sir,
I was utilising this weekend to study TD D-waves. Have gone through the theory, do you know of any AFL or a script that draws them? Multiple qualifiers and number punching is part of this concept.
Especially important is when a beginning of wave 3 or 5 (identified) coincides with a supportive sequential/combo count thereby filtering out exceptional signals.
Thanks

Vivek
No, I do not know any AFL which will help plotting TD D Waves.

Smart_trade
 

trendtrade

niftytrader12
#2
Here is the code posted by Simple.Trader -

Code:
//TD Buy Setup

TDBuySetup = Sum(C < Ref(C, -4), 9) == 9 AND Ref(C, -9) > Ref(C, -13);


//TD Sell Setup

TDSellSetup = Sum(C > Ref(C, -4), 9) == 9 AND Ref(C, -9) < Ref(C, -13);


//TDST Support

TDST_Support = ValueWhen(TDSellSetup, LLV(L, 9));

Plot(TDST_Support, "TDST Support", colorAqua, styleLine);


//TDST Resistance

TDST_Resistance = ValueWhen(TDBuySetup, HHV(H, 9));

Plot(TDST_Resistance, "TDST Resistence", colorLightOrange, styleLine);


//TD Buy Setup "Perfection"

TDBS_P = (L <= Ref(L, -2) & L <= Ref(L, -3)) | (Ref(L, -1) <= Ref(L, -2) & Ref(L, -1) <= Ref(L, -3));


//TD Sell Setup "Perfection"

TDSS_P = (H >= Ref(H, -2) & H >= Ref(H, -3)) | (Ref(H, -1) >= Ref(H, -2) & Ref(H, -1) >= Ref(H, -3));


//Perl's Rules for Trading TD Buy Setups Objectively

TradingTDBS = TDBuySetup & TDBS_P & (LLV(C, 9) > TDST_Support);


//Perl's Rules for Trading TD Sell Setups Objectively

TradingTDSS = TDSellSetup & TDSS_P & (HHV(C, 9) < TDST_Resistance);


//TD Buy Risk Level

TDBS_RL = IIf(L < Ref(L, -1), TDST_Support - (H - L), IIf(Ref(L, -1) < L, TDST_Support - (Ref(H, -1) - Ref(L, -1)), IIf(L == Ref(L, -1), TDST_Support - Max(H - L, Ref(H, -1) - Ref(L, -1)), 0)));



//TD Sell Risk Level

TDSS_RL = IIf(H > Ref(H, -1), TDST_Resistance + (H - L), IIf(Ref(H, -1) > H, TDST_Resistance + (Ref(H, -1) - Ref(L, -1)), IIf(H == Ref(H, -1), TDST_Resistance + Max(H - L, Ref(H, -1) - Ref(L, -1)), 0)));


TDBS_C = ((TDST_Resistance - C) / (C - TDBS_RL)) >= 1.5;

Plot(IIf(TradingTDBS & TDBS_C, TDBS_RL, Null), "", colorRed, styleDots);

PlotShapes(IIf(TradingTDBS & TDBS_C, shapeSmallSquare, shapeNone), colorBrightGreen, 0, L);

TDSS_C = ((C - TDST_Support) / (TDSS_RL - C)) >= 1.5;

Plot(IIf(TradingTDSS & TDSS_C, TDSS_RL, Null), "", colorRed, styleDots);

PlotShapes(IIf(TradingTDSS & TDSS_C, shapeSmallSquare, shapeNone), colorBrightGreen, 0, H);


//Show Numbers & Stop Loss

d = 0.5 * ATR(10);

for(i = 0; i < BarCount; i++) {

    if (TDBuySetup) {

        if (TradingTDBS & TDBS_C)

            PlotText("Stop Loss\n@" + NumToStr(TDBS_RL, 1.2), i, TDBS_RL - d, colorRed);

        for (j = 0; j < 9; j++) {

            PlotText(NumToStr(9 - j, 1.0), i - j, L[i - j] - d, colorGreen);

        }

    }

    if(TDSellSetup) {

        if (TradingTDSS & TDSS_C)

            PlotText("Stop Loss\n@" + NumToStr(TDSS_RL, 1.2), i, TDSS_RL + d, colorRed);

        for (j = 0; j < 9; j++)

            PlotText(NumToStr(9 - j, 1.0), i - j, H[i - j] + d, colorRed);

    }

}


//Price

Plot(C, "Close", IIf((TDBuySetup & TDBS_P) | (TDSellSetup & TDSS_P), colorYellow, colorLavender), styleBar, Null, Null, 0, 0, 1);


Title = "{{DATE}} - "+ Name() + " - " + " Open = " + NumToStr(O, 1.2) + ", High = " + NumToStr(H, 1.2) + ", Low = " + NumToStr(L, 1.2) + ", Close = " + NumToStr(C, 1.2) + "\n" +

EncodeColor(colorAqua) + "TDST Support" + EncodeColor(colorDefault) + " = " + NumToStr(TDST_Support, 1.2) + ", " + EncodeColor(colorLightOrange) + "TDST Resistance" + EncodeColor(colorDefault) + " = " + NumToStr(TDST_Resistance, 1.2) + "\n" +

WriteIf(TDBuySetup, WriteIf(TDBS_P, EncodeColor(colorYellow) + "Perfected" + EncodeColor(colorDefault), "Unperfected ") + " TD Buy Setup\n", "") +

WriteIf(TDSellSetup, WriteIf(TDSS_P, EncodeColor(colorYellow) + "Perfected" + EncodeColor(colorDefault), "Unperfected ") + " TD Sell Setup\n", "") +

WriteIf(TDBuySetup, "\nPerl's Rules for Trading TD Buy Setups Objectively\n" +

"1. When the TD Buy Setup has been perfected, that is, the low of TD Buy Setup bar eight or nine is less than the lows of TD Buy Setup bars six and seven, " + WriteIf(TDBS_P, "[" + EncodeColor(colorBrightGreen) + "Yes" + EncodeColor(colorDefault) + "]", "[" + EncodeColor(colorRed) + "No" + EncodeColor(colorDefault) + "]") + "\n" +

"2. When none of the bars within the TD Buy Setup has closed below TDST support, " + WriteIf((LLV(C, 9) > TDST_Support), "[" + EncodeColor(colorBrightGreen) + "Yes" + EncodeColor(colorDefault) + "]", "[" + EncodeColor(colorRed) + "No" + EncodeColor(colorDefault) + "]") + "\n" + 

"3. When the Close of TD Buy Setup bar nine is in Close proximity to TDST support. " + WriteIf(TDBS_C, "[" + EncodeColor(colorBrightGreen) + "Yes" + EncodeColor(colorDefault) + "]", "[" + EncodeColor(colorRed) + "No" + EncodeColor(colorDefault) + "]"), "") +

WriteIf(TDSellSetup, "\nPerl's Rules on When to Initiate a Short Position Following a Completed TD Sell Setup\n" +

"1. When the TD Sell Setup has been perfected,that is,when the high of TD Sell Setup bar eight or nine is greater than the highs of TD Sell Setup bars six and seven, " + WriteIf(TDSS_P, "[" + EncodeColor(colorBrightGreen) + "Yes" + EncodeColor(colorDefault) + "]", "[" + EncodeColor(colorRed) + "No" + EncodeColor(colorDefault) + "]") + "\n" +

"2. When none of the bars within the TD Sell Setup has closed above TDST resistance, " + WriteIf((HHV(C, 9) < TDST_Resistance), "[" + EncodeColor(colorBrightGreen) + "Yes" + EncodeColor(colorDefault) + "]", "[" + EncodeColor(colorRed) + "No" + EncodeColor(colorDefault) + "]") + "\n" + 

"3. When the close of TD Sell Setup bar nine is in close proximity to TDST resistance. " + WriteIf(TDSS_C, "[" + EncodeColor(colorBrightGreen) + "Yes" + EncodeColor(colorDefault) + "]", "[" + EncodeColor(colorRed) + "No" + EncodeColor(colorDefault) + "]"), "") +

WriteIf(TradingTDBS & TDBS_C, "\n\n" + EncodeColor(colorBrightGreen) + "Trading a TD Buy Setup" + EncodeColor(colorDefault) + "\nEntry price = " + NumToStr(C, 1.2) + "\nStop loss = " + NumToStr(TDBS_RL, 1.2) + "\nRisk return = " + NumToStr((TDST_Resistance - C) / (C - TDBS_RL), 1.2), "") +

WriteIf(TradingTDSS & TDSS_C, "\n\n" + EncodeColor(colorBrightGreen) + "Trading a TD Sell Setup" + EncodeColor(colorDefault) + "\nEntry price = " + NumToStr(C, 1.2) + "\nStop loss = " + NumToStr(TDSS_RL, 1.2) + "\nRisk return = " + NumToStr((C - TDST_Support) / (TDSS_RL - C), 1.2), "");


Buy = TradingTDBS & TDBS_C;

Short = TradingTDSS & TDSS_C;
 

travi

Well-Known Member
#3
@Simple.Trader
Bhai, there are some short comings in this code or maybe intended to do what It wants but no TD Wave related anywhere.

This code is only counting
1. TD Buy and Sell setups
2. Identifying TDST S & R
3. Checking for Setup perfection
4. Taking a trading call of Long or Short based on the TDST r & s. Basically, as I think, trying to ride the CD phase.
 

Similar threads