my bad I meant blue arrowsDo you mean blue candles or blue arrows?
my bad I meant blue arrowsDo you mean blue candles or blue arrows?
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
my bad I meant blue arrows
#HINT: The Ichimoku study is used to forecast price action. It comprises five plots, two of which, Senkou Span A and Senkou Span B, are prolonged 26 bars forward by default, thus showing expected trend behavior. Three other plots, Tenkan, Kijun, and Chikou, are used as signal, confirmation, and support/resistance aid lines.
#HINT: The Tenkan line represents the arithmetic mean of the highest High and the lowest Low over a specified time period (9 bars by default). The Kijun line is calculated similarly using the 26 bars period by default. The Chikou line represents the current Close price plot projected 26 bars back by default.
#HINT: Once the primary lines are plotted, the study calculates the Senkou spans. The Senkou Span A is calculated as the arithmetic mean of the Tenkan and the Kijun. This line is plotted 26 bars ahead. The Senkou Span B is calculated as the arithmetic mean of the highest High and the lowest Low over 52 bars and is plotted 26 bars ahead.
#HINT: Then the space between the two lines, so-called Kumo, is colored in respect to the defined trend. The trend is defined as bullish at the Kumo section where Senkou Span B line is below the Span A line and this section is colored green by default. Conversely, if the Senkou Span B line surpasses the Span A line, it is considered a bearish sign and the section is colored red by default.
#HINT tenkan_period: also called the conversion line
#HINT kijun_period: also called the base line.
input showTips = no;
# ichimoku cloud
input dmilength = 14;
input tenkan_period = 9;
input kijun_period = 26;
input averageType = AverageType.WILDERS;
# adx for signal
input signalADX = 20;
input DipGtDimLabel = yes;
plot Tenkan = (Highest(high, tenkan_period) + Lowest(low, tenkan_period)) / 2;
plot Kijun = (Highest(high, kijun_period) + Lowest(low, kijun_period)) / 2;
plot "Span A" = (Tenkan[kijun_period] + Kijun[kijun_period]) / 2;
plot "Span B" = (Highest(high[kijun_period], 2 * kijun_period) + Lowest(low[kijun_period], 2 * kijun_period)) / 2;
plot Chikou = close[-kijun_period];
Tenkan.SetDefaultColor(Color.ORANGE);
Kijun.SetDefaultColor(Color.BLUE);
"Span A".SetDefaultColor(Color.GREEN);
"Span B".SetDefaultColor(Color.RED);
Chikou.SetDefaultColor(Color.LIGHT_GRAY);
DefineGlobalColor("Bullish", Color.GREEN);
DefineGlobalColor("Bearish", Color.RED);
AddCloud("Span A", "Span B", GlobalColor("Bullish"), GlobalColor("Bearish"));
def Long = close > "Span B" and "Span A" > "Span B";
def Short = close < "Span A" and "Span A" < "Span B";
# Get DMI Values
def diPlus = DMI(dmilength, averageType)."DI+";
def diMinus = DMI(dmilength, averageType)."DI-";
def diADX = DMI(dmilength, averageType)."ADX";
def diP = diPlus > DiMinus;
def diM = diPlus < DiMinus;
# lot more signals
def crossUpper = ((close crosses above Kijun) and (diADX >= signalADX)) or (Tenkan crosses above Kijun);
def crossLower = ((close crosses below Kijun) and (diADX >= signalADX)) or (Tenkan crosses below Kijun);
####### SIGNALS #######
def Bull_trading_signal = Long is true and crossUpper is true;
def Bear_trading_signal = Short is true and crossLower is true;
plot Bullish = Bull_trading_signal;
Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Bullish.SetDefaultColor(Color.CYAN);
Bullish.SetLineWeight(5);
plot Bearish = Bear_trading_signal;
Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Bearish.SetDefaultColor(Color.CYAN);
Bearish.SetLineWeight(5);
AddLabel(if Bull_trading_signal is true then yes else no, "Bullish Ichimoku Signal ", Color.GREEN);
AddLabel(if Bear_trading_signal is true then yes else no, "Bearish Ichimoku Signal ", Color.RED);
AddLabel(yes, "ADX: "+Floor(diADX), Color.DARK_ORANGE);
AddLabel(DipGtDimLabel and diP, "DI+ > DI-", Color.GREEN);
AddLabel(DipGtDimLabel and diM, "DI+ < DI-", Color.RED);
ADBE looks good imo, just beware on large cap breakouts because it is a big up day and we are still in general market consolidation. A down day tomorrow could bury the breakout. So ADBE looks good. MDB on the other hand I would be carefull with as of now because if you look back in time a breakout like this was rejected at the same level. Check 1/29.I am in ADBE and MDB options
TEAM worked out awesome.
COST went in the right direction, but I made a mistake by being in illiquid weekly options .
Do you guys think a section on discord only for FE trades would be a good idea rather than posting trades here? @BenTen
@YungTraderFromMontana Thanks for introducing FE!
I did get alert from the scan SHOP, FB, ESTY etc.. is perfect for meAnyone make any plays with this setup and how did it go if you did? I just like hearing their thought process.
thanks!!!!!Someone posted this already. I didn't write this, I just added DMI labels and ADX.
I stole it from here: https://usethinkscript.com/threads/...script-your-one-stop-research-shop.300/page-2
Code:#HINT: The Ichimoku study is used to forecast price action. It comprises five plots, two of which, Senkou Span A and Senkou Span B, are prolonged 26 bars forward by default, thus showing expected trend behavior. Three other plots, Tenkan, Kijun, and Chikou, are used as signal, confirmation, and support/resistance aid lines. #HINT: The Tenkan line represents the arithmetic mean of the highest High and the lowest Low over a specified time period (9 bars by default). The Kijun line is calculated similarly using the 26 bars period by default. The Chikou line represents the current Close price plot projected 26 bars back by default. #HINT: Once the primary lines are plotted, the study calculates the Senkou spans. The Senkou Span A is calculated as the arithmetic mean of the Tenkan and the Kijun. This line is plotted 26 bars ahead. The Senkou Span B is calculated as the arithmetic mean of the highest High and the lowest Low over 52 bars and is plotted 26 bars ahead. #HINT: Then the space between the two lines, so-called Kumo, is colored in respect to the defined trend. The trend is defined as bullish at the Kumo section where Senkou Span B line is below the Span A line and this section is colored green by default. Conversely, if the Senkou Span B line surpasses the Span A line, it is considered a bearish sign and the section is colored red by default. #HINT tenkan_period: also called the conversion line #HINT kijun_period: also called the base line. input showTips = no; # ichimoku cloud input dmilength = 14; input tenkan_period = 9; input kijun_period = 26; input averageType = AverageType.WILDERS; # adx for signal input signalADX = 20; input DipGtDimLabel = yes; plot Tenkan = (Highest(high, tenkan_period) + Lowest(low, tenkan_period)) / 2; plot Kijun = (Highest(high, kijun_period) + Lowest(low, kijun_period)) / 2; plot "Span A" = (Tenkan[kijun_period] + Kijun[kijun_period]) / 2; plot "Span B" = (Highest(high[kijun_period], 2 * kijun_period) + Lowest(low[kijun_period], 2 * kijun_period)) / 2; plot Chikou = close[-kijun_period]; Tenkan.SetDefaultColor(Color.ORANGE); Kijun.SetDefaultColor(Color.BLUE); "Span A".SetDefaultColor(Color.GREEN); "Span B".SetDefaultColor(Color.RED); Chikou.SetDefaultColor(Color.LIGHT_GRAY); DefineGlobalColor("Bullish", Color.GREEN); DefineGlobalColor("Bearish", Color.RED); AddCloud("Span A", "Span B", GlobalColor("Bullish"), GlobalColor("Bearish")); def Long = close > "Span B" and "Span A" > "Span B"; def Short = close < "Span A" and "Span A" < "Span B"; # Get DMI Values def diPlus = DMI(dmilength, averageType)."DI+"; def diMinus = DMI(dmilength, averageType)."DI-"; def diADX = DMI(dmilength, averageType)."ADX"; def diP = diPlus > DiMinus; def diM = diPlus < DiMinus; # lot more signals def crossUpper = ((close crosses above Kijun) and (diADX >= signalADX)) or (Tenkan crosses above Kijun); def crossLower = ((close crosses below Kijun) and (diADX >= signalADX)) or (Tenkan crosses below Kijun); ####### SIGNALS ####### def Bull_trading_signal = Long is true and crossUpper is true; def Bear_trading_signal = Short is true and crossLower is true; plot Bullish = Bull_trading_signal; Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); Bullish.SetDefaultColor(Color.CYAN); Bullish.SetLineWeight(5); plot Bearish = Bear_trading_signal; Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); Bearish.SetDefaultColor(Color.CYAN); Bearish.SetLineWeight(5); AddLabel(if Bull_trading_signal is true then yes else no, "Bullish Ichimoku Signal ", Color.GREEN); AddLabel(if Bear_trading_signal is true then yes else no, "Bearish Ichimoku Signal ", Color.RED); AddLabel(yes, "ADX: "+Floor(diADX), Color.DARK_ORANGE); AddLabel(DipGtDimLabel and diP, "DI+ > DI-", Color.GREEN); AddLabel(DipGtDimLabel and diM, "DI+ < DI-", Color.RED);
Ive got so many calls this morning. since im testing it. Ive got pretty much 12 calls out of 30ish. It turned out green, but definitly we need second study to confirm which tickers more valid for options. this study delivers good pips. aapl,nvda,abbv,atvi,cvs,nem,ups,tsco (green team) tsn,lvs,dhi,cof (red team)I am in ADBE and MDB options
TEAM worked out awesome.
COST went in the right direction, but I made a mistake by being in illiquid weekly options .
Do you guys think a section on discord only for FE trades would be a good idea rather than posting trades here? @BenTen
@YungTraderFromMontana Thanks for introducing FE!
that would be greatDo you guys want a stricter scanner even if it lowers the count of stocks scanned? I'll make one if so.
input LookbackPeriod = 4;
input TimeFrame2 = "day";
input TimeFrame3 = "day";
input HideSwings = no;
input HideCurrentTF = no;
input HideTimeFrame2 = no;
input HideTimeFrame3 = no;
input conso = .02;
input outo = .01;
def price = close;
def SwingsLagBar = 1;
input nFE1 = 1;
input nfe2 = 2;
input nfe3 = 3;
input nfe4 = 4;
input nfe5 = 5;
input nfe6 = 6;
input nfe7 = 7;
input nfe8 = 8;
input nfe9 = 9;
input nfe10 = 10;
input nfe11 = 11;
input nfe12 = 12;
input nfe13 = 13;
input nfe14 = 14;
input nfe15 = 15;
input nfe16 = 16;
input nfe17 = 17;
input nfe18 = 18;
input nfe19 = 19;
input nfe20 = 20;
def gamma = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE1) /
(Highest(high, nFE1) - Lowest(low, nFE1)))
/ Log(nFE1);
def gamma2 = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE2) /
(Highest(high, nFE2) - Lowest(low, nFE2)))
/ Log(nFE2);
def gamma3 = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE3) /
(Highest(high, nFE3) - Lowest(low, nFE3)))
/ Log(nFE3);
def gamma4 = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE4) /
(Highest(high, nFE4) - Lowest(low, nFE4)))
/ Log(nFE4);
def gamma5 = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE5) /
(Highest(high, nFE5) - Lowest(low, nFE5)))
/ Log(nFE5);
def gamma6 = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE6) /
(Highest(high, nFE6) - Lowest(low, nFE6)))
/ Log(nFE6);
def gamma7 = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE7) /
(Highest(high, nFE7) - Lowest(low, nFE7)))
/ Log(nFE7);
def gamma8 = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE8) /
(Highest(high, nFE8) - Lowest(low, nFE8)))
/ Log(nFE8);
def gamma9 = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE9) /
(Highest(high, nFE9) - Lowest(low, nFE9)))
/ Log(nFE9);
def gamma10 = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE10) /
(Highest(high, nFE10) - Lowest(low, nFE10)))
/ Log(nFE10);
def gamma11 = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE11) /
(Highest(high, nFE11) - Lowest(low, nFE11)))
/ Log(nFE11);
def gamma12 = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE12) /
(Highest(high, nFE12) - Lowest(low, nFE12)))
/ Log(nFE12);
def gamma13 = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE13) /
(Highest(high, nFE13) - Lowest(low, nFE13)))
/ Log(nFE13);
def gamma14 = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE14) /
(Highest(high, nFE14) - Lowest(low, nFE14)))
/ Log(nFE14);
def gamma15 = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE15) /
(Highest(high, nFE15) - Lowest(low, nFE15)))
/ Log(nFE15);
def gamma16 = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE16) /
(Highest(high, nFE16) - Lowest(low, nFE16)))
/ Log(nFE16);
def gamma17 = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE17) /
(Highest(high, nFE17) - Lowest(low, nFE17)))
/ Log(nFE17);
def gamma18 = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE18) /
(Highest(high, nFE18) - Lowest(low, nFE18)))
/ Log(nFE18);
def gamma19 = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE19) /
(Highest(high, nFE19) - Lowest(low, nFE19)))
/ Log(nFE19);
def gamma20 = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE20) /
(Highest(high, nFE20) - Lowest(low, nFE20)))
/ Log(nFE20);
def gammasector1 = (gamma2 + gamma3 + gamma4)/3;
def gammasector2 = (gamma6 + gamma7 + gamma8 + gamma9 + gamma10)/5;
def gammasector3 = (gamma11 + gamma12 + gamma13 + gamma14 + gamma15)/5;
def gammasector4 = (gamma16 + gamma17 + gamma18 + gamma19 + gamma20)/5;
def trending = (gammasector1 < gammasector1[1] or gammasector1[1] < .35) and (gammasector1 < .6);
# KAUFMANEFFICIENCYRATIO
# (c) 2009 http://www.thinkscripter.com
# [email protected]
# Last Update 16 MAR 2009
declare lower;
input length69 = 7;
input lowerERThreshold = -11;
input upperERThreshold = 11;
input movingAvePeriod = 35;
input movingAvePeriod2 = 10;
input movingAvePeriod3 = 2;
def NetChange = hl2 - hl2[length69];
def incrementalTotalChange = AbsValue(hl2 - hl2[1]);
def TotalChange = Sum(incrementalTotalChange, length69);
def ERatio = (NetChange / TotalChange) * 100;
def ave = ExpAverage(ERatio, movingAvePeriod);
def ave2 = ExpAverage(ERatio, movingAvePeriod2);
def ave3 = ExpAverage(ERatio, movingAvePeriod3);
def ER = ERatio;
def BuyEntry = 3;
def SellEntry = 3;
def QB = Highest(high, BuyEntry);
def QS = Lowest(low, SellEntry);
def xx = QB[1];
def bb = QS[1];
def length = 1;
def displace = 0;
def price4 = close;
def SMA = Average(price4[-displace], length);
#--------------------------------------------------------------
def _highInPeriod1 = Highest(high, LookbackPeriod);
def _lowInPeriod1 = Lowest(low, LookbackPeriod);
#--------------------------------------------------------------
def marketLow1 = if _lowInPeriod1 < _lowInPeriod1[-LookbackPeriod] then _lowInPeriod1 else _lowInPeriod1[-LookbackPeriod];
def _markedLow1 = low == marketLow1;
rec _lastMarkedLow1 = CompoundValue(1, if IsNaN(_markedLow1) then _lastMarkedLow1[1] else if _markedLow1 then low else _lastMarkedLow1[1], low);
#--------------------------------------------------------------
def marketHigh1 = if _highInPeriod1 > _highInPeriod1[-LookbackPeriod] then _highInPeriod1 else _highInPeriod1[-LookbackPeriod];
def _markedHigh1 = high == marketHigh1;
rec _lastMarkedHigh1 = CompoundValue(1, if IsNaN(_markedHigh1) then _lastMarkedHigh1[1] else if _markedHigh1 then high else _lastMarkedHigh1[1], high);
#--------------------------------------------------------------
def Resistance1 = _lastMarkedHigh1;
def Support1 = _lastMarkedLow1;
#--------------------------------------------------------------
def LowSwingForw = Lowest(low, SwingsLagBar)[-SwingsLagBar];
def LowSwingBack = Lowest(low, LookbackPeriod)[1];
def SwingLow = if low < LowSwingForw and low <= LowSwingBack then 1 else 0;
def LowSwing = if SwingLow then low else Double.NaN;
#--------------------------------------------------------------
def HighSwingForw = Highest(high, SwingsLagBar)[-SwingsLagBar];
def HighSwingBack = Highest(high, LookbackPeriod)[1];
def SwingHigh = if high > HighSwingForw and high >= HighSwingBack then 1 else 0;
def HighSwing = if SwingHigh then high else Double.NaN;
#--------------------------------------------------------------
def _highInPeriod2 = Highest(high(period = TimeFrame2), LookbackPeriod);
def _lowInPeriod2 = Lowest(low(period = TimeFrame2), LookbackPeriod);
#--------------------------------------------------------------
def marketLow2 = if _lowInPeriod2 < _lowInPeriod2[-LookbackPeriod] then _lowInPeriod2 else _lowInPeriod2[-LookbackPeriod];
def _markedLow2 = low(period = TimeFrame2) == marketLow2;
rec _lastMarkedLow2 = CompoundValue(1, if IsNaN(_markedLow2) then _lastMarkedLow2[1] else if _markedLow2 then low(period = TimeFrame2) else _lastMarkedLow2[1], low(period = TimeFrame2));
#--------------------------------------------------------------
def marketHigh2 = if _highInPeriod2 > _highInPeriod2[-LookbackPeriod] then _highInPeriod2 else _highInPeriod2[-LookbackPeriod];
def _markedHigh2 = high(period = TimeFrame2) == marketHigh2;
rec _lastMarkedHigh2 = CompoundValue(1, if IsNaN(_markedHigh2) then _lastMarkedHigh2[1] else if _markedHigh2 then high(period = TimeFrame2) else _lastMarkedHigh2[1], high(period = TimeFrame2));
#--------------------------------------------------------------
def Resistance2 = _lastMarkedHigh2;
def Support2 = _lastMarkedLow2;
#--------------------------------------------------------------
def _highInPeriod3 = Highest(high(period = TimeFrame3), LookbackPeriod);
def _lowInPeriod3 = Lowest(low(period = TimeFrame3), LookbackPeriod);
#--------------------------------------------------------------
def marketLow3 = if _lowInPeriod3 < _lowInPeriod3[-LookbackPeriod] then _lowInPeriod3 else _lowInPeriod3[-LookbackPeriod];
def _markedLow3 = low(period = TimeFrame3) == marketLow3;
rec _lastMarkedLow3 = CompoundValue(1, if IsNaN(_markedLow3) then _lastMarkedLow3[1] else if _markedLow3 then low(period = TimeFrame3) else _lastMarkedLow3[1], low(period = TimeFrame3));
#--------------------------------------------------------------
def marketHigh3 = if _highInPeriod3 > _highInPeriod3[-LookbackPeriod] then _highInPeriod3 else _highInPeriod3[-LookbackPeriod];
def _markedHigh3 = high(period = TimeFrame3) == marketHigh3;
rec _lastMarkedHigh3 = CompoundValue(1, if IsNaN(_markedHigh3) then _lastMarkedHigh3[1] else if _markedHigh3 then high(period = TimeFrame3) else _lastMarkedHigh3[1], high(period = TimeFrame3));
#--------------------------------------------------------------
def Resistance3 = _lastMarkedHigh3;
def Support3 = _lastMarkedLow3;
def lower_close1 = (SMA crosses below Support1[1]);
def higher_close1 = (SMA crosses above Resistance1[1]);
def lower_close2 = (SMA crosses below Support2[1]);
def higher_close2 = (SMA crosses above Resistance2[1]);
def lower_close3 = (SMA crosses below Support2[1]);
def higher_close3 = (SMA crosses above Resistance2[1]);
def x = (hl2 > xx);
def c = (close[1] < xx[1]);
def v = (close[2] < xx[2]);
def b = x and (c or v);
def y = (close > bb);
def w = (close[1] < bb[1]);
def e = (close[2] < bb[2]);
def r = y and (w or e);
def allbreakdown = lower_close1 or lower_close2 or lower_close3;
def allbreakup = (higher_close1 or higher_close2 or higher_close3);
input BuyEntry2 = 40;
input SellEntry2 = 40;
def QB2 = Highest(high, BuyEntry2);
def QS2 = Lowest(low, SellEntry2);
def trueqb2 = QB2[1];
def trueqs2 = QS2[1];
def ath = (((trueqb2 - trueqb2[10]) / 100) < .10);
def atl = (((trueqs2 - trueqs2[10]) / 100) >= -.10);
def length4 = 10;
def displace2 = 0;
def AvgExp = ExpAverage(price[-displace2], length4);
def midline = (QS[1] + QB[1]) / 2;
def badhammer = (((high - close) < ((close + open) / 2) - low)) and (open > QB[1]);
def comboupstrongstrongstrong = (high > QB[1]) and (c[1] < QB[2]) and (((high - QB[1]) / 100) < outo) and (((QB[1] - Avgexp) / 100) < conso) and (low < midline[1]);
def comboupstrongstrong = (high > QB[1]) and (c[1] < QB[2]) and (((open - QB[1]) / 100) < outo) and (((QB[1] - Avgexp) / 100) < conso) and (open[1] or open[2] or open[3] < midline) and comboupstrongstrongstrong is false and (open < QB[1]) and (open[1] > QS[2]) and (close[1] < midline[2]);
def comboupstrong = (high > QB[1]) and (close[1] < QB[2]) and (((open - QB[1]) / 100) < outo) and (((QB[1] - Avgexp) / 100) < conso) and comboupstrongstrongstrong is false and comboupstrongstrong is false and (high > open) and (low < midline) and (high > open);
def any = comboupstrong or comboupstrongstrong or comboupstrongstrongstrong;
def goldenbuy = ((allbreakup or allbreakup[1]));
def krg = (er > ave);
def krgd = (er < ave);
plot buy = goldenbuy and (goldenbuy[1] is false) and (close > open) and krg and trending;
def goldenshort = (allbreakdown or allbreakdown[1]);
#plot sell = goldenshort and (goldenshort[1] is false) and (close < open) and krgd and trending;
I am in ADBE and MDB options
TEAM worked out awesome.
COST went in the right direction, but I made a mistake by being in illiquid weekly options .
Do you guys think a section on discord only for FE trades would be a good idea rather than posting trades here? @BenTen
@YungTraderFromMontana Thanks for introducing FE!
I ended up giving up on what I belived was going to be a slightly more effective 2d version for improving a one scan fits all daily version.
Here is the newest scan, I am now using a different second indicator to filter out breaks with little momentum.
Testing so far looks good.
Here is the scan: https://tos.mx/KavMufT
Here is an updated upper study:
Code:declare upper; input LookbackPeriod = 3; input TimeFrame2 = "week"; input TimeFrame3 = "month"; input HideSwings = no; input HideCurrentTF = no; input HideTimeFrame2 = no; input HideTimeFrame3 = no; input length = 5; input length21 = 40; input length1 = 5; def price = close; input lengthmo = 8; input lengthsqu = 4;#hint length: Length for average calculation def price23 = (open + close)/2; input SDmult = 2.5; input ATRmult = 1.0; def K = (Highest(high, lengthmo) + Lowest(low, lengthmo)) / 2 + ExpAverage(close, lengthmo); def Momo = Inertia(price23 - K / 2, lengthmo); def SD = StDev(close, lengthsqu); def Avg = ExpAverage(close, lengthsqu); def ATR = Average(TrueRange(high, close, low), lengthsqu); def SDup = Avg + (SDmult * SD); def ATRup = Avg + (ATRmult * ATR); def Squeeze = SDup < ATRup; def squeezechange = (squeeze[1]) and (squeeze is false); def upper = (momo > 0) and (momo > momo[1]); def lower = (momo < 0) and (momo < momo[1]); def swtichtup = (upper) and (squeezechange or squeezechange[1]); def swtichtdown = (lower) and (squeezechange or squeezechange[1]); def fullthrustup = (momo[1] < 0) and (momo > 0); def fullthrustdown = (momo[1] > 0) and (momo < 0); def recentup = swtichtup[1] or swtichtup or fullthrustup or fullthrustup[1]; def recentdown = swtichtdown[1] or swtichtdown or fullthrustdown or fullthrustdown[1]; def price3 = hlc3; input BuyEntry3 = 4; input SellEntry3 = 4; def displace2 = 0; input buyentry4 = 4; input sellentry4 = 4; input lengthw = 4; def wClosew = (high + low + 2 * close) * 0.25; def wCRatiow = (wClosew - wClosew[1]) / Min(wClosew, wClosew[1]); def closeRatiow = 3 * wClosew / Average(Highest(High, 2) - Lowest(Low, 2), lengthw) * AbsValue(wCRatiow); def volumeRatiow = Volume / Average(Volume, lengthw); def volumePerClosew = volumeRatiow / exp(Min(88, closeRatiow)); def buyPw; def sellPw; if (wCRatiow > 0) { buyPw = volumeRatiow; sellPw = volumePerClosew; } else { buyPw = volumePerClosew; sellPw = volumeRatiow; } def buyPresw = if IsNaN(buyPresw[1]) then 0 else ((buyPresw[1] * (lengthw - 1)) + buyPw) / lengthw; def sellPresw = if IsNaN(sellPresw[1]) then 0 else ((sellPresw[1] * (lengthw - 1)) + sellPw) / lengthw; def tempDIw; if ((((sellPresw[1] * (lengthw - 1)) + sellPw) / lengthw - ((buyPresw[1] * (lengthw - 1)) + buyPw) / lengthw) > 0) { tempDIw = - if (sellPresw != 0) then buyPresw / sellPresw else 1; } else { tempDIw = if (buyPresw != 0) then sellPresw / buyPresw else 1; } plot DMIndxw = if IsNaN(close) then Double.NaN else if tempDIw < 0 then -1 - tempDIw else 1 - tempDIw; def wClose = (high + low + 2 * close) * 0.25; def wCRatio = (wClose - wClose[1]) / Min(wClose, wClose[1]); def closeRatio = 3 * wClose / Average(Highest(High, 2) - Lowest(Low, 2), length) * AbsValue(wCRatio); def volumeRatio = Volume / Average(Volume, length); def volumePerClose = volumeRatio / exp(Min(88, closeRatio)); def buyP; def sellP; if (wCRatio > 0) { buyP = volumeRatio; sellP = volumePerClose; } else { buyP = volumePerClose; sellP = volumeRatio; } def buyPres = if IsNaN(buyPres[1]) then 0 else ((buyPres[1] * (length - 1)) + buyP) / length; def sellPres = if IsNaN(sellPres[1]) then 0 else ((sellPres[1] * (length - 1)) + sellP) / length; def tempDI; if ((((sellPres[1] * (length - 1)) + sellP) / length - ((buyPres[1] * (length - 1)) + buyP) / length) > 0) { tempDI = - if (sellPres != 0) then buyPres / sellPres else 1; } else { tempDI = if (buyPres != 0) then sellPres / buyPres else 1; } def DMIndx = if IsNaN(close) then Double.NaN else if tempDI < 0 then -1 - tempDI else 1 - tempDI; def ZeroLine = 0; def QB4 = Highest(dmindx, BuyEntry4); def QS4 = Lowest(dmindx, SellEntry4); def trueqb4 = QB4[1]; def trueqs4 = QS4[1]; def midline4 = (trueqb4 + trueqs4)/2; assert(length1 > 0, "'length' must be positive: " + length1); def ROC = if price3[length1] != 0 then (price3 / price3[length1] - 1) * 100 else 0; assert(length21 > 0, "'length' must be positive: " + length21); def QB3 = Highest(roc, BuyEntry3); def QS3 = Lowest(roc, SellEntry3); def trueqb3 = QB3[1]; def trueqs3 = QS3[1]; def midline3 = (trueqb3 + trueqs3)/2; def rocover = (roc > trueqs3 or roc[1] > trueqs3[1] or roc[2] > trueqs3[2]); def buy4 = (dmindx > trueqs4) and (roc > trueqs3) and ((dmindx > midline4) or (roc > midline3)); def optiondos = (dmindxw > .47069) and (roc > midline3); def sell4 = (dmindx < trueqs4) and (roc < trueqb3) and (roc < -1); def SwingsLagBar = 1; def BuyEntry = 3; def SellEntry = 3; def QB = Highest(high, BuyEntry); def QS = Lowest(low, SellEntry); def trueqb = QB[1]; def trueqs = QS[1]; plot midline = (trueqb + trueqs)/2; def length78 = 1; def displace = 0; def price2 = close; def SMA = Average(price[-displace], length78); def SMA2 = Average(price2[-displace], length78); #-------------------------------------------------------------- def _highInPeriod1 = Highest(high, LookbackPeriod); def _lowInPeriod1 = Lowest(low, LookbackPeriod); #-------------------------------------------------------------- def marketLow1 = if _lowInPeriod1 < _lowInPeriod1[-LookbackPeriod] then _lowInPeriod1 else _lowInPeriod1[-LookbackPeriod]; def _markedLow1 = low == marketLow1; rec _lastMarkedLow1 = CompoundValue(1, if IsNaN(_markedLow1) then _lastMarkedLow1[1] else if _markedLow1 then low else _lastMarkedLow1[1], low); #-------------------------------------------------------------- def marketHigh1 = if _highInPeriod1 > _highInPeriod1[-LookbackPeriod] then _highInPeriod1 else _highInPeriod1[-LookbackPeriod]; def _markedHigh1 = high == marketHigh1; rec _lastMarkedHigh1 = CompoundValue(1, if IsNaN(_markedHigh1) then _lastMarkedHigh1[1] else if _markedHigh1 then high else _lastMarkedHigh1[1], high); #-------------------------------------------------------------- plot Resistance1 = _lastMarkedHigh1; plot Support1 = _lastMarkedLow1; #-------------------------------------------------------------- Resistance1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); Resistance1.SetDefaultColor(Color.MAGENTA); Resistance1.SetHiding(HideCurrentTF); #-------------------------------------------------------------- Support1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); Support1.SetDefaultColor(Color.YELLOW); Support1.SetHiding(HideCurrentTF); #-------------------------------------------------------------- def LowSwingForw = Lowest(low, SwingsLagBar)[-SwingsLagBar]; def LowSwingBack = Lowest(low, LookbackPeriod)[1]; def SwingLow = if low < LowSwingForw and low <= LowSwingBack then 1 else 0; plot LowSwing = if SwingLow then low else Double.NaN; LowSwing.Hide(); #-------------------------------------------------------------- def HighSwingForw = Highest(high, SwingsLagBar)[-SwingsLagBar]; def HighSwingBack = Highest(high, LookbackPeriod)[1]; def SwingHigh = if high > HighSwingForw and high >= HighSwingBack then 1 else 0; plot HighSwing = if SwingHigh then high else Double.NaN; HighSwing.Hide(); #-------------------------------------------------------------- HighSwing.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); HighSwing.SetLineWeight(5); HighSwing.SetDefaultColor(Color.MAGENTA); HighSwing.SetHiding(HideSwings); LowSwing.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); LowSwing.SetLineWeight(5); LowSwing.SetDefaultColor(Color.YELLOW); LowSwing.SetHiding(HideSwings); #-------------------------------------------------------------- Alert(HighSwing, "SupRes : Swing High", Alert.BAR, Sound.Bell); Alert(LowSwing, "SupRes : Swing Low", Alert.BAR, Sound.Bell); #-------------------------------------------------------------- AddLabel(HighSwing, "SupRes : Swing High", Color.MAGENTA); AddLabel(LowSwing, "SupRes : Swing Low", Color.YELLOW); #-------------------------------------------------------------- def _highInPeriod2 = Highest(high(period = TimeFrame2), LookbackPeriod); def _lowInPeriod2 = Lowest(low(period = TimeFrame2), LookbackPeriod); #-------------------------------------------------------------- def marketLow2 = if _lowInPeriod2 < _lowInPeriod2[-LookbackPeriod] then _lowInPeriod2 else _lowInPeriod2[-LookbackPeriod]; def _markedLow2 = low(period = TimeFrame2) == marketLow2; rec _lastMarkedLow2 = CompoundValue(1, if IsNaN(_markedLow2) then _lastMarkedLow2[1] else if _markedLow2 then low(period = TimeFrame2) else _lastMarkedLow2[1], low(period = TimeFrame2)); #-------------------------------------------------------------- def marketHigh2 = if _highInPeriod2 > _highInPeriod2[-LookbackPeriod] then _highInPeriod2 else _highInPeriod2[-LookbackPeriod]; def _markedHigh2 = high(period = TimeFrame2) == marketHigh2; rec _lastMarkedHigh2 = CompoundValue(1, if IsNaN(_markedHigh2) then _lastMarkedHigh2[1] else if _markedHigh2 then high(period = TimeFrame2) else _lastMarkedHigh2[1], high(period = TimeFrame2)); #-------------------------------------------------------------- plot Resistance2 = _lastMarkedHigh2; Resistance2.Hide(); plot Support2 = _lastMarkedLow2; Support2.Hide(); #-------------------------------------------------------------- Resistance2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); Resistance2.SetDefaultColor(Color.MAGENTA); Resistance2.SetHiding(HideTimeFrame2); #-------------------------------------------------------------- Support2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); Support2.SetDefaultColor(Color.YELLOW); Support2.SetHiding(HideTimeFrame2); #-------------------------------------------------------------- def _highInPeriod3 = Highest(high(period = TimeFrame3), LookbackPeriod); def _lowInPeriod3 = Lowest(low(period = TimeFrame3), LookbackPeriod); #-------------------------------------------------------------- def marketLow3 = if _lowInPeriod3 < _lowInPeriod3[-LookbackPeriod] then _lowInPeriod3 else _lowInPeriod3[-LookbackPeriod]; def _markedLow3 = low(period = TimeFrame3) == marketLow3; rec _lastMarkedLow3 = CompoundValue(1, if IsNaN(_markedLow3) then _lastMarkedLow3[1] else if _markedLow3 then low(period = TimeFrame3) else _lastMarkedLow3[1], low(period = TimeFrame3)); #-------------------------------------------------------------- def marketHigh3 = if _highInPeriod3 > _highInPeriod3[-LookbackPeriod] then _highInPeriod3 else _highInPeriod3[-LookbackPeriod]; def _markedHigh3 = high(period = TimeFrame3) == marketHigh3; rec _lastMarkedHigh3 = CompoundValue(1, if IsNaN(_markedHigh3) then _lastMarkedHigh3[1] else if _markedHigh3 then high(period = TimeFrame3) else _lastMarkedHigh3[1], high(period = TimeFrame3)); #-------------------------------------------------------------- plot Resistance3 = _lastMarkedHigh3; Resistance3.Hide(); plot Support3 = _lastMarkedLow3; Support3.Hide(); #-------------------------------------------------------------- Resistance3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); Resistance3.SetDefaultColor(Color.MAGENTA); Resistance3.SetHiding(HideTimeFrame3); #-------------------------------------------------------------- Support3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); Support3.SetDefaultColor(Color.YELLOW); Support3.SetHiding(HideTimeFrame3); def ff = (open * 2 + close * 3)/5; def lower_close1 = (SMA2 crosses below Support1[1]); def higher_close1 = (SMA2 crosses above Resistance1[1]); def lower_close2 = (SMA2 crosses below Support2[1]); def higher_close2 = (SMA2 crosses above Resistance2[1]); def lower_close3 = (SMA2 crosses below Support2[1]); def higher_close3 = (SMA2 crosses above Resistance2[1]); def higher_close12 = (ff > Resistance1[1]); def higher_close22 = (ff > Resistance2[1]); def higher_close32 = (ff > Resistance2[1]); def x = (close > trueqb); def c = (close[1] < trueqb[1]); def v = (close[2] < trueqb[2]); def b = x and (c or v); def y = (close > trueqs); def w = (close[1] < trueqs[1]); def e = (close[2] < trueqs[2]); def r = y and (w or e); def allbreakdown = lower_close1 or lower_close2 or lower_close3; def allbreakup = (higher_close1 or higher_close2 or higher_close3); def allbreakup2 = (higher_close12 or higher_close22 or higher_close32); def anyres = support1 or support2 or support3; def ansup = support1 or support2 or support3; input BuyEntry2 = 40; input SellEntry2 = 40; def QB2 = Highest(high, BuyEntry2); def QS2 = Lowest(low, SellEntry2); plot trueqb2 = QB2[1]; trueqb2.SetDefaultColor(GetColor(27)); plot trueqs2 = QS2[1]; trueqs2.SetDefaultColor(GetColor(27)); plot midline2 = (trueqb2 + trueqs2)/2; def fg = (high - close) < ((close - open) * 2); def fgbear = (close-low) < ((open - close) * 2); def goodcandle = ((high - close) < (hl2 - low)) or (open > high[1]); def goodsellcandle = (close - low) < (high - hl2); def goodcandle2 = ((close - open)/(high - low)) > .82; def allbreaku = (allbreakup2 and goodcandle2); def openhigh = open > close[1]; plot goldenbuy = (allbreakup or allbreaku or allbreakup[1]); plot goldenshort = (allbreakdown); plot goldenbuytesting = (goldenbuy) and recentup and (goodcandle) and (fg) and (squeeze is false) and goldenbuy[1] is false and goldenbuy[2] is false and goldenbuy[3] is false; goldenbuytesting.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); goldenbuytesting.SetDefaultColor(GetColor(34)); plot goldenshorttesting = (goldenshort) and recentdown and (squeeze is false) and fgbear and goldenshort[1] is false and goldenshort[2] is false and goldenshort[3] is false; goldenshorttesting.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); goldenshorttesting.SetDefaultColor(GetColor(39));
All of this was designed on a daily chart but can certainly be used on other timeframes.
On some stocks a 2 lookback is better while on others 3 is. Make sure you look at past performance.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
YungTrader's Relative Volume | Indicators | 17 | ||
The Ultimate Buy and Sell Indicator for ThinkOrSwim | Indicators | 4 | ||
P | Ultimate MACD For ThinkOrSwim | Indicators | 16 | |
Ultimate RSI [LuxAlgo] for ThinkOrSwim | Indicators | 12 | ||
Ultimate Bullish Cross using Price Momentum and Volume For SwingTrading | Indicators | 26 |
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.