Usethinkscript

usethinkscript

2022.10.03 13:26 JP782 usethinkscript

Unofficial - here you can communicate freely without fear of censorship as well as contact users directly on studies youre working on
[link]


2023.06.02 10:39 thisoneismy Auto Pivots PCF

Hey everyone. I just got set up with a gold account, switched over from TOS. Rewrote all of my scripts into PCFs and scans except one... anyone ever use//hear of this auto pivots script by Mobius?
https://usethinkscript.com/threads/auto-pivot-points-support-resistance-indicator-for-thinkorswim.158/
Have any idea if something like this is possible in TC2000? Automatically drawing trend lines etc.
submitted by thisoneismy to TC2000 [link] [comments]


2023.04.21 18:43 LOLRECONLOL Different Types of Indicators

Hi all,
I saw this post the other day, and it recommends different types of indicators for a strong entry.
https://usethinkscript.com/threads/why-using-different-types-of-indicators-is-important-to-successful-trading-in-thinkorswim.6114/#post-122848
Has anyone tried any of the following combinations and had luck? There is another link in the post that shows some screenshots of setups..
Standard Deviation Channel + MACD + OBV MA crossover + MFI Bollinger bands + RSI + Volume Oscillator PSAR + ROC + Trendlines PSAR + MFI + Trendlines 

submitted by LOLRECONLOL to Daytrading [link] [comments]


2023.04.12 13:30 MCMiyukiDozo The hardest part about Trading for me is waking up really early in the morning.

I finally developed my trading edge consisting of Heiken Ashi Candles, RSI, MACD + The Market Internals VOLD, ADD, and a custom cumulative TICK indicator from usethinkscript.
I first check if it's a buying market or a selling market using SPX's Daily Chart. After that I trade with the trend using the 1H, 30M, and 15M chart and the aforementioned indicators.
I find my approach relatively less stressful than most approaches as I swing trade LETFs and don't make my positions too big.
I'm making this post as I've found that the best way to succeed in trading is to just sit out and wait until your setup is there and wait for confirmation using whatever approach you use. The hardest part though is actually being there for 6.5 hours patiently waiting for the right opportunity since the market opens in California at 630 AM.
Anyone else find themselves in this situation?
submitted by MCMiyukiDozo to Trading [link] [comments]


2023.03.01 21:49 JP782 Does anyone here use NMACD/Normalized-MACD?

Im using this version and am curious if anyone else is using it?
submitted by JP782 to thinkorswim [link] [comments]


2023.02.10 21:14 False-Reflection3672 Jline indicator by JTrader for MotiveWave

Hey guys,
I am looking for a Jline Indicator for MotiveWave, but only found a code for Thinkor Swim. Does anyone have this indicator or can tell me, where I find it? Here is the Code:
#JLine_Cloud #Converted by u/SuryaKiranC #Requested by @us3r001 # https://usethinkscript.com/threads/jlines-for-thinkorswim.9521
input s1 = 72; input h1 = 89;
input enable515 = no;
DefineGlobalColor( "EMA1+", CreateColor(201, 255, 234)); DefineGlobalColor( "EMA1-", CreateColor(255, 105, 105)); DefineGlobalColor( "EMA2+", CreateColor(125, 176, 130)); DefineGlobalColor( "EMA2-", CreateColor(194, 152, 227)); DefineGlobalColor( "EMA3+", CreateColor(161, 217, 247)); DefineGlobalColor( "EMA3-", CreateColor(255, 255, 112));
input res = AggregationPeriod.MIN; input res1 = AggregationPeriod.THREE_MIN; input res2 = AggregationPeriod.FIVE_MIN;
assert(GetAggregationPeriod() >= res, "Chart Frame Higher that input res"); AddLabel(if (GetAggregationPeriod() > res) then yes else no, "JLine :input res is lower than Chart TimeFrame", Color.RED);
def EMA1_S1 = ExpAverage(close(period = res),s1); def EMA1_H1 = ExpAverage(close(period = res),h1); def EMA2_S1 = ExpAverage(close(period = res2),s1); def EMA2_H1 = ExpAverage(close(period = res2),h1);
def EMA3_5 = ExpAverage(close(period = res2),5); def EMA3_15 = ExpAverage(close(period = res2),15);
plot ODaily = DailyOpen(); ODaily.SetDefaultColor(Color.ORANGE);
AddCloud( EMA1_S1, EMA1_H1, GlobalColor("EMA1+"), GlobalColor("EMA1-")); AddCloud( EMA2_S1, EMA2_H1, GlobalColor("EMA2+"), GlobalColor("EMA2-")); AddCloud(if enable515 then EMA3_5 else Double.NaN,if enable515 then EMA3_15 else Double.NaN, GlobalColor("EMA3+"), GlobalColor("EMA3-"));
#End
Thank you in advance
submitted by False-Reflection3672 to MotiveWave [link] [comments]


2023.01.13 16:30 JP782 Inaccurate signals on Averaged Squeeze Momentum

Of the many diff charts I run I made this avg of squeeze momentum using 6 timeframes (why? I got the idea from a study that uses 6) Im having problem with when the arrow paints the color changes for the momentum,it will paint 2 arrows (red and yellow) at once, and sometimes it does it for blue and cyan? Suggestions?
[ Yes, multiple counter signals go off close to ea other. This is stripped down from additional script it’s not final product, just trying to figure this first problem out ]
#based off of code via TheBewb using existing Mobius Squeeze Momentum input Xmomentum = yes; input XavgSignals = no; input length = 20; input agg = AggregationPeriod.MIN; input agg2 = AggregationPeriod.TWO_MIN; input agg3 = AggregationPeriod.THREE_MIN; input agg4 = AggregationPeriod.FOUR_MIN; input agg5 = AggregationPeriod.FIVE_MIN; input agg6 = AggregationPeriod.TEN_MIN; def price = close(period = agg); plot Zero_Line = 0; Zero_Line.HIDE(); def K = (Highest(high, length) + Lowest(low, length)) / 2 + ExpAverage(close, length); def momo1 = Inertia(price - K / 2, length); ################################################################################# def price2 = close(period = agg2); def K2 = (Highest(high, length) + Lowest(low, length)) / 2 + ExpAverage(close, length); def momo2 = Inertia(price2 - K2 / 2, length); ################################################################################# def price3 = close(period = agg3); def K3 = (Highest(high, length) + Lowest(low, length)) / 2 + ExpAverage(close, length); def momo3 = Inertia(price3 - K3 / 2, length); ################################################################################# def price4 = close(period = agg4); def K4 = (Highest(high, length) + Lowest(low, length)) / 2 + ExpAverage(close, length); def momo4 = Inertia(price4 - K4 / 2, length); ################################################################################# def price5 = close(period = agg5); def K5 = (Highest(high, length) + Lowest(low, length)) / 2 + ExpAverage(close, length); def momo5 = Inertia(price5 - K5 / 2, length); ################################################################################# def price6 = close(period = agg6); def K6 = (Highest(high, length) + Lowest(low, length)) / 2 + ExpAverage(close, length); def momo6 = Inertia(price6 - K6 / 2, length);
def momo = (momo1 + momo2 + momo3 + momo4 + momo5 + momo6) /6; def pos = momo >= 0; def neg = momo < 0; def up = momo >= momo[1]; def dn = momo < momo[1];
def PosUp = pos and up; def PosDn = pos and dn; def NegDn = neg and dn; def NegUp = neg and up;
plot momentum = momo; momentum.DefineColor("PosUp", Color.CYAN); momentum.DefineColor("PosDn", Color.BLUE); momentum.DefineColor("NegDn", Color.RED); momentum.DefineColor("NegUp", Color.YELLOW); #momentum.SetPaintingStrategy(PaintingStrategy.HISTOGRAM); momentum.SETStyle(CURVE.FIRM); momentum.SetLineWeight(1); momentum.AssignValueColor(if PosUp then momentum.Color("PosUp") else if PosDn then momentum.Color("PosDn") else if NegDn then momentum.Color("NegDn") else if NegUp then momentum.Color("NegUp") else momentum.Color("NegUp")); momentum.hide();
def XPosUp = pos and up;#cyan plot PosUpX = if XPosUp and !XPosUp[1] THEN (low - 5 * tickSize()) else double.NaN; PosupX.SetPaintingStrategy(PaintingStrategy.ARROW_UP); PosupX.setdefaultColor(COLOR.CYAN); PosupX.setlineWeight(5); PosUpX.sethiding(XavgSignals);
def XPosDn = pos and dn;#blue plot PosDnX = if XPosDn and ! XPosDn[1] THEN (high + 5 * tickSize()) else double.NaN; PosDnX.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN); PosDnX.setdefaultColor(COLOR.BLUE); PosDnX.setlineWeight(5); PosDnX.sethiding(XavgSignals);
def XNegDn = neg and dn;#red plot NegDnX = if XNegDn and ! XNegDn[1] THEN (high + 5 * tickSize()) else double.NaN; NegDnX.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN); NegDnX.setdefaultColor(COLOR.RED); NegDnX.setlineWeight(5); NegDnX.sethiding(XavgSignals);
def XNegUp = neg and up;#yellow plot NegUpX = if XNegDn and ! XNegDn[1] THEN (low - 5 * tickSize()) else double.NaN; NegUpX.SetPaintingStrategy(PaintingStrategy.ARROW_UP); NegUpX.setdefaultColor(COLOR.YELLOW); NegUpX.setlineWeight(5); NegUpX.sethiding(XavgSignals);
submitted by JP782 to usethinkscript [link] [comments]


2023.01.11 15:09 JP782 NMACD conditions help

I want to know when Z2 > Z4 and the values are between -.8 and -1 and then the reverse when theyre crossed to downside z2 Ive tried mult types of combinations and it will NOT produce a true result on a chart: def test = z2 > z4 and Z2<(0-.8) and z4<(0-.8); def test1 = z2 < z4 and Z2>.8 and z4>.8;
What am I doing wrong?


#Normalized MACD
# halcyonguy usethinkscript 1/30/22
declare lower;
def na = Double.NaN;
input Show_Label = no;
input VertU=no;
input VertD=no;
input Show_VertL0 = no;
input over_sold = -1;
input midL = -.8;
input over_bought = 1;
input midH = .8;
input sma = 12;
input lma = 21;
input tsp = 9;
input np = 50;
input avg_type = AverageType.EXPONENTIAL;
def sh = MovingAverage(avg_type, close, sma);
def lon = MovingAverage(avg_type, close, lma);
# -------------------------------
def ratio = Min(sh, lon) / Max(sh, lon);
def Mac = If(sh > lon, 2 - ratio, ratio) - 1;
def MacNorm = ((Mac - Lowest(Mac, np)) / (Highest(Mac, np) - Lowest(Mac, np) + .000001) * 2) - 1;
def MacNorm2 = If(np < 2, Mac, MacNorm);
def Trigger = WMA(MacNorm2, tsp);
plot z2 = MacNorm2;
z2.SETDefaultColor(COLOR.BLACK);
#z2.hide();
plot z4 = Trigger;
z4.SetDefaultColor(Color.RED);
#z4.hide();
plot z = 0;
z.setDefaultColor(color.GRAY);
z.setLineWeight(2);
#z.hide();
submitted by JP782 to thinkorswim [link] [comments]


2022.12.14 15:45 JP782 MTF Standard Error Channels

I tried taking the MTF Standard Deviations Channel script to make a MTF Standard Error but its not working,I clearly did something wrong.
I figured all you really needed to do was change stdDev to stdERR, but no the values do match and are quite off (Im using the correct length where for me its 1113 (via using bar count script) from open to 1pm and then it goes to 1114) from matching the “factory” levels of 4h6mo
FTR the Daily Std Error works, but I cant fig out why the 4h6mo doesn’t??
--------------------------------------
https://preview.redd.it/xhm5ktmklv5a1.png?width=1491&format=png&auto=webp&s=1635e7a763c93a1e984ce57a196dfcf09dc96514
# Based off the original code/concept by Slippage at useThinkScript # Modifications/additions by Tidan # Additional modifications/additions by NeuroticNeutrino declare once_per_bar; input show_month = no; input show_week = no; input show_day = yes; input show_four_hour = yes;
DefineGlobalColor("Half Lines", Color.GRAY); DefineGlobalColor("Dev 1", GetColor(4)); DefineGlobalColor("Dev 2", GetColor(6)); DefineGlobalColor("Dev 3", CreateColor(116,189,232)); DefineGlobalColor("Dev 4", color.PLUM);
def nan = Double.NaN;
def MoLength = 12; ## 1 YeaMonth def WkLength = 52; ## 1 YeaWeek def DayLength = 252; ## 1 YeaDay def FourHourLength = 1113; ## 180 Day/4 Hour (equities, without extended hours)
def MoRegression = Inertia(close(period = aggregationPeriod.MONTH), MoLength); def MoStdDev = sterr(close(period = aggregationPeriod.MONTH), MoLength); def MoStyle = curve.FIRM; def MoLineWidth = 5;
def WkRegression = Inertia(close(period = aggregationPeriod.WEEK), WkLength); def WkStdDev = sterr(close(period = aggregationPeriod.WEEK), WkLength); def WkStyle = curve.LONG_DASH; def WkLineWidth = 4;
def DayRegression = Inertia(close(period = aggregationPeriod.DAY), DayLength); def DayStdDev = sterr(close(period = aggregationPeriod.DAY), DayLength); def DayStyle = curve.MEDIUM_DASH; def DayLineWidth = 3;
def FourHourRegression = Inertia(close(period = aggregationPeriod.FOUR_HOURS), FourHourLength); def FourHourStdDev = sterr(close(period = aggregationPeriod.FOUR_HOURS), FourHourLength); def FourHourStyle = curve.SHORT_DASH; def FourHourLineWidth = 2;
#Month channel plot MoUpperHalf = if show_month then MoRegression + 0.5 * MoStdDev else nan; plot MoUpper1 = if show_month then MoRegression + 1 * MoStdDev else nan; plot MoUpper1Half = if show_month then MoRegression + 1.5 * MoStdDev else nan; plot MoUpper2 = if show_month then MoRegression + 2 * MoStdDev else nan; plot MoUpper2Half = if show_month then MoRegression + 2.5 * MoStdDev else nan; plot MoUpper3 = if show_month then MoRegression + 3 * MoStdDev else nan; plot MoUpper3Half = if show_month then MoRegression + 3.5 * MoStdDev else nan; plot MoUpper4 = if show_month then MoRegression + 4 * MoStdDev else nan; plot MoMiddle = if show_month then MoRegression else nan; plot MoLowerHalf = if show_month then MoRegression - 0.5 * MoStdDev else nan; plot MoLower1 = if show_month then MoRegression - 1 * MoStdDev else nan; plot MoLower1Half = if show_month then MoRegression - 1.5 * MoStdDev else nan; plot MoLower2 = if show_month then MoRegression - 2 * MoStdDev else nan; plot MoLower2Half = if show_month then MoRegression - 2.5 * MoStdDev else nan; plot MoLower3 = if show_month then MoRegression - 3 * MoStdDev else nan; plot MoLower3Half = if show_month then MoRegression - 3.5 * MoStdDev else nan; plot MoLower4 = if show_month then MoRegression - 4 * MoStdDev else nan;
MoMiddle.SetDefaultColor(color.WHITE); MoMiddle.SetStyle(MoStyle); MoMiddle.SetLineWeight(MoLineWidth); MoMiddle.HideTitle();
MoLowerHalf.SetDefaultColor(GlobalColor("Half Lines")); MoLowerHalf.SetStyle(MoStyle); MoLowerHalf.SetLineWeight(MoLineWidth); MoLowerHalf.HideTitle();
MoUpperHalf.SetDefaultColor(GlobalColor("Half Lines")); MoUpperHalf.SetStyle(MoStyle); MoUpperHalf.SetLineWeight(MoLineWidth); MoUpperHalf.HideTitle();
MoLower1.SetDefaultColor(GlobalColor("Dev 1")); MoLower1.SetStyle(MoStyle); MoLower1.SetLineWeight(MoLineWidth); MoLower1.HideTitle();
MoUpper1.SetDefaultColor(GlobalColor("Dev 1")); MoUpper1.SetStyle(MoStyle); MoUpper1.SetLineWeight(MoLineWidth); MoUpper1.HideTitle();
MoLower1Half.SetDefaultColor(GlobalColor("Half Lines")); MoLower1Half.SetStyle(MoStyle); MoLower1Half.SetLineWeight(MoLineWidth); MoLower1Half.HideTitle();
MoUpper1Half.SetDefaultColor(GlobalColor("Half Lines")); MoUpper1Half.SetStyle(MoStyle); MoUpper1Half.SetLineWeight(MoLineWidth); MoUpper1Half.HideTitle();
MoLower2.SetDefaultColor(GlobalColor("Dev 2")); MoLower2.SetStyle(MoStyle); MoLower2.SetLineWeight(MoLineWidth); MoLower2.HideTitle();
MoUpper2.SetDefaultColor(GlobalColor("Dev 2")); MoUpper2.SetStyle(MoStyle); MoUpper2.SetLineWeight(MoLineWidth); MoUpper2.HideTitle();
MoLower2Half.SetDefaultColor(GlobalColor("Half Lines")); MoLower2Half.SetStyle(MoStyle); MoLower2Half.SetLineWeight(MoLineWidth); MoLower2Half.HideTitle();
MoUpper2Half.SetDefaultColor(GlobalColor("Half Lines")); MoUpper2Half.SetStyle(MoStyle); MoUpper2Half.SetLineWeight(MoLineWidth); MoUpper2Half.HideTitle();
MoLower3.SetDefaultColor(GlobalColor("Dev 3")); MoLower3.SetStyle(MoStyle); MoLower3.SetLineWeight(MoLineWidth); MoLower3.HideTitle();
MoUpper3.SetDefaultColor(GlobalColor("Dev 3")); MoUpper3.SetStyle(MoStyle); MoUpper3.SetLineWeight(MoLineWidth); MoUpper3.HideTitle();
MoLower3Half.SetDefaultColor(GlobalColor("Half Lines")); MoLower3Half.SetStyle(MoStyle); MoLower3Half.SetLineWeight(MoLineWidth); MoLower3Half.HideTitle();
MoUpper3Half.SetDefaultColor(GlobalColor("Half Lines")); MoUpper3Half.SetStyle(MoStyle); MoUpper3Half.SetLineWeight(MoLineWidth); MoUpper3Half.HideTitle();
MoLower4.SetDefaultColor(GlobalColor("Dev 4")); MoLower4.SetStyle(MoStyle); MoLower4.SetLineWeight(MoLineWidth); MoLower4.HideTitle();
MoUpper4.SetDefaultColor(GlobalColor("Dev 4")); MoUpper4.SetStyle(MoStyle); MoUpper4.SetLineWeight(MoLineWidth); MoUpper4.HideTitle();
## Week channel plot WkUpperHalf = if show_week then WkRegression + 0.5 * WkStdDev else nan; plot WkUpper1 = if show_week then WkRegression + 1 * WkStdDev else nan; plot WkUpper1Half = if show_week then WkRegression + 1.5 * WkStdDev else nan; plot WkUpper2 = if show_week then WkRegression + 2 * WkStdDev else nan; plot WkUpper2Half = if show_week then WkRegression + 2.5 * WkStdDev else nan; plot WkUpper3 = if show_week then WkRegression + 3 * WkStdDev else nan; plot WkUpper3Half = if show_week then WkRegression + 3.5 * WkStdDev else nan; plot WkUpper4 = if show_week then WkRegression + 4 * WkStdDev else nan; plot WkMiddle = if show_week then WkRegression else nan; plot WkLowerHalf = if show_week then WkRegression - 0.5 * WkStdDev else nan; plot WkLower1 = if show_week then WkRegression - 1 * WkStdDev else nan; plot WkLower1Half = if show_week then WkRegression - 1.5 * WkStdDev else nan; plot WkLower2 = if show_week then WkRegression - 2 * WkStdDev else nan; plot WkLower2Half = if show_week then WkRegression - 2.5 * WkStdDev else nan; plot WkLower3 = if show_week then WkRegression - 3 * WkStdDev else nan; plot WkLower3Half = if show_week then WkRegression - 3.5 * WkStdDev else nan; plot WkLower4 = if show_week then WkRegression - 4 * WkStdDev else nan;
WkMiddle.SetDefaultColor(color.WHITE); WkMiddle.SetStyle(WkStyle); WkMiddle.SetLineWeight(WkLineWidth); WkMiddle.HideTitle();
WkLowerHalf.SetDefaultColor(GlobalColor("Half Lines")); WkLowerHalf.SetStyle(WkStyle); WkLowerHalf.SetLineWeight(WkLineWidth); WkLowerHalf.HideTitle();
WkUpperHalf.SetDefaultColor(GlobalColor("Half Lines")); WkUpperHalf.SetStyle(WkStyle); WkUpperHalf.SetLineWeight(WkLineWidth); WkUpperHalf.HideTitle();
WkLower1.SetDefaultColor(GlobalColor("Dev 1")); WkLower1.SetStyle(WkStyle); WkLower1.SetLineWeight(WkLineWidth); WkLower1.HideTitle();
WkUpper1.SetDefaultColor(GlobalColor("Dev 1")); WkUpper1.SetStyle(WkStyle); WkUpper1.SetLineWeight(WkLineWidth); WkUpper1.HideTitle();
WkLower1Half.SetDefaultColor(GlobalColor("Half Lines")); WkLower1Half.SetStyle(WkStyle); WkLower1Half.SetLineWeight(WkLineWidth); WkLower1Half.HideTitle();
WkUpper1Half.SetDefaultColor(GlobalColor("Half Lines")); WkUpper1Half.SetStyle(WkStyle); WkUpper1Half.SetLineWeight(WkLineWidth); WkUpper1Half.HideTitle();
WkLower2.SetDefaultColor(GlobalColor("Dev 2")); WkLower2.SetStyle(WkStyle); WkLower2.SetLineWeight(WkLineWidth); WkLower2.HideTitle();
WkUpper2.SetDefaultColor(GlobalColor("Dev 2")); WkUpper2.SetStyle(WkStyle); WkUpper2.SetLineWeight(WkLineWidth); WkUpper2.HideTitle();
WkLower2Half.SetDefaultColor(GlobalColor("Half Lines")); WkLower2Half.SetStyle(WkStyle); WkLower2Half.SetLineWeight(WkLineWidth); WkLower2Half.HideTitle();
WkUpper2Half.SetDefaultColor(GlobalColor("Half Lines")); WkUpper2Half.SetStyle(WkStyle); WkUpper2Half.SetLineWeight(WkLineWidth); WkUpper2Half.HideTitle();
WkLower3.SetDefaultColor(GlobalColor("Dev 3")); WkLower3.SetStyle(WkStyle); WkLower3.SetLineWeight(WkLineWidth); WkLower3.HideTitle();
WkUpper3.SetDefaultColor(GlobalColor("Dev 3")); WkUpper3.SetStyle(WkStyle); WkUpper3.SetLineWeight(WkLineWidth); WkUpper3.HideTitle();
WkLower3Half.SetDefaultColor(GlobalColor("Half Lines")); WkLower3Half.SetStyle(WkStyle); WkLower3Half.SetLineWeight(WkLineWidth); WkLower3Half.HideTitle();
WkUpper3Half.SetDefaultColor(GlobalColor("Half Lines")); WkUpper3Half.SetStyle(WkStyle); WkUpper3Half.SetLineWeight(WkLineWidth); WkUpper3Half.HideTitle();
WkLower4.SetDefaultColor(GlobalColor("Dev 4")); WkLower4.SetStyle(WkStyle); WkLower4.SetLineWeight(WkLineWidth); WkLower4.HideTitle();
WkUpper4.SetDefaultColor(GlobalColor("Dev 4")); WkUpper4.SetStyle(WkStyle); WkUpper4.SetLineWeight(WkLineWidth); WkUpper4.HideTitle();
#Day channel plot DayUpperHalf = if show_day then DayRegression + 0.5 * DayStdDev else nan; plot DayUpper1 = if show_day then DayRegression + 1 * DayStdDev else nan; plot DayUpper1Half = if show_day then DayRegression + 1.5 * DayStdDev else nan; plot DayUpper2 = if show_day then DayRegression + 2 * DayStdDev else nan; plot DayUpper2Half = if show_day then DayRegression + 2.5 * DayStdDev else nan; plot DayUpper3 = if show_day then DayRegression + 3 * DayStdDev else nan; plot DayUpper3Half = if show_day then DayRegression + 3.5 * DayStdDev else nan; plot DayUpper4 = if show_day then DayRegression + 4 * DayStdDev else nan; plot DayMiddle = if show_day then DayRegression else nan; plot DayLowerHalf = if show_day then DayRegression - 0.5 * DayStdDev else nan; plot DayLower1 = if show_day then DayRegression - 1 * DayStdDev else nan; plot DayLower1Half = if show_day then DayRegression - 1.5 * DayStdDev else nan; plot DayLower2 = if show_day then DayRegression - 2 * DayStdDev else nan; plot DayLower2Half = if show_day then DayRegression - 2.5 * DayStdDev else nan; plot DayLower3 = if show_day then DayRegression - 3 * DayStdDev else nan; plot DayLower3Half = if show_day then DayRegression - 3.5 * DayStdDev else nan; plot DayLower4 = if show_day then DayRegression - 4 * DayStdDev else nan;
DayMiddle.SetDefaultColor(color.WHITE); DayMiddle.SetStyle(DayStyle); DayMiddle.SetLineWeight(DayLineWidth); DayMiddle.HideTitle();
DayLowerHalf.SetDefaultColor(GlobalColor("Half Lines")); DayLowerHalf.SetStyle(DayStyle); DayLowerHalf.SetLineWeight(DayLineWidth); DayLowerHalf.HideTitle();
DayUpperHalf.SetDefaultColor(GlobalColor("Half Lines")); DayUpperHalf.SetStyle(DayStyle); DayUpperHalf.SetLineWeight(DayLineWidth); DayUpperHalf.HideTitle();
DayLower1.SetDefaultColor(GlobalColor("Dev 1")); DayLower1.SetStyle(DayStyle); DayLower1.SetLineWeight(DayLineWidth); DayLower1.HideTitle();
DayUpper1.SetDefaultColor(GlobalColor("Dev 1")); DayUpper1.SetStyle(DayStyle); DayUpper1.SetLineWeight(DayLineWidth); DayUpper1.HideTitle();
DayLower1Half.SetDefaultColor(GlobalColor("Half Lines")); DayLower1Half.SetStyle(DayStyle); DayLower1Half.SetLineWeight(DayLineWidth); DayLower1Half.HideTitle();
DayUpper1Half.SetDefaultColor(GlobalColor("Half Lines")); DayUpper1Half.SetStyle(DayStyle); DayUpper1Half.SetLineWeight(DayLineWidth); DayUpper1Half.HideTitle();
DayLower2.SetDefaultColor(GlobalColor("Dev 2")); DayLower2.SetStyle(DayStyle); DayLower2.SetLineWeight(DayLineWidth); DayLower2.HideTitle();
DayUpper2.SetDefaultColor(GlobalColor("Dev 2")); DayUpper2.SetStyle(DayStyle); DayUpper2.SetLineWeight(DayLineWidth); DayUpper2.HideTitle();
DayLower2Half.SetDefaultColor(GlobalColor("Half Lines")); DayLower2Half.SetStyle(DayStyle); DayLower2Half.SetLineWeight(DayLineWidth); DayLower2Half.HideTitle();
DayUpper2Half.SetDefaultColor(GlobalColor("Half Lines")); DayUpper2Half.SetStyle(DayStyle); DayUpper2Half.SetLineWeight(DayLineWidth); DayUpper2Half.HideTitle();
DayLower3.SetDefaultColor(GlobalColor("Dev 3")); DayLower3.SetStyle(DayStyle); DayLower3.SetLineWeight(DayLineWidth); DayLower3.HideTitle();
DayUpper3.SetDefaultColor(GlobalColor("Dev 3")); DayUpper3.SetStyle(DayStyle); DayUpper3.SetLineWeight(DayLineWidth); DayUpper3.HideTitle();
DayLower3Half.SetDefaultColor(GlobalColor("Half Lines")); DayLower3Half.SetStyle(DayStyle); DayLower3Half.SetLineWeight(DayLineWidth); DayLower3Half.HideTitle();
DayUpper3Half.SetDefaultColor(GlobalColor("Half Lines")); DayUpper3Half.SetStyle(DayStyle); DayUpper3Half.SetLineWeight(DayLineWidth); DayUpper3Half.HideTitle();
DayLower4.SetDefaultColor(GlobalColor("Dev 4")); DayLower4.SetStyle(DayStyle); DayLower4.SetLineWeight(DayLineWidth); DayLower4.HideTitle();
DayUpper4.SetDefaultColor(GlobalColor("Dev 4")); DayUpper4.SetStyle(DayStyle); DayUpper4.SetLineWeight(DayLineWidth); DayUpper4.HideTitle();
#Four hour plot FourHourUpperHalf = if show_four_hour then FourHourRegression + 0.5 * FourHourStdDev else nan; plot FourHourUpper1 = if show_four_hour then FourHourRegression + 1 * FourHourStdDev else nan; plot FourHourUpper1Half = if show_four_hour then FourHourRegression + 1.5 * FourHourStdDev else nan; plot FourHourUpper2 = if show_four_hour then FourHourRegression + 2 * FourHourStdDev else nan; plot FourHourUpper2Half = if show_four_hour then FourHourRegression + 2.5 * FourHourStdDev else nan; plot FourHourUpper3 = if show_four_hour then FourHourRegression + 3 * FourHourStdDev else nan; plot FourHourUpper3Half = if show_four_hour then FourHourRegression + 3.5 * FourHourStdDev else nan; plot FourHourUpper4 = if show_four_hour then FourHourRegression + 4 * FourHourStdDev else nan; plot FourHourMiddle = if show_four_hour then FourHourRegression else nan; plot FourHourLowerHalf = if show_four_hour then FourHourRegression - 0.5 * FourHourStdDev else nan; plot FourHourLower1 = if show_four_hour then FourHourRegression - 1 * FourHourStdDev else nan; plot FourHourLower1Half = if show_four_hour then FourHourRegression - 1.5 * FourHourStdDev else nan; plot FourHourLower2 = if show_four_hour then FourHourRegression - 2 * FourHourStdDev else nan; plot FourHourLower2Half = if show_four_hour then FourHourRegression - 2.5 * FourHourStdDev else nan; plot FourHourLower3 = if show_four_hour then FourHourRegression - 3 * FourHourStdDev else nan; plot FourHourLower3Half = if show_four_hour then FourHourRegression - 3.5 * FourHourStdDev else nan; plot FourHourLower4 = if show_four_hour then FourHourRegression - 4 * FourHourStdDev else nan;
FourHourMiddle.SetDefaultColor(color.WHITE); FourHourMiddle.SetStyle(FourHourStyle); FourHourMiddle.SetLineWeight(FourHourLineWidth); FourHourMiddle.HideTitle();
FourHourLowerHalf.SetDefaultColor(GlobalColor("Half Lines")); FourHourLowerHalf.SetStyle(FourHourStyle); FourHourLowerHalf.SetLineWeight(FourHourLineWidth); FourHourLowerHalf.HideTitle();
FourHourUpperHalf.SetDefaultColor(GlobalColor("Half Lines")); FourHourUpperHalf.SetStyle(FourHourStyle); FourHourUpperHalf.SetLineWeight(FourHourLineWidth); FourHourUpperHalf.HideTitle();
FourHourLower1.SetDefaultColor(GlobalColor("Dev 1")); FourHourLower1.SetStyle(FourHourStyle); FourHourLower1.SetLineWeight(FourHourLineWidth); FourHourLower1.HideTitle();
FourHourUpper1.SetDefaultColor(GlobalColor("Dev 1")); FourHourUpper1.SetStyle(FourHourStyle); FourHourUpper1.SetLineWeight(FourHourLineWidth); FourHourUpper1.HideTitle();
FourHourLower1Half.SetDefaultColor(GlobalColor("Half Lines")); FourHourLower1Half.SetStyle(FourHourStyle); FourHourLower1Half.SetLineWeight(FourHourLineWidth); FourHourLower1Half.HideTitle();
FourHourUpper1Half.SetDefaultColor(GlobalColor("Half Lines")); FourHourUpper1Half.SetStyle(FourHourStyle); FourHourUpper1Half.SetLineWeight(FourHourLineWidth); FourHourUpper1Half.HideTitle();
FourHourLower2.SetDefaultColor(GlobalColor("Dev 2")); FourHourLower2.SetStyle(FourHourStyle); FourHourLower2.SetLineWeight(FourHourLineWidth); FourHourLower2.HideTitle();
FourHourUpper2.SetDefaultColor(GlobalColor("Dev 2")); FourHourUpper2.SetStyle(FourHourStyle); FourHourUpper2.SetLineWeight(FourHourLineWidth); FourHourUpper2.HideTitle();
FourHourLower2Half.SetDefaultColor(GlobalColor("Half Lines")); FourHourLower2Half.SetStyle(FourHourStyle); FourHourLower2Half.SetLineWeight(FourHourLineWidth); FourHourLower2Half.HideTitle();
FourHourUpper2Half.SetDefaultColor(GlobalColor("Half Lines")); FourHourUpper2Half.SetStyle(FourHourStyle); FourHourUpper2Half.SetLineWeight(FourHourLineWidth); FourHourUpper2Half.HideTitle();
FourHourLower3.SetDefaultColor(GlobalColor("Dev 3")); FourHourLower3.SetStyle(FourHourStyle); FourHourLower3.SetLineWeight(FourHourLineWidth); FourHourLower3.HideTitle();
FourHourUpper3.SetDefaultColor(GlobalColor("Dev 3")); FourHourUpper3.SetStyle(FourHourStyle); FourHourUpper3.SetLineWeight(FourHourLineWidth); FourHourUpper3.HideTitle();
FourHourLower3Half.SetDefaultColor(GlobalColor("Half Lines")); FourHourLower3Half.SetStyle(FourHourStyle); FourHourLower3Half.SetLineWeight(FourHourLineWidth); FourHourLower3Half.HideTitle();
FourHourUpper3Half.SetDefaultColor(GlobalColor("Half Lines")); FourHourUpper3Half.SetStyle(FourHourStyle); FourHourUpper3Half.SetLineWeight(FourHourLineWidth); FourHourUpper3Half.HideTitle();
FourHourLower4.SetDefaultColor(GlobalColor("Dev 4")); FourHourLower4.SetStyle(FourHourStyle); FourHourLower4.SetLineWeight(FourHourLineWidth); FourHourLower4.HideTitle();
FourHourUpper4.SetDefaultColor(GlobalColor("Dev 4")); FourHourUpper4.SetStyle(FourHourStyle); FourHourUpper4.SetLineWeight(FourHourLineWidth); FourHourUpper4.HideTitle();
submitted by JP782 to thinkorswim [link] [comments]


2022.11.16 17:50 Odd_Cry9344 Parsing Data With Powershell

I found this https://usethinkscript.com/threads/exporting-historical-data-from-thinkorswim-for-external-analysis.507/#post-14606
Once I've made the csv file I would have a bunch of sub-second ticks. How would I parse the data to 5 second chunks? Thanks.
submitted by Odd_Cry9344 to PowerShell [link] [comments]


2022.11.16 17:18 Odd_Cry9344 5 Second Bar Data from Tick Data

I found this https://usethinkscript.com/threads/exporting-historical-data-from-thinkorswim-for-external-analysis.507/#post-14606
If I would want to turn that into a 5 second chart how would I go about doing so? I could a) open a tick chart (I'm talking about something that isn't moving a gazillion ticks per second) and then b) parse the data to 5 seconds but how would I go about doing b). ? Thank you.
submitted by Odd_Cry9344 to ThinkScript [link] [comments]


2022.10.08 16:01 DriveNew Fair Value Gap Indicator

I am scouring the internet, including usethinkscript and can't find what I'm looking for... Basically would like to be able to identify a fair value gap on a 1 minute chart, that will shade the gap all the way through the chart time axis, and then will go away once it fills.
If anyone out there knows anywhere I can find this, I will put you in my will. LOL. Thank you in advance!
submitted by DriveNew to thinkorswim [link] [comments]


2022.10.04 18:48 JP782 Squeeze Watchlist count?

Is there a way to include a count to this script to know how many bars the stock is in any of the 3 levels of a squeeze?
[script source usethink]
input price = close; input length = 20; input Num_Dev_Dn = -2.0; input Num_Dev_up = 2.0; input averageType = AverageType.SIMPLE; input displace = 0; def sDev = StDev(data = price[-displace], length = length); def MidLineBB = MovingAverage(averageType, data = price[-displace], length = length); def LowerBandBB = MidLineBB + Num_Dev_Dn * sDev; def UpperBandBB = MidLineBB + Num_Dev_up * sDev; input factorhigh = 1.0; input factormid = 1.5; input factorlow = 2.0; input trueRangeAverageType = AverageType.SIMPLE; def shifthigh = factorhigh * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), length); def shiftMid = factormid * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), length); def shiftlow = factorlow * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), length); def average = MovingAverage(averageType, price, length); def Avg = average[-displace]; def UpperBandKCLow = average[-displace] + shiftlow[-displace]; def LowerBandKCLow = average[-displace] - shiftlow[-displace]; def UpperBandKCMid = average[-displace] + shiftMid[-displace]; def LowerBandKCMid = average[-displace] - shiftMid[-displace]; def UpperBandKCHigh = average[-displace] + shifthigh[-displace]; def LowerBandKCHigh = average[-displace] - shifthigh[-displace]; def K = (Highest(high, length) + Lowest(low, length)) / 2 + ExpAverage(close, length); def momo = Inertia(price - K / 2, length); def pos = momo>= 0; def neg = momo< 0; def up = momo >= momo[1]; def dn = momo < momo[1]; def presqueeze = LowerBandBB > LowerBandKCLow and UpperBandBB < UpperBandKCLow; def originalSqueeze = LowerBandBB > LowerBandKCMid and UpperBandBB < UpperBandKCMid; def ExtrSqueeze = LowerBandBB > LowerBandKCHigh and UpperBandBB < UpperBandKCHigh; addlabel(yes, if extrSqueeze then "extraSqueeze" else if presqueeze then "preSqueeze" else if originalSqueeze then "squeeze" else if preSqueeze then "preSqueeze" else "noSqueeze"); assignBackgroundColor(if ExtrSqueeze then Color.red else if originalSqueeze then Color.blue else if presqueeze then color.white else Color.gray);
submitted by JP782 to thinkorswim [link] [comments]


2022.10.04 16:46 JP782 MTF Squeeze Trend

There is a new study out that uses 6 timeframes of the squeeze, to signal entry and exits.https://www.youtube.com/watch?v=oDEBr80ssGo
The point of this study being developed is to get a solid entry and exit signals to "make $100 a day" for a 16yr old whose dad saw how well it worked so he tweaked it for his own use to the point he changed the way he trades now per this second vid https://www.youtube.com/watch?v=1dKUw0wIeAA
This is my attempt http://tos.mx/c9Jj3Ss its not pretty BUT it works so far. My signals do not 100% of time match the charts from the video. (Im NOT an expert writing script I learn stuff here and there, yes I know some of it can be simplified and made shorter... Im learning cut me a break)My orange arrow signals are pretty good, you still have to confirm with trend etc, I use QQE MOD and NMACD both give good signals.
When all levels finally turn cyan it produces a green arrow up for a normal entry. Yes, you could write it so when each level turns over and its > 0 to paint an arrow up(each a diff shade of green) which shows its only getting stronger, but my interest is on the early entry and exit - which is just the reverse.
Im trying to figure out whats the best combo of sqz histo's that are turning over to give the EARLY entry (my orange arrow) and exit signal. In general its when hist going from red to yellow, BUT which(as far as timeframes) red and yellow is best and should maybe 1 be cyan, if so which one? And the flip side for early exit red arrows, where the hist going from cyan to dark blue(normally signals momentum is slowing) - but again which ones are best to use?
I left it as is with brief notes and some tests I tried turned “off” via ‘ # ’
Could def use some help with the labels too, sometimes 2 are appearing at the same time
#MTF Sqz Histo Entry Exit by JP782 10/01/22 #based off of code via TheBewb using existing Mobius Squeeze Momentum
input Candle = no; input agg = AggregationPeriod.MIN; def price = close(period = agg); input length = 20;
plot Zero_Line = 0; Zero_Line.HIDE();
def K = (Highest(high, length) + Lowest(low, length)) / 2 + ExpAverage(close, length); def momo = Inertia(price - K / 2, length);
def pos = momo >= 0; def neg = momo < 0; def up = momo >= momo[1]; def dn = momo < momo[1];
def PosUp = pos and up; def PosDn = pos and dn; def NegDn = neg and dn; def NegUp = neg and up;
plot momentum = momo; momentum.DefineColor("PosUp", Color.CYAN); momentum.DefineColor("PosDn", Color.BLUE); momentum.DefineColor("NegDn", Color.RED); momentum.DefineColor("NegUp", Color.YELLOW); #momentum.SetPaintingStrategy(PaintingStrategy.HISTOGRAM); momentum.SETStyle(CURVE.FIRM); momentum.SetLineWeight(1); momentum.AssignValueColor(if PosUp then momentum.Color("PosUp") else if PosDn then momentum.Color("PosDn") else if NegDn then momentum.Color("NegDn") else if NegUp then momentum.Color("NegUp") else momentum.Color("NegUp")); momentum.hide();
#################################################################################
input agg2 = AggregationPeriod.TWO_MIN; def price2 = close(period = agg2); input length2 = 20;
def K2 = (Highest(high, length2) + Lowest(low, length2)) / 2 + ExpAverage(close, length2); def momo2 = Inertia(price2 - K2 / 2, length2);
def pos2 = momo2 >= 0; def neg2 = momo2 < 0; def up2 = momo2 >= momo2[1]; def dn2 = momo2 < momo2[1];
def PosUp2 = pos2 and up2; def PosDn2 = pos2 and dn2; def NegDn2 = neg2 and dn2; def NegUp2 = neg2 and up2;
plot momentum2 = momo2; momentum2.DefineColor("PosUp2", Color.CYAN); momentum2.DefineColor("PosDn2", Color.BLUE); momentum2.DefineColor("NegDn2", Color.RED); momentum2.DefineColor("NegUp2", Color.YELLOW); #momentum2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); momentum2.SETStyle(CURVE.FIRM); momentum2.SetLineWeight(1); momentum2.AssignValueColor(if PosUp2 then momentum2.Color("PosUp2”) else if PosDn2 then momentum2.Color("PosDn2”) else if NegDn2 then momentum2.Color("NegDn2”) else if NegUp2 then momentum2.Color("NegUp2”) else momentum2.Color("NegUp2”)); momentum2.hide();
#################################################################################
#################################################################################
input agg3 = AggregationPeriod.THREE_MIN; def price3 = close(period = agg3); input length3 = 20;
def K3 = (Highest(high, length3) + Lowest(low, length3)) / 2 + ExpAverage(close, length3); def momo3 = Inertia(price3 - K3 / 2, length3);
def pos3 = momo3 >= 0; def neg3 = momo3 < 0; def up3 = momo3 >= momo3[1]; def dn3 = momo3 < momo3[1];
def PosUp3 = pos3 and up3; def PosDn3 = pos3 and dn3; def NegDn3 = neg3 and dn3; def NegUp3 = neg3 and up3;
plot momentum3 = momo3; momentum3.DefineColor("PosUp3”, Color.CYAN); momentum3.DefineColor("PosDn3”, Color.BLUE); momentum3.DefineColor("NegDn3”, Color.RED); momentum3.DefineColor("NegUp3”, Color.YELLOW); #momentum3.SetPaintingStrategy(PaintingStrategy.HISTOGRAM); momentum3.SETStyle(CURVE.FIRM); momentum3.SetLineWeight(1); momentum3.AssignValueColor(if PosUp3 then momentum3.Color("PosUp3”) else if PosDn3 then momentum3.Color("PosDn3”) else if NegDn3 then momentum3.Color("NegDn3”) else if NegUp3 then momentum3.Color("NegUp3”) else momentum3.Color("NegUp3”)); momentum3.hide();
#################################################################################
input agg4 = AggregationPeriod.FOUR_MIN; def price4 = close(period = agg4); input length4 = 20;
def K4 = (Highest(high, length4) + Lowest(low, length4)) / 2 + ExpAverage(close, length4); def momo4 = Inertia(price4 - K4 / 2, length4);
def pos4 = momo4 >= 0; def neg4 = momo4 < 0; def up4 = momo4 >= momo4[1]; def dn4 = momo4 < momo4[1];
def PosUp4 = pos4 and up4; def PosDn4 = pos4 and dn4; def NegDn4 = neg4 and dn4; def NegUp4 = neg4 and up4;
plot momentum4 = momo4; momentum4.DefineColor("PosUp4”, Color.CYAN); momentum4.DefineColor("PosDn4”, Color.BLUE); momentum4.DefineColor("NegDn4”, Color.RED); momentum4.DefineColor("NegUp4”, Color.YELLOW); #momentum4.SetPaintingStrategy(PaintingStrategy.HISTOGRAM); momentum4.SETStyle(CURVE.FIRM); momentum4.SetLineWeight(1); momentum4.AssignValueColor(if PosUp4 then momentum4.Color("PosUp4”) else if PosDn4 then momentum4.Color("PosDn4”) else if NegDn4 then momentum4.Color("NegDn4”) else if NegUp4 then momentum4.Color("NegUp4”) else momentum4.Color("NegUp4”)); momentum4.hide();
#################################################################################
input agg5 = AggregationPeriod.FIVE_MIN; def price5 = close(period = agg5); input length5 = 20;
def K5 = (Highest(high, length5) + Lowest(low, length5)) / 2 + ExpAverage(close, length5); def momo5 = Inertia(price5 - K5 / 2, length5);
def pos5 = momo5 >= 0; def neg5 = momo5 < 0; def up5 = momo5 >= momo5[1]; def dn5 = momo5 < momo5[1];
def PosUp5 = pos5 and up5; def PosDn5 = pos5 and dn5; def NegDn5 = neg5 and dn5; def NegUp5 = neg5 and up5;
plot momentum5 = momo5; momentum5.DefineColor("PosUp5”, Color.CYAN); momentum5.DefineColor("PosDn5”, Color.BLUE); momentum5.DefineColor("NegDn5”, Color.RED); momentum5.DefineColor("NegUp5”, Color.YELLOW); #momentum5.SetPaintingStrategy(PaintingStrategy.HISTOGRAM); momentum5.SETStyle(CURVE.FIRM); momentum5.SetLineWeight(1); momentum5.AssignValueColor(if PosUp5 then momentum5.Color("PosUp5”) else if PosDn5 then momentum5.Color("PosDn5”) else if NegDn5 then momentum5.Color("NegDn5”) else if NegUp5 then momentum5.Color("NegUp5”) else momentum5.Color("NegUp5”)); momentum5.hide(); momentum5.hide();
#################################################################################
input agg10 = AggregationPeriod.TEN_MIN; def price10 = close(period = agg10); input length10 = 20;
def K10 = (Highest(high, length10) + Lowest(low, length10)) / 2 + ExpAverage(close, length10); def momo10 = Inertia(price10 - K10 / 2, length10);
def pos10 = momo10 >= 0; def neg10 = momo10 < 0; def up10 = momo10 >= momo10[1]; def dn10 = momo10 < momo10[1];
def PosUp10 = pos10 and up10; def PosDn10 = pos10 and dn10; def NegDn10 = neg10 and dn10; def NegUp10 = neg10 and up10;
plot momentum10 = momo10; momentum10.DefineColor("PosUp10", Color.CYAN); momentum10.DefineColor("PosDn10", Color.BLUE); momentum10.DefineColor("NegDn10", Color.RED); momentum10.DefineColor("NegUp10", Color.YELLOW); #momentum10.SetPaintingStrategy(PaintingStrategy.HISTOGRAM); momentum10.SETStyle(CURVE.FIRM); momentum10.SetLineWeight(1); momentum10.AssignValueColor(if PosUp10 then momentum10.Color("PosUp10") else if PosDn10 then momentum10.Color("PosDn10") else if NegDn10 then momentum10.Color("NegDn10") else if NegUp10 then momentum10.Color("NegUp10") else momentum10.Color("NegUp10")); momentum10.hide();
############################################################################################
DEF CYAN = IF PosUp AND PosUp2 AND PosUp3 AND PosUp4 AND PosUp5 AND PosUp10 THEN 1 ELSE 0; DEF BLUE = IF PosDn AND PosDn2 AND PosDn3 AND PosDn4 AND PosDn5 AND PosDn10 THEN 1 ELSE 0; DEF RED1 = IF NegDn AND NegDn2 AND NegDn3 AND NegDn4 AND NegDn5 AND NegDn10 THEN 1 ELSE 0; DEF YELLOW= IF NegUp AND NegUp2 AND NegUp3 AND NegUp4 AND NegUp5 AND NegUp10 THEN 1 ELSE 0;
########################################################################################### DEF DARKGREEN = IF PosUp + PosUp2 + PosUp3 + PosUp4 + PosUp5 + PosUp10 >= 6 THEN 1 ELSE 0;
DEF GREEN = IF PosUp + PosUp2 + PosUp3 + PosUp4 + PosUp5 + PosUp10 >= 5 then 1 ELSE 0;
DEF LIGHTGRN = if PosDn + PosDn2 + PosDn3 + PosDn4 + PosDn5 + PosDn10 >=4 THEN 1 ELSE 0;
DEF RED = IF NegDn + NegDn2 + NegDn3 + NegDn4 + NegDn5 + NegDn10 >=6 THEN 1 ELSE 0;
DEF ORANGE = if NegDn + NegDn2 + NegDn3 + NegDn4 + NegDn5 + NegDn10 >=5 THEN 1 ELSE 0;
DEF DarkRED = if NegUp + NegUp2 + NegUp3 + NegUp4 + NegUp5 + NegUp10 >=4 THEN 1 ELSE 0;
############################################################################################ #DEF CONDALL1 = IF NegUp AND NegUp2 AND NegUp3 AND NegUp4 AND NegUp5 AND NegUp10 THEN 1 ELSE 0; #DEF COND_ALL1 = CONDALL1 > 0 ; def Cond1 = if NegUp + NegUp2 + NegUp3 + NegUp4 + NegUp5 + NegUp10 >=5 THEN 1 ELSE 0; def Cond2 = IF PosUp + PosUp2 + PosUp3 + PosUp4 + PosUp5 + PosUp10 >= 1 then 1 ELSE 0; DEF COND_ALL1 = COND1 AND COND2; #PLOT EARLY_IN = IF COND_ALL1 AND !COND_ALL1[1] THEN 1 else Double.NaN; #EARLY_IN.SETPAINTINGSTRATEGY(PAINTINGSTRATEGY.BOOLEAN_ARROW_UP); #EARLY_IN.SETDEFAULTCOLOR(COLOR.ORANGE);#YELLOW BARS #EARLY_IN.SETLINEWEIGHT(3); plot EARLY_IN = if COND_ALL1 AND !COND_ALL1[1] THEN (low - 5 * tickSize()) else double.NaN; EARLY_IN.SetPaintingStrategy(PaintingStrategy.ARROW_UP); EARLY_IN.setdefaultColor(COLOR.ORANGE);#YELLOW BARS EARLY_IN.setlineWeight(3);
#DEF CONDALL = IF PosUp AND PosUp2 AND PosUp3 AND PosUp4 AND PosUp5 AND PosUp10 THEN 1 ELSE 0; DEF CONDALL = IF PosUp + PosUp2 + PosUp3 + PosUp4 + PosUp5 + PosUp10 >= 6 THEN 1 ELSE 0; #PLOT IN = IF CONDALL AND !CONDALL[1] THEN 1 else Double.NaN; #IN.SETPAINTINGSTRATEGY(PAINTINGSTRATEGY.BOOLEAN_ARROW_UP); #IN.SETDEFAULTCOLOR(COLOR.DARK_GREEN);#CYAN BARS #IN.SETLINEWEIGHT(3);
plot IN = if CONDALL and !CONDALL[1] then (low - 8 * tickSize()) else double.NaN; IN.SetPaintingStrategy(PaintingStrategy.ARROW_UP); IN.setdefaultColor(color.DARK_GREEN);#CYAN BARS IN.setlineWeight(3);
############### DOWN SIGNAL ##################### DEF COND_DN = IF PosDn AND PosDn2 AND PosDn3 AND PosDn4 AND PosDn5 AND PosDn10 THEN 1 ELSE 0; #plot OUT = IF COND_DN AND !COND_DN[1] THEN 1 else Double.NaN; #OUT.SETPAINTINGSTRATEGY(PAINTINGSTRATEGY.BOOLEAN_ARROW_DOWN); #OUT.SETDEFAULTCOLOR(COLOR.RED);#BLUE BARS = STILL UP BUT LOSING MOMENTUM #OUT.SETLINEWEIGHT(3);
#plot B = IF DARKGREEN AND !DARKGREEN[1] THEN 1 else Double.NaN; #B.SETPAINTINGSTRATEGY(PAINTINGSTRATEGY.BOOLEAN_ARROW_DOWN); #B.SETDEFAULTCOLOR(COLOR.BLUE);#5 out of 6 #B.SetLineWeight(1);
#def A = (B[1] or B[2]) and OUT;# OUT[-1] ; (out[-1]) or (out[-2])B(B,2) DEF A1 = COND_DN AND LIGHTGRN; DEF A = A1 and !A1[1]; #PLOT OUT1 = A; #OUT1.SETPAINTINGSTRATEGY(PAINTINGSTRATEGY.BOOLEAN_ARROW_DOWN); #OUT1.SETDEFAULTCOLOR(COLOR.RED);#4 out of 6 rising #OUT1.SETLINEWEIGHT(3);
plot OUT1 = if A then (high + 3 * tickSize()) else double.NaN; OUT1.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN); OUT1.setdefaultColor(COLOR.RED);#4 out of 6 rising OUT1.setlineWeight(3);
assignPriceColor (if Candle then if LIGHTGRN then Color.DARK_GREEN else if GREEN then Color.GREEN else if DARKGREEN then Color.LIGHT_GREEN else if RED then Color.RED else if ORANGE then Color.DARK_Orange else if DarkRed then Color.PINK else Color.Gray else Color.current);
addlabel (yes,"SqzTrend",if LIGHTGRN then Color.UPTICK else if GREEN then Color.Dark_GREEN else if DARKGREEN then CreateColor(15, 156, 0) else if RED then Color.RED else IF ORANGE then Color.DARK_Orange else if DarkRed then Color.PINK else Color.Gray); #### Lt Grn CreateColor(15, 156, 0), Drk Grn Uptick,
addlabel(LightGRN,”6out6”,Color.UPTICK); addlabel(GREEN,”5out6”,color.Dark_GREEN); addlabel(DARKGREEN,”4out6”, CreateColor(15, 156, 0)); addlabel(RED,”6out6”,color.RED); addlabel(ORANGE,”5out6”,color.DARK_ORANGE); addlabel(DarkRed and !ORANGE and !RED and !DARKGREEN and !GREEN and !LightGRN, "4out6”, color.pink);
###########################################################
submitted by JP782 to usethinkscript [link] [comments]


2022.10.03 13:26 JP782 r/usethinkscript Lounge

A place for members of usethinkscript to chat with each other
submitted by JP782 to usethinkscript [link] [comments]


2022.10.01 01:59 DriveNew Fair Value Gap (FVG) Indicator

Does anyone know of a good FVG Indicator for a 1 minute chart, that disappears after it fills? And goes all across the chart time axis till filled?
Thank You in Advance. Been looking on usethinkscript and other sites, and can't find one that makes them appear and then disappear once they fill...
submitted by DriveNew to thinkorswim [link] [comments]


2022.09.15 19:04 JP782 Combine QQE and NMACD into one study?

Is there a way to combine these two studies into one so they display like they do in chart? I have them stacked so they both appear correctly. If I add one study to the others script the chart gets crunched down and doesn’t work (bottom right histo) where you cant even see the NMACD lines
Is this possible?

https://preview.redd.it/ps28jdv002o91.png?width=2045&format=png&auto=webp&s=b2ffd66988859a251576e789904965ec17b38630
http://tos.mx/FuddMgb

#QQEMod via https://usethinkscript.com/threads/qqe-quantitative-qualitative-estimation-for-thinkorswim.938/page-2#post-84234
##Normalized MACD
# halcyonguy 1/30/22 https://usethinkscript.com/threads/normalized-macd-for-thinkorswim.9502/#post-89109
#
# QQE_Mod
declare lower;
Input Show_QlineCross = no;
input RSI_Length = 6;
input RSI_Smoothing = 5;
input Fast_QQE_Factor = 3.0;
input Threshold = 3;
input RSI_Source = close;
input RSI_Length2 = 6;
input RSI_Smoothing2 = 5;
input Fast_QQE_Factor2 = 1.61;
input Threshold2 = 3;
input RSI_Source2 = close;
input Bollinger_Length = 50;
input BB_Multiplier = 0.35; # min: 0.001, max: 5
# QQE 1
def Wilders_period = RSI_Length * 2 - 1;

def Rsi = RSI(price = RSI_Source, length = RSI_Length);
def RsiMa = MovAvgExponential(Rsi, RSI_Smoothing);
def AtrRsi = absValue(RsiMa[1] - RsiMa);
def MaAtrRsi = MovAvgExponential(AtrRsi, Wilders_Period);
def dar = MovAvgExponential(MaAtrRsi, Wilders_Period) * Fast_QQE_Factor;

def DeltaFastAtrRsi = dar;
def RSIndex = RsiMa;
def newshortband = RSIndex + DeltaFastAtrRsi;
def newlongband = RSIndex - DeltaFastAtrRsi;
def longband = if RSIndex[1] > longband[1] and RSIndex > longband[1] then max(longband[1], newlongband) else newlongband;
def shortband = if RSIndex[1] < shortband[1] and RSIndex < shortband[1] then min(shortband[1], newshortband) else newshortband;
def cross_1 = Crosses(longband[1], RSIndex, CrossingDirection.ANY);
def trend = if Crosses(RSIndex, shortband[1], CrossingDirection.ANY) then 1 else if cross_1 then -1 else if isNaN(trend[1]) then 1 else trend[1];
def FastAtrRsiTL = if trend == 1 then longband else shortband;

# QQE 2
def Wilders_period2 = RSI_Length2 * 2 - 1;

def Rsi2 = RSI(price = RSI_Source2, length = RSI_Length2);
def RsiMa2 = MovAvgExponential(Rsi2, RSI_Smoothing2);
def AtrRsi2 = absValue(RsiMa2[1] - RsiMa2);
def MaAtrRsi2 = MovAvgExponential(AtrRsi2, Wilders_Period2);
def dar2 = MovAvgExponential(MaAtrRsi2, Wilders_Period2) * Fast_QQE_Factor2;

def DeltaFastAtrRsi2 = dar2;
def RSIndex2 = RsiMa2;
def newshortband2 = RSIndex2 + DeltaFastAtrRsi2;
def newlongband2 = RSIndex2 - DeltaFastAtrRsi2;
def longband2 = if RSIndex2[1] > longband2[1] and RSIndex2 > longband2[1] then max(longband2[1], newlongband2) else newlongband2;
def shortband2 = if RSIndex2[1] < shortband2[1] and RSIndex2 < shortband2[1] then min(shortband2[1], newshortband2) else newshortband2;
def cross_2 = Crosses(longband2[1], RSIndex2, CrossingDirection.ANY);
def trend2 = if Crosses(RSIndex2, shortband2[1], CrossingDirection.ANY) then 1 else if cross_2 then -1 else if isNaN(trend2[1]) then 1 else trend2[1];
def FastAtrRsiTL2 = if trend2 == 1 then longband2 else shortband2;

# BB

def basis = SimpleMovingAvg(FastAtrRsiTL - 50, Bollinger_Length);
def dev = BB_Multiplier * stdev(FastAtrRsiTL - 50, Bollinger_Length);
def upper = basis + dev;
def lower = basis - dev;

# Ups and Downs
def Greenbar1 = RsiMa2 - 50 > Threshold2;
def Greenbar2 = RsiMa - 50 > upper;

def Redbar1 = RsiMa2 - 50 < 0 - Threshold2;
def Redbar2 = RsiMa - 50 < lower;
# Plots

plot Zero = 0;
Zero.SetDefaultColor(Color.black);

plot QQE_Line = FastAtrRsiTL2 - 50;
QQE_Line.SetDefaultColor(Color.black);
QQE_Line.SetLineWeight(2);
QQE_Line.hide();

plot Hist = RsiMa2 - 50;
Hist.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Hist.SetLineWeight(4);
Hist.AssignValueColor(
if Greenbar1 and Greenbar2 == 1 then CreateColor(0, 195, 255)
else if Redbar1 and Redbar2 == 1 then COLOR.RED
else if RsiMa2 - 50 > Threshold2 then Color.DARK_GRAY
else if RsiMa2 - 50 < 0 - Threshold2 then Color.DARK_GRAY
else Color.BLACK
);

addlabel(yes, “QQE”, if Greenbar1 and Greenbar2 == 1 then CreateColor(0, 195, 255) else if Redbar1 and Redbar2 == 1 then COLOR.RED else if RsiMa2 - 50 > Threshold2 then Color.DARK_GRAY else if RsiMa2 - 50 < 0 - Threshold2 then Color.DARK_GRAY else Color.BLACK);

########################
#NMACD

def na = Double.NaN;
input sma = 12;
input lma = 21;
input tsp = 9;
input np = 50;
input histo = yes;

input avg_type = AverageType.EXPONENTIAL;
def sh = MovingAverage(avg_type, close, sma);
def lon = MovingAverage(avg_type, close, lma);
# -------------------------------
def ratio = Min(sh, lon) / Max(sh, lon);
def Mac = If(sh > lon, 2 - ratio, ratio) - 1;

def MacNorm = ((Mac - Lowest(Mac, np)) / (Highest(Mac, np) - Lowest(Mac, np) + .000001) * 2) - 1;

def MacNorm2 = If(np < 2, Mac, MacNorm);

def Trigger = WMA(MacNorm2, tsp);

def HistNMACD = (MacNorm2 - Trigger);

def Hist2 = if HistNMACD > 1 then 1 else if HistNMACD < -1 then -1 else HistNMACD;

plot z1 = if histo then Hist2 else na;
z1.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
z1.AssignValueColor(if Hist2 > Hist2[1] then Color.GREEN else Color.RED);
z1.hide();

plot z2 = MacNorm2;
z2.SETDefaultColor(COLOR.BLACK);
#z2.hide();
plot z4 = Trigger;
z4.SetDefaultColor(Color.RED);
#z4.hide();
plot z = 0;
z.setDefaultColor(color.GRAY);
z.setLineWeight(2);
#z.hide();
submitted by JP782 to thinkorswim [link] [comments]


2022.09.15 02:10 shaghaiex Patterns: 3-bar-play by Jared Wesley @ LiveTraders - how to input?

So I saw this Jared Wesley video, checked some patterns and think it can be useful here and then.
I wanted to input it as own pattern, but ran into problem.
Rule is:
Stick 1: Green (wide range on increased volume)
Stick 2: Red, <50% of stick 1, similar open as stick 1
Stick 3: Green, open near stick 2 close, close higher than stick 2 high
Screenshot from the video:
3 Bar Play
In the wizard it looks like:

https://preview.redd.it/w2mhdf0qxwn91.png?width=1005&format=png&auto=webp&s=f39dfe8cb493626015a996bfb3b1dc89d5c1775d
In ThinkScript it is: (however can't edit in the wizard)
def IsUp = close > open; def IsDown = close < open; def IsDoji = IsDoji(); def avgRange = 0.05 * Average(high - low, 20); plot PatternPlot = IsUp[2] and IsDown[1] and IsUp[0] and open[2] < close[1] and open[1] < close[0] and Between(close[1] - open[0], -avgRange, avgRange) and close[2] == open[1]; PatternPlot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); PatternPlot.SetDefaultColor(GetColor(6)); 
This can't catch the wide range or increased volume, nor the <50% of stick 1 and more.
(There is also a 4 Bar Play and then the same in bearish).
How can I fine tune it?
And one general question, is there any notification possible other than seeing it on the chart I watch? Like, on a chart that I not currently watch.

Here is a little update what I could find from the web:

This script seems to work (I did some testing an do get the correct signals, needs a bit more backtesting)
And one more on the same topic - Needs probably some finetuning and some testing. But it's a start.


submitted by shaghaiex to thinkorswim [link] [comments]


2022.09.09 14:05 Soft_Video_9128 How to change aggregation period on this script...

I found the following script online. How do I set the aggregation period to 3 mins(to be used on the 1 min chart)? I've already looked up examples on how to do it online but my various attempts to change it failed.
Thanks in advance.
####################################################
# MACD_BB_REWRITE

# TS_MACD_BB
# By Eric Purdy, ThinkScripter LLC
# http://www.thinkscripter.com
# [[email protected]](mailto:[email protected])
# Last Update 07 Feb 2011
# https://usethinkscript.com/threads/macd-with-bollinger-bands-bb-indicator-for-thinkorswim.287/post-1632

declare lower;

input price = close;
input BBlength_A = 10;
input BBNum_Dev_A = 1.0;
input MACDfastLength_A = 12;
input MACDslowLength_A = 50;
input MACDLengthA = 9;

def MACD_Data = MACD(fastLength = MACDfastLength_A, slowLength = MACDslowLength_A, MACDLength = MACDLengthA);

plot MACD_Dots = MACD_Data;
plot MACD_Line = MACD_Data;

plot BB_Upper = reference BollingerBands(price = MACD_Line, length = BBlength_A, Num_Dev_Dn = -BBNum_Dev_A, Num_Dev_Up = BBNum_Dev_A).UpperBand;
plot BB_Lower = reference BollingerBands(price = MACD_Line, length = BBlength_A, Num_Dev_Dn = -BBNum_Dev_A, Num_Dev_Up = BBNum_Dev_A).Lowerband;
plot BB_Midline = reference BollingerBands(price = MACD_Line, length = BBlength_A, Num_Dev_Dn = -BBNum_Dev_A, Num_Dev_Up = BBNum_Dev_A).MidLine;

BB_Upper.SetDefaultColor(Color.GRAY);
BB_Lower.SetDefaultColor(Color.GRAY);
BB_Midline.SetDefaultColor(Color.GRAY);
BB_Midline.SetStyle(Curve.SHORT_DASH);


MACD_Line.AssignValueColor(if MACD_Line > MACD_Line[1] and MACD_Line >= BB_Upper then Color.GREEN else if MACD_Line < MACD_Line[1] and MACD_Line >= BB_Upper then Color.DARK_GREEN else if MACD_Line < MACD_Line[1] and MACD_Line <= BB_Lower then Color.RED else if MACD_Line > MACD_Line[1] and MACD_Line <= BB_Lower then Color.DARK_RED else Color.GRAY);
MACD_Line.SetLineWeight(1);

MACD_Dots.AssignValueColor(if MACD_Line > MACD_Line[1] and MACD_Line > BB_Upper then Color.GREEN else if MACD_Line < MACD_Line[1] and MACD_Line > BB_Upper then Color.DARK_GREEN else if MACD_Line < MACD_Line[1] and MACD_Line < BB_Lower then Color.RED else if MACD_Line > MACD_Line[1] and MACD_Line < BB_Lower then Color.DARK_RED else Color.GRAY);
MACD_Dots.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
MACD_Dots.SetLineWeight(2);

plot zero = 0;
zero.AssignValueColor(if MACD_Line < 0 then Color.RED else Color.GREEN);
zero.SetLineWeight(2);
submitted by Soft_Video_9128 to thinkorswim [link] [comments]


2022.07.27 17:51 JP782 QQE Mod Divergence?

Can someone help me out to make this version of QQE Mod show divergences on the oscillator and with price action similar to this indicator?
# QQE_Mod
declare lower;
Input Show_QlineCross = no;
input RSI_Length = 6;
input RSI_Smoothing = 5;
input Fast_QQE_Factor = 3.0;
input Threshold = 3;
input RSI_Source = close;
input RSI_Length2 = 6;
input RSI_Smoothing2 = 5;
input Fast_QQE_Factor2 = 1.61;
input Threshold2 = 3;
input RSI_Source2 = close;
input Bollinger_Length = 50;
input BB_Multiplier = 0.35; # min: 0.001, max: 5
# QQE 1
def Wilders_period = RSI_Length * 2 - 1;
def Rsi = RSI(price = RSI_Source, length = RSI_Length);
def RsiMa = MovAvgExponential(Rsi, RSI_Smoothing);
def AtrRsi = absValue(RsiMa[1] - RsiMa);
def MaAtrRsi = MovAvgExponential(AtrRsi, Wilders_Period);
def dar = MovAvgExponential(MaAtrRsi, Wilders_Period) * Fast_QQE_Factor;
def DeltaFastAtrRsi = dar;
def RSIndex = RsiMa;
def newshortband = RSIndex + DeltaFastAtrRsi;
def newlongband = RSIndex - DeltaFastAtrRsi;
def longband = if RSIndex[1] > longband[1] and RSIndex > longband[1] then max(longband[1], newlongband) else newlongband;
def shortband = if RSIndex[1] < shortband[1] and RSIndex < shortband[1] then min(shortband[1], newshortband) else newshortband;
def cross_1 = Crosses(longband[1], RSIndex, CrossingDirection.ANY);
def trend = if Crosses(RSIndex, shortband[1], CrossingDirection.ANY) then 1 else if cross_1 then -1 else if isNaN(trend[1]) then 1 else trend[1];
def FastAtrRsiTL = if trend == 1 then longband else shortband;
# QQE 2
def Wilders_period2 = RSI_Length2 * 2 - 1;
def Rsi2 = RSI(price = RSI_Source2, length = RSI_Length2);
def RsiMa2 = MovAvgExponential(Rsi2, RSI_Smoothing2);
def AtrRsi2 = absValue(RsiMa2[1] - RsiMa2);
def MaAtrRsi2 = MovAvgExponential(AtrRsi2, Wilders_Period2);
def dar2 = MovAvgExponential(MaAtrRsi2, Wilders_Period2) * Fast_QQE_Factor2;
def DeltaFastAtrRsi2 = dar2;
def RSIndex2 = RsiMa2;
def newshortband2 = RSIndex2 + DeltaFastAtrRsi2;
def newlongband2 = RSIndex2 - DeltaFastAtrRsi2;
def longband2 = if RSIndex2[1] > longband2[1] and RSIndex2 > longband2[1] then max(longband2[1], newlongband2) else newlongband2;
def shortband2 = if RSIndex2[1] < shortband2[1] and RSIndex2 < shortband2[1] then min(shortband2[1], newshortband2) else newshortband2;
def cross_2 = Crosses(longband2[1], RSIndex2, CrossingDirection.ANY);
def trend2 = if Crosses(RSIndex2, shortband2[1], CrossingDirection.ANY) then 1 else if cross_2 then -1 else if isNaN(trend2[1]) then 1 else trend2[1];
def FastAtrRsiTL2 = if trend2 == 1 then longband2 else shortband2;
# BB
def basis = SimpleMovingAvg(FastAtrRsiTL - 50, Bollinger_Length);
def dev = BB_Multiplier * stdev(FastAtrRsiTL - 50, Bollinger_Length);
def upper = basis + dev;
def lower = basis - dev;
# Ups and Downs
def Greenbar1 = RsiMa2 - 50 > Threshold2;
def Greenbar2 = RsiMa - 50 > upper;
def Redbar1 = RsiMa2 - 50 < 0 - Threshold2;
def Redbar2 = RsiMa - 50 < lower;
# Plots
plot Zero = 0;
Zero.SetDefaultColor(Color.black);
plot QQE_Line = FastAtrRsiTL2 - 50;
QQE_Line.SetDefaultColor(Color.black);
QQE_Line.SetLineWeight(2);
QQE_Line.hide();
plot Hist = RsiMa2 - 50;
Hist.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Hist.SetLineWeight(4);
Hist.AssignValueColor(
if Greenbar1 and Greenbar2 == 1 then CreateColor(0, 195, 255)
else if Redbar1 and Redbar2 == 1 then COLOR.RED
else if RsiMa2 - 50 > Threshold2 then Color.DARK_GRAY
else if RsiMa2 - 50 < 0 - Threshold2 then Color.DARK_GRAY
else Color.BLACK
);
submitted by JP782 to thinkorswim [link] [comments]


2022.07.22 02:36 JP782 Add Divergence to QQE Mod?

Hi new to the group hoping someone make this version of QQE Mod show divergences on the oscillator and with price action similar to this indicator?
# QQE_Mod
declare lower;
Input Show_QlineCross = no;
input RSI_Length = 6;
input RSI_Smoothing = 5;
input Fast_QQE_Factor = 3.0;
input Threshold = 3;
input RSI_Source = close;
input RSI_Length2 = 6;
input RSI_Smoothing2 = 5;
input Fast_QQE_Factor2 = 1.61;
input Threshold2 = 3;
input RSI_Source2 = close;
input Bollinger_Length = 50;
input BB_Multiplier = 0.35; # min: 0.001, max: 5
# QQE 1
def Wilders_period = RSI_Length * 2 - 1;
def Rsi = RSI(price = RSI_Source, length = RSI_Length);
def RsiMa = MovAvgExponential(Rsi, RSI_Smoothing);
def AtrRsi = absValue(RsiMa[1] - RsiMa);
def MaAtrRsi = MovAvgExponential(AtrRsi, Wilders_Period);
def dar = MovAvgExponential(MaAtrRsi, Wilders_Period) * Fast_QQE_Factor;
def DeltaFastAtrRsi = dar;
def RSIndex = RsiMa;
def newshortband = RSIndex + DeltaFastAtrRsi;
def newlongband = RSIndex - DeltaFastAtrRsi;
def longband = if RSIndex[1] > longband[1] and RSIndex > longband[1] then max(longband[1], newlongband) else newlongband;
def shortband = if RSIndex[1] < shortband[1] and RSIndex < shortband[1] then min(shortband[1], newshortband) else newshortband;
def cross_1 = Crosses(longband[1], RSIndex, CrossingDirection.ANY);
def trend = if Crosses(RSIndex, shortband[1], CrossingDirection.ANY) then 1 else if cross_1 then -1 else if isNaN(trend[1]) then 1 else trend[1];
def FastAtrRsiTL = if trend == 1 then longband else shortband;

# QQE 2
def Wilders_period2 = RSI_Length2 * 2 - 1;
def Rsi2 = RSI(price = RSI_Source2, length = RSI_Length2);
def RsiMa2 = MovAvgExponential(Rsi2, RSI_Smoothing2);
def AtrRsi2 = absValue(RsiMa2[1] - RsiMa2);
def MaAtrRsi2 = MovAvgExponential(AtrRsi2, Wilders_Period2);
def dar2 = MovAvgExponential(MaAtrRsi2, Wilders_Period2) * Fast_QQE_Factor2;
def DeltaFastAtrRsi2 = dar2;
def RSIndex2 = RsiMa2;
def newshortband2 = RSIndex2 + DeltaFastAtrRsi2;
def newlongband2 = RSIndex2 - DeltaFastAtrRsi2;
def longband2 = if RSIndex2[1] > longband2[1] and RSIndex2 > longband2[1] then max(longband2[1], newlongband2) else newlongband2;
def shortband2 = if RSIndex2[1] < shortband2[1] and RSIndex2 < shortband2[1] then min(shortband2[1], newshortband2) else newshortband2;
def cross_2 = Crosses(longband2[1], RSIndex2, CrossingDirection.ANY);
def trend2 = if Crosses(RSIndex2, shortband2[1], CrossingDirection.ANY) then 1 else if cross_2 then -1 else if isNaN(trend2[1]) then 1 else trend2[1];
def FastAtrRsiTL2 = if trend2 == 1 then longband2 else shortband2;
# BB
def basis = SimpleMovingAvg(FastAtrRsiTL - 50, Bollinger_Length);
def dev = BB_Multiplier * stdev(FastAtrRsiTL - 50, Bollinger_Length);
def upper = basis + dev;
def lower = basis - dev;
# Ups and Downs
def Greenbar1 = RsiMa2 - 50 > Threshold2;
def Greenbar2 = RsiMa - 50 > upper;
def Redbar1 = RsiMa2 - 50 < 0 - Threshold2;
def Redbar2 = RsiMa - 50 < lower;
# Plots
plot Zero = 0;
Zero.SetDefaultColor(Color.black);
plot QQE_Line = FastAtrRsiTL2 - 50;
QQE_Line.SetDefaultColor(Color.black);
QQE_Line.SetLineWeight(2);
QQE_Line.hide();
plot Hist = RsiMa2 - 50;
Hist.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Hist.SetLineWeight(4);
Hist.AssignValueColor(
if Greenbar1 and Greenbar2 == 1 then CreateColor(0, 195, 255)
else if Redbar1 and Redbar2 == 1 then COLOR.RED
else if RsiMa2 - 50 > Threshold2 then Color.DARK_GRAY
else if RsiMa2 - 50 < 0 - Threshold2 then Color.DARK_GRAY
else Color.BLACK);
submitted by JP782 to ThinkScript [link] [comments]


2022.06.28 21:59 nceyg ATR SetPaintingStrategy

How do you limit indicators to show just the last two days?
I'm using the linked script to plot the ATR. It helps me quickly look at charts to determine if a stop is appropriate. The study shows up every day muddying the chart.
How would you limit this to just showing two days' worth?
TIA
https://usethinkscript.com/threads/daily-atr-support-resistance-lines-for-thinkorswim.3633/post-35265
submitted by nceyg to thinkorswim [link] [comments]


2022.06.03 18:07 aidenpearcewd01 Help understand the ZigZag

Hello everybody, I'm a newbie to a thinkscript and i just find this script:
https://usethinkscript.com/threads/repainting-trend-reversal-for-thinkorswim.183/page-24

And i'm looking for a way to convert this to python script but i dont really understand the ZigZag in this script:
def EI = ZigZagHighLow("price h" = priceh, "price l" = pricel, "percentage reversal" = percentamount, "absolute reversal" = revAmount, "atr length" = atrlength, "atr reversal" = atrreversal); 
Following the docs it's said
absolute reversal is Additional value in dollars that can be added to the minimum price change and ATR change to increase the distance between swing points 
What does it's mean and why in the scripts it's set
revAmount = .05; 
submitted by aidenpearcewd01 to thinkorswim [link] [comments]