Sei sulla pagina 1di 12

#Tom Demark's TD Combo - Frankensteind #hint offset: Length of ATR used to offset arrows from price.

input ATRLength = 15; #hint ATRScale: multiplier of offset. input ATRScale = 0.3; #hint showrisklevels: Displays TDRiskLevels for countdowns. input showrisklevels = {default "Yes", "No"}; #hint ComboType: Traditional uses default price comparisions, utilizing closing values, to predict price exhaustion. Aggressive is much more liberal and utiliz es price high values in computationof price exhaustion points. Aggressive setti ngs will provide more trading oppotunities with slightly increased risk. input ComboType = {default "Traditional", "Aggressive"}; #hint CountDownType: Type I requires the same elements for each count, 1-13. T ype II replicates Type I for counts 1-10. However, there is only one requiremen t, a higher/lower close for ounts 11-13. Type II provides the trader with more live opportunities with the tradeoff being a slight increase to risk. TD Termin ation is the same as Type I through Count 12, with count 13 qualifying using Ope n instead of close within the price comparisions. input CountDownType = {default "One", "Two", "TDTermination"}; #hint ShowFirst: Display initial counts subsequent with setup counts 1 through 9. input ShowFirst = {default "No", "Yes"}; #hint ShowSubCounts: Will display a developing Combo Countdown sequence in the event of a setup in the same direction as the initial countdown. input ShowSubCounts = {default "No", "Yes"}; #hint TDBullishflip: show TD Bullish Flip. input TDBullishFlip = {default "Yes", "No"}; #hint TDBearishFlip: show TD Bearish Flip. input TDBearishFlip = {default "Yes", "No"}; #hint BuyperfectionON: Show Perfection of TD Buy Setup. input BuyperfectionON = {default "Yes", "No"}; #hint SellperfectionON: Show Perfection of TD Sell Setup. input SellperfectionON = {default "Yes", "No"}; #hint riskbars: The integer selected equates to the number of bars TDRiskLevels are plotted into the future. input riskbars = 20; input showlabel = yes; def ATR = AvgTrueRange(high, close, low, 20); def Offset = ATRScale * ExpAverage(TrueRange(high, close, low), ATRLength); input setupPrice = close; def B = Floor( fold j = 0 to 10 with iX = 0 do if GetValue(SetupPrice, 9 - j, 20 ) < GetValue(SetupPrice, 13 - j, 20) then iX + 1 else 0 ); def CounterA = fold k = 1 to 10 with iCounter = 0 do if B == k and (fold l = 1 t o 10 - k with iCheck = 1 do iCheck * (if GetValue(B, -l, 20) == k + l or IsNaN(G etValue(SetupPrice, -l, 20)) then 1 else 0)) then k else iCounter; plot TDBuySetup = if !CounterA then Double.NaN else CounterA; TDBuySetup.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW); TDBuySetup.SetDefaultColor(CreateColor(4, 245, 4)); def S = Floor( fold N = 0 to 10 with MX = 0 do if GetValue(SetupPrice, 9 - N, 20 ) > GetValue(SetupPrice, 13 - N, 20) then MX + 1 else 0 ); def CounterB = fold O = 1 to 10 with MCounter = 0 do if S == O and (fold P = 1 t o 10 - O with MCheck = 1 do MCheck * (if GetValue(S, -P, 20) == O + P or IsNaN(G etValue(SetupPrice, -P, 20)) then 1 else 0)) then O else MCounter; plot TDSellSetup = if !CounterB then Double.NaN else CounterB;

TDSellSetup.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE); TDSellSetup.SetDefaultColor(CreateColor(255, 8, 0)); def Counter = B; def CounterXX = S; AddLabel(if showlabel then yes else no, Concat("TDBuySetup = " , Counter), Colo r.GREEN); AddLabel(if showlabel then yes else no, Concat("TDSellSetup = " , CounterXX), C olor.RED); def TrueLow = Min(low, close[1]); def truehigh = Max(high, close[1]); def HH = Highest(truehigh, 9); def LL = Lowest(TrueLow, 9); rec direction = if Counter == 9 then 1 else if CounterXX == 9 then -1 else direc tion[1]; rec TDSTSupport = if CounterB == 1 then TrueLow else if CounterB == 2 && TrueLow < TDSTSupport[1] then TrueLow else if CounterB == 3 && TrueLow < TDSTSupport[1] then TrueLow else if TDSTSupport[1] > 1 && truehigh < TDSTSupport[1] then 0 el se TDSTSupport[1]; rec TDSTResistance = if CounterA == 1 then truehigh else if CounterA == 2 && truehigh > TDSTResistance[1] then truehigh else if CounterA == 3 && truehigh > T DSTResistance[1] then truehigh else if TDSTResistance[1] > 1 && TrueLow > TDSTRe sistance[1] then 0 else TDSTResistance[1]; rec TDSTRX = if Counter == 9 && Counter[1] < 9 then TDSTResistance else if Count erXX == 9 && CounterXX[1] < 9 then 0 else if Counter == 9 && TDSTRX[1] > 1 then TDSTResistance else TDSTRX[1]; rec TDSTSX = if CounterXX == 9 && CounterXX[1] < 9 then TDSTSupport else if Cou nter == 9 && Counter[1] < 9 then 0 else if CounterXX == 9 && TDSTSX[1] > 1 then TDSTSupport else TDSTSX[1]; rec BuySetupCt = if IsNaN(BuySetupCt[1]) then 0 else if TrueLow > TDSTResistanc e[1] && TDSTResistance[1] > 0 then 0 else if Counter == 9 && Counter[1] < 9 && BuySetupCt[1] < 1 then 1 else if Counter == 9 && Counter[1] < 9 && BuySetupCt[1 ] >= 1 then BuySetupCt[1] + 1 else if CounterXX == 9 && CounterXX[1] < 9 then 0 else BuySetupCt[1]; rec SellSetupCt = if IsNaN(SellSetupCt[1]) then 0 else if truehigh < TDSTSuppor t[1] && TDSTSupport[1] > 0 then 0 else if CounterXX == 9 && CounterXX[1] < 9 && SellSetupCt[1] < 1 then 1 else if CounterXX == 9 && CounterXX[1] < 9 && SellSe tupCt[1] >= 1 then SellSetupCt[1] + 1 else if Counter == 9 && Counter[1] < 9 t hen 0 else SellSetupCt[1]; plot TDSTSupportX = if TDSTSupport > 0 then TDSTSupport else Double.NaN; plot TDSTResistanceX = if TDSTResistance > 0 then TDSTResistance else Double.N aN; TDSTSupportX.SetPaintingStrategy(PaintingStrategy.DASHES); TDSTSupportX.SetLineWeight(1); TDSTResistanceX.SetPaintingStrategy(PaintingStrategy.DASHES); TDSTResistanceX.SetLineWeight(1); TDSTSupportX.SetDefaultColor(CreateColor(0, 170, 255)); TDSTResistanceX.SetDefaultColor(CreateColor(172, 7, 184)); rec ExtBuySetupCt = if BuySetupCt > BuySetupCt[1] then 9 else if ExtBuySetupCt[1 ] >= 9 && close < close[4] then ExtBuySetupCt[1] + 1 else if ExtBuySetupCt[1] >=

28 then 0 else if close > close[4] then 0 else ExtBuySetupCt[1]; def V1; def V2; def V3; def VCombo; switch (ComboType) { case Traditional: V1 = close <= low[2]; V2 = low <= low[1]; V3 = close < close[1]; VCombo = V1 && V2 && V3; case Aggressive: V1 = low <= low[2]; V2 = low <= low[1]; V3 = low <= low[1]; VCombo = V1 && V2 && V3; } rec getth = if ExtBuySetupCt == 9 then HH else if ExtBuySetupCt[1] >= 9 && trueh igh > getth[1] then truehigh else if close > close[4] then 0 else getth[1]; rec PrevTH = if getth == 0 && getth[1] != 0 then getth[1] else PrevTH[1]; rec gettl = if ExtBuySetupCt == 9 then LL else if ExtBuySetupCt[1] >= 9 && TrueL ow < gettl[1] then TrueLow else if close > close[4] then 0 else gettl[1]; rec PrevTL = if gettl == 0 && gettl[1] != 0 then gettl[1] else PrevTL[1]; rec getTR = if BuySetupCt > BuySetupCt[1] then (getth - gettl) else if getTR[1] > 0 && ExtBuySetupCt > ExtBuySetupCt[1] && ExtBuySetupCt[1] >= 9 then (getth - g ettl) else if close > close[4] then 0 else getTR[1]; rec prevTR = if getTR == 0 && getTR[1] != 0 then getTR[1] else prevTR[1]; rec ExtSellSetupCt = if SellSetupCt > SellSetupCt[1] then 9 else if ExtSellSetup Ct[1] >= 9 && close > close[4] then ExtSellSetupCt[1] + 1 else if ExtSellSetupCt [1] >= 26 then 0 else if close < close[4] then 0 else ExtSellSetupCt[1]; rec getTHX = if ExtSellSetupCt == 9 then HH else if ExtSellSetupCt[1] >= 9 && tr uehigh > getTHX[1] then truehigh else if close < close[4] then 0 else getTHX[1]; rec PrevTHX = if getTHX == 0 && getTHX[1] != 0 then getTHX[1] else PrevTHX[1]; rec getTLX = if ExtSellSetupCt == 9 then LL else if ExtSellSetupCt[1] >= 9 && Tr ueLow < getTLX[1] then TrueLow else if close < close[4] then 0 else getTLX[1]; rec PrevTLX = if getTLX == 0 && getTLX[1] != 0 then getTLX[1] else PrevTLX[1]; rec getTRX = if SellSetupCt > SellSetupCt[1] then (getTHX - getTLX) else if getT RX[1] > 0 && ExtSellSetupCt > ExtSellSetupCt[1] && ExtSellSetupCt[1] >= 9 then ( getTHX - getTLX) else if close < close[4] then 0 else getTRX[1]; rec prevTRX = if getTRX == 0 && getTRX[1] != 0 then getTRX[1] else prevTRX[1]; def AutomaticRecycle = (S == 9 && S[1] != 9) or (TrueLow > TDSTResistance[1] && TDSTResistance[1] != 0 ); rec CountPrice; switch (ComboType) { case Traditional: CountPrice = if AutomaticRecycle or (CounterA == 1 && BuySetupCt[1] < 1) th en 0 else if VCombo && CountPrice[1] < 1 then close else if VCombo && close < CountPrice[1] && CountPrice[1] > 1 then close else CountPrice[1]; case Aggressive: CountPrice = if AutomaticRecycle or (CounterA == 1 && BuySetupCt[1] < 1) th en 0 else if VCombo && CountPrice[1] < 1 then low else if VCombo && low < Coun tPrice[1] && CountPrice[1] > 1 then low else CountPrice[1]; } rec NewSetupPriceCount;

switch (ComboType) { case Traditional: NewSetupPriceCount = if IsNaN(NewSetupPriceCount[1]) or AutomaticRecycle the n 0 else if NewSetupPriceCount[1] < 1 && CounterA == 1 && VCombo && BuySetupCt[1 ] >= 1 then close else if NewSetupPriceCount[1] < 1 && CounterA == 1 && BuySetup Ct[1] >= 1 && !VCombo then 1 else if CounterA > 1 && CounterA[1] < 9 && NewSetup PriceCount[1] == 1 && VCombo && BuySetupCt[1] >= 1 then close else if CounterA > 1 && CounterA <= 9 && NewSetupPriceCount[1] > 1 && close < NewSetupPriceCount[1 ] && BuySetupCt[1] >= 1 then close else if B[1] == 9 && BuySetupCt[1] >= 2 then 0 else NewSetupPriceCount[1]; case Aggressive: NewSetupPriceCount = if IsNaN(NewSetupPriceCount[1]) or AutomaticRecycle the n 0 else if NewSetupPriceCount[1] < 1 && CounterA == 1 && VCombo && BuySetupCt[1 ] >= 1 then low else if NewSetupPriceCount[1] < 1 && CounterA == 1 && BuySetupCt [1] >= 1 && !VCombo then 1 else if CounterA > 1 && CounterA[1] < 9 && NewSetupPr iceCount[1] == 1 && VCombo && BuySetupCt[1] >= 1 then low else if CounterA > 1 & & CounterA <= 9 && NewSetupPriceCount[1] > 1 && low < NewSetupPriceCount[1] && B uySetupCt[1] >= 1 then low else if B[1] == 9 && BuySetupCt[1] >= 2 then 0 else N ewSetupPriceCount[1]; } def QualifyNewCountPrice = CounterA >= 1 && CounterA <= 9 && NewSetupPriceCount != NewSetupPriceCount[1] && VCombo && BuySetupCt[1] >= 1; def QualifyCountPrice = if VCombo && CountPrice[1] < 1 then 1 else if CountPr ice < CountPrice[1] && VCombo then 1 else if CounterA == 1 && BuySetupCt[1] < 1 then 1 else 0; def VComboAX = VCombo && QualifyCountPrice; def VComboAXX = VCombo && QualifyNewCountPrice; rec onetonineA = if IsNaN(onetonineA[1]) then 0 else if CounterA == 1 && VComboA X then 1 else if CounterA > 1 && CounterA[1] < 9 && VComboAX then onetonineA[1 ] + 1 else if B[1] == 9 then 0 else onetonineA[1]; rec onetonineAX = if IsNaN(onetonineAX[1]) then 0 else if CounterA == 1 && VComb oAXX && BuySetupCt[1] >= 1 then 1 else if CounterA > 1 && CounterA[1] < 9 && VCo mboAXX && BuySetupCt[1] >= 1 then onetonineAX[1] + 1 else if B[1] == 9 then 0 el se onetonineAX[1]; rec recyclecheck = if B[1] < 8 then 0 else if B == 9 && B[1] != 9 && BuySetupCt[ 1] >= 1 && BuySetupCt != BuySetupCt[1] && getTR > prevTR && getTR < prevTR * 5 & & recyclecheck[1] < 1 then 1 else 0; rec ComboBuyCount = if IsNaN(ComboBuyCount[1]) or (ComboBuyCount[1] == 13 ) or A utomaticRecycle then 0 else if ComboBuyCount[1] < 1 && B == 9 && B[1] != 9 && V ComboAX then onetonineA[1] + 1 else if ComboBuyCount[1] < 1 && B == 9 && B[1] != 9 && !VComboAX then onetonineA[1] else if ComboBuyCount[1] > 0 && VComboAX && B != 9 then ComboBuyCount[1] + 1 else if ComboBuyCount[1] > 0 && B == 9 && B[1] != 9 && BuySetupCt[1] >= 1 && BuySetupCt > BuySetupCt[1] && (getTR > prevTR) && getTR < (prevTR * 1.618) && Counter == 9 && VComboAXX then onetonineAX[1] + 1 else if ComboBuyCount[1] > 0 && B == 9 && B[1] != 9 && BuySetupCt[1] >= 1 && BuySetupCt > BuySetupCt[1] && (getTR > prevTR && getTR < (prevTR * 1.618)) && Counter == 9 && !VComboAX then o netonineAX[1] else if ComboBuyCount[1] > 0 && B == 9 && B[1] != 9 && BuySetupCt > BuySetupCt[1] && (getTR < prevTR or getTR > (prevTR * 1.618)) && VComboAX && BuySetupCt[1] >= 1 then ComboBuyCount[1] + 1 else if ComboBuyCount[1] > 0 && B = = 9 && B[1] != 9 && BuySetupCt > BuySetupCt[1] && (getTR < prevTR or getTR > (pr evTR * 1.618)) && !VComboAX && BuySetupCt[1] >= 1 then ComboBuyCount[1] else Com boBuyCount[1];

rec AggBuyClose = if IsNaN(AggBuyClose[1]) or AutomaticRecycle then 0 else if Ag gBuyClose[1] < 1 && ComboBuyCount[1] < 10 && ComboBuyCount == 10 then close else if AggBuyClose[1] > 1 && close < AggBuyClose[1] then close else if ComboBuyCount[1 ] < 1 then 0 else AggBuyClose[1]; rec AggBuyCount = if IsNaN(AggBuyCount[1]) or AutomaticRecycle then 0 else if Ag gBuyCount[1] < 1 && ComboBuyCount[1] < 10 && ComboBuyCount == 10 then 10 else if AggBuyCount[1] >= 10 && AggBuyClose < AggBuyClose[1] then AggBuyCount[1] + 1 el se if AggBuyCount[1] >= 13 then 0 else AggBuyCount[1]; rec AggBuyCountii = if IsNaN(AggBuyCountii[1]) or AutomaticRecycle then 0 else i f AggBuyCountii[1] < 1 && ComboBuyCount[1] < 10 && ComboBuyCount == 10 then 10 e lse if AggBuyCountii[1] >= 10 && AggBuyCountii[1] < 12 && AggBuyClose < AggBuyCl ose[1] then AggBuyCountii[1] + 1 else if AggBuyCountii[1] >= 13 then 0 else AggB uyCountii[1]; rec TDTerminationCountBuy = if AutomaticRecycle then 0 else if ComboBuyCount[1] < 12 && ComboBuyCount == 12 && TDTerminationCountBuy[1] < 1 then 1 else if TDTer minationCountBuy[1] == 1 && (open <= CountPrice[1] or close <= CountPrice[1]) th en 2 else if TDTerminationCountBuy[1] >= 2 then 0 else TDTerminationCountBuy[1]; rec TDTerminationIICountBuy = if AutomaticRecycle then 0 else if ComboBuyCount[1 ] < 12 && ComboBuyCount == 12 && TDTerminationIICountBuy[1] < 1 then 1 else if T DTerminationIICountBuy[1] == 1 && (open <= CountPrice[1] or close <= CountPrice[ 1]) then 2 else if TDTerminationCountBuy[1] >= 2 then 0 else TDTerminationCountB uy[1]; rec ComboBuyCountDown; switch (CountDownType) { case "One": ComboBuyCountDown = if ComboBuyCount != ComboBuyCount[1] && ComboBuyCount[1] < 13 && ComboBuyCount > 0 then ComboBuyCount else ComboBuyCountDown[1]; case "Two": ComboBuyCountDown = if ComboBuyCount != ComboBuyCount[1] && ComboBuyCount[1] < 10 && ComboBuyCount > 0 then ComboBuyCount else if AggBuyCount != AggBuyCount [1] && AggBuyCount > 0 && AggBuyCount <= 13 then AggBuyCount else ComboBuyCountD own[1]; case "TDTermination": ComboBuyCountDown = if ComboBuyCount != ComboBuyCount[1] && ComboBuyCount[1] < 12 && ComboBuyCount > 0 then ComboBuyCount else if TDTerminationCountBuy[1] > 0 && TDTerminationCountBuy == 2 then 13 else ComboBuyCountDown[1]; #case "TDTerminationII": # ComboBuyCountDown = if ComboBuyCount != ComboBuyCount[1] && ComboBuyCount[1 ] < 10 && ComboBuyCount > 0 then ComboBuyCount else if TDTerminationIICountBuy[ 1] > 0 && TDTerminationIICountBuy == 2 then 13 else ComboBuyCountDown[1]; } plot BuyComboCountDown = if ComboBuyCountDown != ComboBuyCountDown[1] then Combo BuyCountDown else Double.NaN; BuyComboCountDown.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW); BuyComboCountDown.SetDefaultColor(CreateColor(0, 215, 33)); plot ComboCountStart = if onetonineA != onetonineA[1] && onetonineA > 0 && oneto nineA[1] < 9 && ShowFirst then onetonineA else Double.NaN; ComboCountStart.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE); plot ComboCountSubStart = if onetonineAX != onetonineAX[1] && onetonineAX > 0 && onetonineAX[1] < 9 && ShowSubCounts then onetonineAX else Double.NaN;

ComboCountSubStart.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE); def V1X; def V2X; def V3X; def VComboX; switch (ComboType) { case Traditional: V1X = close >= high[2]; V2X = high >= high[1]; V3X = close > close[1]; VComboX = V1X && V2X && V3X; case Aggressive: V1X = high >= high[2]; V2X = high >= high[1]; V3X = high > high[1]; VComboX = V1X && V2X && V3X; } def AutomaticRecycleX = (B == 9 && B[1] != 9) or (truehigh < TDSTSupport[1] && TDSTSupport[1] != 0); rec CountPriceX; switch (ComboType) { case Traditional: CountPriceX = if AutomaticRecycleX or (CounterB == 1 && SellSetupCt[1] < 1) then 0 else if VComboX && CountPriceX[1] < 1 then close else if VComboX && close > CountPriceX[1] && CountPriceX[1] > 1 then close else CountPriceX[1]; case Aggressive: CountPriceX = if AutomaticRecycleX or (CounterB == 1 && SellSetupCt[1] < 1) then 0 else if VComboX && CountPriceX[1] < 1 then high else if VComboX && high > CountPriceX[1] && CountPriceX[1] > 1 then high else CountPriceX[1]; } rec CountPriceNewSellSetup; switch (ComboType) { case Traditional: CountPriceNewSellSetup = if IsNaN(CountPriceNewSellSetup[1]) or AutomaticRec ycleX then 0 else if CountPriceNewSellSetup[1] < 1 && CounterB == 1 && VComboX & & SellSetupCt[1] >= 1 then close else if CountPriceNewSellSetup[1] < 1 && Counte rB == 1 && SellSetupCt[1] >= 1 && !VComboX then 1 else if CounterB > 1 && Counte rB <= 9 && CountPriceNewSellSetup[1] == 1 && VComboX && SellSetupCt[1] >= 1 then close else if CounterB > 1 && CounterB <= 9 && CountPriceNewSellSetup[1] > 1 && close > CountPriceNewSellSetup[1] && SellSetupCt[1] >= 1 then close else if S[1 ] == 9 && SellSetupCt[1] >= 2 then 0 else CountPriceNewSellSetup[1]; case Aggressive: CountPriceNewSellSetup = if IsNaN(CountPriceNewSellSetup[1]) or AutomaticRec ycleX then 0 else if CountPriceNewSellSetup[1] < 1 && CounterB == 1 && VComboX & & SellSetupCt[1] >= 1 then high else if CountPriceNewSellSetup[1] < 1 && Counter B == 1 && SellSetupCt[1] >= 1 && !VComboX then 1 else if CounterB > 1 && Counter B <= 9 && CountPriceNewSellSetup[1] == 1 && VComboX && SellSetupCt[1] >= 1 then high else if CounterB > 1 && CounterB <= 9 && CountPriceNewSellSetup[1] > 1 && h igh > CountPriceNewSellSetup[1] && SellSetupCt[1] >= 1 then high else if S[1] == 9 && SellSetupCt[1] >= 2 then 0 else CountPriceNewSellSetup[1]; } def QualNewSellCountPrice = CounterB >= 1 && CounterB <= 9 && CountPriceNewSellS etup != CountPriceNewSellSetup[1] && VComboX; def QualifySellCountPrice = if VComboX && CountPriceX[1] < 1 then 1 else if C

ountPriceX > CountPriceX[1] && VComboX then 1 else if CounterB == 1 && SellSet upCt[1] < 1 then 1 else 0; def VComboBX = VComboX && QualifySellCountPrice; def VComboBXX = VComboX && QualNewSellCountPrice; rec OneToNineB = if IsNaN(OneToNineB[1]) then 0 else if CounterB == 1 && VComboB X then 1 else if CounterB > 1 && CounterB[1] < 9 && VComboBX then OneToNineB[1 ] + 1 else if S[1] == 9 then 0 else OneToNineB[1]; rec OneToNineBX = if IsNaN(OneToNineBX[1]) then 0 else if CounterB == 1 && VComb oBXX && SellSetupCt[1] >= 1 then 1 else if CounterB > 1 && CounterB <= 9 && VCom boBXX && SellSetupCt[1] >= 1 then OneToNineBX[1] + 1 else if S[1] == 9 then 0 else OneToNineBX[1];

rec ComboSellCount = if IsNaN(ComboSellCount[1]) or (ComboSellCount[1] == 13 ) o r AutomaticRecycleX then 0 else if ComboSellCount[1] < 1 && S == 9 && S[1] != 9 && VComboBX then OneToNineB[1] + 1 else if ComboSellCount[1] < 1 && S == 9 && S[1] != 9 && !VComboBX then OneToNineB[1] else if ComboSellCount[1] > 0 && VCom boBX && S != 9 then ComboSellCount[1] + 1 else if ComboSellCount[1] > 0 && S == 9 && S[1] != 9 && SellSetupCt[1] >= 1 && SellSetupCt > SellSetupCt[1] && (getTR X > prevTRX) && CounterXX == 9 && VComboBXX then OneToNineBX[1] + 1 else if ComboSellCount[1] > 0 && S == 9 && S[1] != 9 && SellSetupCt[1] >= 1 && SellSetupCt > SellSetupCt[ 1] && (getTRX > prevTRX) && CounterXX == 9 && !VComboBXX then OneToNineBX[1] els e if ComboSellCount[1] > 0 && S == 9 && S[1] != 9 && SellSetupCt > SellSetupCt[ 1] && (getTRX < prevTRX) && VComboBX && SellSetupCt[1] >= 1 then ComboSellCount[ 1] + 1 else if ComboSellCount[1] > 0 && S == 9 && S[1] != 9 && SellSetupCt > Sel lSetupCt[1] && (getTRX < prevTRX) && !VComboBX && SellSetupCt[1] >= 1 then Combo SellCount[1] else ComboSellCount[1]; rec AggSellClose = if IsNaN(AggSellClose[1]) or AutomaticRecycle then 0 else if AggSellClose[1] < 1 && ComboSellCount[1] < 10 && ComboSellCount == 10 then close else if AggSellClose[1] > 1 && close > AggSellClose[1] then close else if ComboSellCoun t[1] < 1 then 0 else AggSellClose[1]; rec AggSellCount = if IsNaN(AggSellCount[1]) or AutomaticRecycle then 0 else if AggSellCount[1] < 1 && ComboSellCount[1] < 10 && ComboSellCount == 10 then 10 el se if AggSellCount[1] >= 10 && AggSellClose > AggSellClose[1] then AggSellCount[1] + 1 else if AggSellCount[1] >= 13 then 0 else AggSellCount[1]; #combosellcount, was combobuycountdown rec TDTermCountSell = if AutomaticRecycle then 0 else if Combosellcount[1] < 12 && CombosellCount == 12 && TDTermCountSell[1] < 1 then 1 else if TDTermCountSell [1] == 1 && (open >= CountPriceX[1] or close >= CountPriceX[1]) then 2 else if T DTermCountSell[1] >= 2 then 0 else TDTermCountSell[1]; rec ComboSellCountDown; switch (CountDownType) { case "One": ComboSellCountDown = if t[1] < 13 && ComboSellCount case "Two": ComboSellCountDown = if t[1] < 10 && ComboSellCount

ComboSellCount != ComboSellCount[1] && ComboSellCoun > 0 then ComboSellCount else ComboSellCountDown[1]; ComboSellCount != ComboSellCount[1] && ComboSellCoun > 0 then ComboSellCount else if AggSellCount != AggS

ellCount[1] && AggSellCount > 0 && AggSellCount <= 13 then AggSellCount else Com boSellCountDown[1]; case "TDTermination": ComboSellCountDown = if ComboSellCount != ComboSellCount[1] && ComboSellCoun t[1] < 12 && ComboSellCount > 0 then ComboSellCount else if TDTermCountSell[1] > 0 && TDTermCountSell == 2 then 13 else ComboSellCountDown[1]; } plot SellComboCountDown = if ComboSellCountDown != ComboSellCountDown[1] AND Com bosellcountdown[1] != 13 then ComboSellCountDown else Double.NaN; SellComboCountDown.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE); SellComboCountDown.SetDefaultColor(CreateColor(255, 71, 227)); plot ComboSellCountStart = if OneToNineB != OneToNineB[1] && OneToNineB > 0 && O neToNineB[1] < 9 && ShowFirst then OneToNineB else Double.NaN; ComboSellCountStart.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW); plot ComboCountSellSubStart = if OneToNineBX != OneToNineBX[1] && OneToNineBX > 0 && OneToNineBX[1] < 9 && ShowSubCounts then OneToNineBX else Double.NaN; ComboCountSellSubStart.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW); def LLTL = GetValue(TrueLow, GetMinValueOffset(TrueLow, 20), 20); def LLTH = GetValue(truehigh, GetMinValueOffset(TrueLow, 20), 20); rec ctrisk = if IsNaN(ctrisk[1]) then 0 else if ctrisk[1] >= riskbars then 0 els e if ComboBuyCount == 13 && ComboBuyCount[1] < 13 then 1 else if ctrisk[1] >= 1 && ctrisk[1] <= riskbars then ctrisk[1] + 1 else ctrisk[1]; rec TDComboBuyRiskLevel = if IsNaN(TDComboBuyRiskLevel[1]) then 0 else if Comb oBuyCount == 13 && ComboBuyCount[1] < 13 then LLTL - (LLTH - LLTL) else TDComboB uyRiskLevel[1]; plot TDComboBuyCountDownRiskLevel = if !showrisklevels && TDComboBuyRiskLevel > 0 && ctrisk > 0 then TDComboBuyRiskLevel else Double.NaN; def HHTL = GetValue(TrueLow, GetMaxValueOffset(truehigh, 20), 20); def HHTH = GetValue(truehigh, GetMaxValueOffset(truehigh, 20), 20); rec ctriskX = if IsNaN(ctriskX[1]) then 0 else if ctriskX[1] >= riskbars then 0 else if ComboSellCount == 13 && ComboSellCount[1] < 13 then 1 else if ctriskX[ 1] >= 1 && ctriskX[1] <= riskbars then ctriskX[1] + 1 else ctriskX[1]; rec TDComboSellRiskLevel = if IsNaN(TDComboSellRiskLevel[1]) then 0 else if Co mboSellCount == 13 && ComboSellCount[1] < 13 then HHTH + (HHTH - HHTL) else TDCo mboSellRiskLevel[1]; plot TDComboSellCountDownRiskLevel = if TDComboSellRiskLevel > 0 && !showrisklev els && ctriskX > 0 then TDComboSellRiskLevel else Double.NaN; TDComboBuyCountDownRiskLevel.SetPaintingStrategy(PaintingStrategy.DASHES); TDComboSellCountDownRiskLevel.SetPaintingStrategy(PaintingStrategy.DASHES); TDComboBuyCountDownRiskLevel.HideBubble(); TDComboSellCountDownRiskLevel.HideBubble(); TDComboBuyCountDownRiskLevel.SetDefaultColor(CreateColor(44, 251, 231)); TDComboSellCountDownRiskLevel.SetDefaultColor(CreateColor(252, 15, 192)); plot BuyThirteenArrow = if (combobuycountdown == 13) && (combobuycountdown[1] !=

13) then Low - offset else Double.NaN; BuyThirteenArrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP); BuyThirteenArrow.SetDefaultColor(CreateColor(0, 255, 98)); plot SellThirteenArrow = if (comboSellCountDown == 13) && (comboSellCountDown[1] != 13) then High + offset else Double.NaN; SellThirteenArrow.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN); SellThirteenArrow.SetDefaultColor(CreateColor(255, 25, 0)); AddLabel(if showlabel then yes else no, Concat("ComboBuy = " ,if ComboBuyCountd own >= 10 then combobuycountdown else combobuycount), Color.GREEN); AddLabel(if showlabel then yes else no, Concat("ComboSell = ",if ComboSellCount down >= 10 then combosellcountdown else combosellcount), Color.RED); rec qual1bo = if IsNaN(qual1bo[1]) then 0 else if ComboSellCount[1] < 13 && Comb oSellCount == 13 then 1 else if qual1bo[1] == 1 && ctriskX[1] > 0 && close[1] < TDComboSellRiskLevel[1] && TDComboSellRiskLevel[1] > 0 && close[1] < close[2] && high > TDComboSellRiskLevel[1] + .01 then 2 else if qu al1bo[1] >= 2 then 0 else qual1bo[1]; rec qual2bo = if IsNaN(qual2bo[1]) then 0 else if ComboSellCount[1] < 13 && Comb oSellCount == 13 then 1 else if qual2bo[1] == 1 && ctriskX[1] <= riskbars && TDC omboSellRiskLevel[1] > 0 && close[1] < TDComboSellRiskLevel[1] && open > TDCombo SellRiskLevel[1] && open > close[1] then 2 else if qual2bo[1] >= 2 then 0 else qual2bo[1]; rec qual3bo = if IsNaN(qual3bo[1]) then 0 else if ComboSellCount[1] < 13 && Comb oSellCount == 13 then 1 else if qual3bo[1] == 1 && ctriskX[1] <= riskbars && TDC omboSellRiskLevel[1] > 0 && TDComboSellRiskLevel[1] > (close[1] + (close[1] - Tr ueLow[1])) && high > TDComboSellRiskLevel[1] + .01 then 2 else if qual3bo[1] >= 2 then 0 else qual3bo[1]; plot qualboup = if (qual1bo[1] == 1 && qual1bo > 1) or (qual2bo[1] == 1 && qual2 bo > 1) or (qual3bo[1] == 1 && qual3bo > 1) then TDComboSellRiskLevel - Offset else Double.NaN; qualboup.SetPaintingStrategy(PaintingStrategy.TRIANGLES); qualboup.SetDefaultColor(Color.WHITE); qualboup.SetLineWeight(5); rec qual1boX = if IsNaN(qual1boX[1]) then 0 else if ComboBuyCount[1] < 13 && Com boBuyCount == 13 then 1 else if qual1boX[1] == 1 && ctrisk[1] > 0 && close[1] > TDComboBuyRiskLevel[1] && TDComboBuyRiskLevel[1] > 0 && close[1] > close[2] && low <= TDComboBuyRiskLevel[1] - .01 then 2 else if qua l1boX[1] >= 2 then 0 else qual1boX[1]; rec qual2boX = if IsNaN(qual2boX[1]) then 0 else if ComboBuyCount[1] < 13 && Com boBuyCount == 13 then 1 else if qual2boX[1] == 1 && ctrisk[1] <= riskbars && TDC omboBuyRiskLevel[1] > 0 && close[1] > TDComboBuyRiskLevel[1] && open <= TDComboB uyRiskLevel[1] - .01 && open < close[1] then 2 else if qual2boX[1] >= 2 then 0 else qual2boX[1]; rec qual3boX = if IsNaN(qual3boX[1]) then 0 else if ComboBuyCount[1] < 13 && Com boBuyCount == 13 then 1 else if qual3boX[1] == 1 && ctrisk[1] <= riskbars && TDC omboBuyRiskLevel[1] > 0 && close[1] > TDComboBuyRiskLevel[1] && TDComboBuyRiskLe vel[1] < (close[1] - (truehigh[1] - close[1])) && low <= TDComboBuyRiskLevel[1] - .01 then 2 else if qual3boX[1] >= 2 then 0 else qual3boX[1]; plot qualbodown = if (qual1boX[1] == 1 && qual1boX > 1) or (qual2boX[1] == 1 &&

qual2boX > 1) or (qual3boX[1] == 1 && qual3boX > 1) then TDComboBuyRiskLevel + Offset else Double.NaN; qualbodown.SetPaintingStrategy(PaintingStrategy.TRIANGLES); qualbodown.SetDefaultColor(Color.WHITE); qualbodown.SetLineWeight(5); #hint MaxBars: The number of bars following a completed countdownType in either direction for which then TD Confirmation Signals will plot. input MaxBars = 5; rec buyctsignalct = if IsNaN(buyctsignalct[1]) then 0 else if buyctsignalct[1] >= MaxBars then 0 else if ComboBuyCount == 13 && ComboBuyCount[1] != 13 then 1 else if buyctsignalct[1] >= 1 && buyctsignalct[1] <= MaxBars then buycts ignalct[1] + 1 else buyctsignalct[1]; rec sellctsignalct = if IsNaN(sellctsignalct[1]) then 0 else if sellctsignalct[ 1] >= MaxBars then 0 else if ComboSellCount == 13 && ComboSellCount[1] != 13 then 1 else if sellctsignalct[1] >= 1 && sellctsignalct[1] <= MaxBars then sell ctsignalct[1] + 1 else sellctsignalct[1]; rec ComboBuyBarCt = if ComboBuyCount == 13 && ComboBuyCount[1] < 13 && ComboBuy BarCt[1] <= MaxBars then 1 else if ComboBuyBarCt[1] >= 1 && ComboBuyBarCt[1] <= MaxBars then ComboBuyBarCt[1] + 1 else if ComboBuyBarCt[1] >= MaxBars then 0 el se ComboBuyBarCt[1]; rec CombSellBarCt = if ComboSellCount == 13 && ComboSellCount[1] < 13 && CombSe llBarCt[1] <= MaxBars then 1 else if CombSellBarCt[1] >= 1 && CombSellBarCt[1] <= MaxBars then CombSellBarCt[1] + 1 else if CombSellBarCt[1] >= MaxBars then 0 else CombSellBarCt[1]; def shouldplot = buyctsignalct[1] > 0 or ComboBuyBarCt[1] > 0 ; def shouldplotX = sellctsignalct[1] > 0 or CombSellBarCt[1] > 0 ; #hint TDCamoType: Show TDCamoflage Buy/Sell Sequential Confirmation signals. input TDCamoType = {default "None", "Up", "Down", "Both"}; plot UPcam; plot DownCam; switch (TDCamoType) { case None: UPcam = Double.NaN; DownCam = Double.NaN; case "Up": UPcam = if shouldplot && low <= low[1] and close <= close[1] and close >= op en then (low - Offset) else Double.NaN; DownCam = Double.NaN; case "Down": UPcam = Double.NaN; DownCam = if shouldplotX && high >= high[1] and close >= close[1] and close <= open then (high + Offset) else Double.NaN; case "Both": UPcam = if shouldplot && low <= low[1] and close <= close[1] and close >= op en then (low - Offset) else Double.NaN; DownCam = if shouldplotX && high >= high[1] and close >= close[1] and close <= open then (high + Offset) else Double.NaN; } #hint TDOpenType: TDOpen Buy/Sell Sequential Confirmation signals. input TDOpenType = {default "None", "Up", "Down", "Both"}; plot TDOpenBuy; plot TDOpenSell;

switch (TDOpenType) { case None: TDOpenBuy = Double.NaN; TDOpenSell = Double.NaN; case Up: TDOpenBuy = if shouldplot && open < set else Double.NaN; TDOpenSell = Double.NaN; case Down: TDOpenBuy = Double.NaN; TDOpenSell = if shouldplotX && open Offset else Double.NaN; case Both: TDOpenBuy = if shouldplot && open < set else Double.NaN; TDOpenSell = if shouldplotX && open Offset else Double.NaN; }

low[1] && high > (low[1]) then low - Off

> high[1] && low < (high[1]) then high + low[1] && high > (low[1]) then low - Off > high[1] && low < (high[1]) then high +

#hint TDClopType: TDClop Buy/Sell Sequential Confirmation signals. input TDClopType = {default "None", "Up", "Down", "Both"}; plot TDClopBuy; plot TDClopSell; switch (TDClopType) { case None: TDClopBuy = Double.NaN; TDClopSell = Double.NaN; case Up: TDClopBuy = if shouldplot && open <= close[1] and open <= open[1] && high > Max(close[1], open[1]) then high + Offset else Double.NaN; TDClopSell = Double.NaN; case Down: TDClopBuy = Double.NaN; TDClopSell = if shouldplotX && open >= close[1] and open >= open[1] && low < Min(close[1], open[1]) then low - Offset else Double.NaN; case Both: TDClopBuy = if shouldplot && open <= close[1] and open <= open[1] && high > Max(close[1], open[1]) then high + Offset else Double.NaN; TDClopSell = if shouldplotX && open >= close[1] and open >= open[1] && low < Min(close[1], open[1]) then low - Offset else Double.NaN; } #hint TDClopWinType: TDClopWin Buy/Sell Sequential Confirmation signals. input TDClopWinType = {default "None", "Up", "Down", "Both"}; def TDClopWin = open <= Max(close[1], open[1]) && open >= Min(close[1], open[1]) && close <= Max(close[1], open[1]) && close >= Min(close[1], open[1]); plot TDClopWinBuy; plot TDClopWinSell; switch (TDClopWinType) { case None: TDClopWinBuy = Double.NaN; TDClopWinSell = Double.NaN; case Up: TDClopWinBuy = if shouldplot && TDClopWin && close > open then low - Offset else Double.NaN; TDClopWinSell = Double.NaN; case Down: TDClopWinBuy = Double.NaN; TDClopWinSell = if shouldplotX && TDClopWin && close < open then high + Offs

et else Double.NaN; case Both: TDClopWinBuy = if shouldplot && TDClopWin && close > open then low - Offset else Double.NaN; TDClopWinSell = if shouldplotX && TDClopWin && close < open then high + Offs et else Double.NaN; } #hint TDTrapType: TDTrap Buy/Sell Sequential Confirmation signals. input TDTrapType = {default "None", "Up", "Down", "Both"}; plot TDTrapBuy; plot TDTrapSell; switch (TDTrapType) { case None: TDTrapBuy = Double.NaN; TDTrapSell = Double.NaN; case Up: TDTrapBuy = if shouldplot && open >= low[1] && open <= high[1] && high > hig h[1] then low - Offset else Double.NaN; TDTrapSell = Double.NaN; case Down: TDTrapBuy = Double.NaN; TDTrapSell = if shouldplotX && open >= low[1] && open <= high[1] && low < lo w[1] then high + Offset else Double.NaN; case Both: TDTrapBuy = if shouldplot && open >= low[1] && open <= high[1] && high > hig h[1] then low - Offset else Double.NaN; TDTrapSell = if shouldplotX && open >= low[1] && open <= high[1] && low < lo w[1] then high + Offset else Double.NaN; } TDTrapBuy.SetPaintingStrategy(PaintingStrategy.ARROW_UP); TDClopBuy.SetPaintingStrategy(PaintingStrategy.ARROW_UP); TDTrapSell.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN); TDClopSell.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN); TDClopWinBuy.SetPaintingStrategy(PaintingStrategy.ARROW_UP); TDClopWinSell.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN); TDOpenBuy.SetPaintingStrategy(PaintingStrategy.ARROW_UP); TDOpenSell.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN); UPcam.SetPaintingStrategy(PaintingStrategy.ARROW_UP); DownCam.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN); TDTrapBuy.SetDefaultColor(CreateColor(54, 24, 255)); TDClopBuy.SetDefaultColor(CreateColor(54, 24, 255)); TDTrapSell.SetDefaultColor(CreateColor(0, 177, 247)); TDClopSell.SetDefaultColor(CreateColor(0, 177, 247)); TDClopWinBuy.SetDefaultColor(CreateColor(54, 24, 255)); TDClopWinSell.SetDefaultColor(CreateColor(0, 177, 247)); TDOpenBuy.SetDefaultColor(CreateColor(54, 24, 255)); TDOpenSell.SetDefaultColor(CreateColor(0, 177, 247)); UPcam.SetDefaultColor(CreateColor(54, 24, 255)); DownCam.SetDefaultColor(CreateColor(0, 177, 247));

Potrebbero piacerti anche