Mobius stated:why the change?
He obviously felt that V02 is faster and more accurate. I didn't see much of a change on my charts.# New faster Momentum Oscillator with outer band markers. New more accurate Squeeze indication.
Mobius stated:why the change?
He obviously felt that V02 is faster and more accurate. I didn't see much of a change on my charts.# New faster Momentum Oscillator with outer band markers. New more accurate Squeeze indication.
Interesting. Thank you. Whenever the signals (arrows) are good, I immediately wonder, "Does this repaint?" I am aware that this is a multi-time frame. ThanksThis is my attempt at a MTF squeeze histo for entry and exit, its not pretty BUT it works so far.
(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 for early entry are pretty good, you still have to confirm with trend etc [I use QQE MOD and NMACD both give very 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);
###########################################################
This is my attempt at a MTF squeeze histo for entry and exit, its not pretty BUT it works so far.
(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 for early entry are pretty good, you still have to confirm with trend etc [I use QQE MOD and NMACD both give very 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);
###########################################################
The arrows only show up on a chart with a 1-minute time period according to the default settings. If you need it to work on a time frame other than 1 minute, you must adjust the input settings.@JP782
I added this code completely, but not showing anything for me, could you share the shared link of this code if possible.
Thanks in advanace.
# Momentum Squeeze Multiple Aggregations
# Mobius
# V01.06.2011 Chat room discussion
#hint: Squeeze Label with directional color for both aggregations. Label is green when momentum is ascending, red when descending. User Input for separate Squeeze and Oscillator lenghts and Secondary Aggregation.
declare lower;
input Slength = 20; #hint Slength: Length for Squeeze
input Klength = 20; #hint Klength: Length for Oscillator
input SDmult = 2.0; #hint SDMult: Multiplier for Standard Deviation
input ATRmult = 1.5;#hint ATRmult: Multiplier for the Average True Range
input SecondaryAggregation = AggregationPeriod.Fifteen_Min;
def h = high;
def l = low;
def c = close;
def c2 = close(period = SecondaryAggregation)[1];
def h2 = high(period = SecondaryAggregation)[1];
def l2 = low(period = SecondaryAggregation)[1];
def K = (Highest(h, Klength) + Lowest(l, Klength)) /
2 + ExpAverage(c, Klength);
def K2 = (Highest(h2, Klength) + Lowest(l2, Klength)) /
2 + ExpAverage(c2, Klength);
plot Momo = Inertia(c - K / 2, Klength);
Momo.setPaintingStrategy(PaintingStrategy.Histogram);
Momo.setLineWeight(4);
Momo.assignValueColor(if Momo > Momo[1] and Momo > 0
then Color.Cyan
else if Momo > 0 and Momo < Momo[1]
then Color.Blue
else if Momo < 0 and Momo < Momo[1]
then Color.Red
else Color.Yellow);
plot Momo2 = Inertia(c2 - K2 / 2, Klength);
Momo2.setPaintingStrategy(PaintingStrategy.Line);
Momo2.setLineWeight(2);
Momo2.assignValueColor(if Momo2 > Momo2[1] and Momo2 > 0
then Color.Cyan
else if Momo2 > 0 and Momo2 < Momo2[1]
then Color.Blue
else if Momo2 < 0 and Momo2 < Momo2[1]
then Color.Red
else Color.Yellow);
def SD = StDev(c, Slength);
def Avg = Average(c, Slength);
def ATR = Average(TrueRange(h, c, l), Slength);
def SDup = Avg + (SdMult * Sd);
def ATRup = Avg + (AtrMult * ATR);
def Pointlocation = Round(HighestAll(Momo) *1.1, 0);
plot Squeeze = if SDup < ATRup
then pointLocation
else Double.NaN;
Squeeze.SetPaintingStrategy(PaintingStrategy.Points);
Squeeze.SetLineWeight(4);
Squeeze.SetDefaultColor(Color.Red);
plot zero = if IsNaN(c)
then Double.NaN
else 0;
zero.SetPaintingStrategy(PaintingStrategy.line);
zero.SetLineWeight(1);
zero.SetDefaultColor(Color.gray);
def SD2 = StDev(c2, Slength);
def Avg2 = Average(c2, Slength);
def ATR2 = Average(TrueRange(h2, c2, l2), Slength);
def SDup2 = Avg2 + (SdMult * SD2);
def ATRup2 = Avg2 + (AtrMult * ATR2);
plot Squeeze2 = if SDup2 < ATRup2
then if isNaN(c) then double.nan else PointLocation * 1.10
else Double.NaN;
Squeeze2.SetPaintingStrategy(PaintingStrategy.Points);
Squeeze2.SetLineWeight(4);
Squeeze2.SetDefaultColor(Color.Red);
def aggregation = SecondaryAggregation / 1000 / 60;
AddLabel(!isNaN(Squeeze), "Squeeze On Chart Aggregation", if isAscending(Momo)
then Color.Green
else Color.Red);
AddLabel(!isNaN(Squeeze2), "Squeeze On " + Aggregation + " Min. Aggregation", if isAscending(Momo2)
then Color.Green
else Color.Red);
# End Code - Momentum Squeeze
I found Mobius' MTF Momentum Squeeze in the OneNote that plots a secondary aggregation squeeze histogram as a line on top of the normal histogram. The increasing portion of the line correctly matches the color of the higher time frame histogram, however, the horizontal line portion of the line plot always displays as yellow, (instead of matching the correct color) no matter if the histogram is increasing or decreasing. Does anyone know how to fix the assignvaluecolor statement so that the line color matches? (For example in the screen shot, the increasing histogram line above 0 is both cyan and yellow, decreasing above 0 is both blue and yellow, and decreasing below 0 is both red and yellow). Screen shot below is SPX from today on a 5m chart with 15m higher aggregation. Thanks!
Ruby:# Momentum Squeeze Multiple Aggregations # Mobius # V01.06.2011 Chat room discussion #hint: Squeeze Label with directional color for both aggregations. Label is green when momentum is ascending, red when descending. User Input for separate Squeeze and Oscillator lenghts and Secondary Aggregation. declare lower; input Slength = 20; #hint Slength: Length for Squeeze input Klength = 20; #hint Klength: Length for Oscillator input SDmult = 2.0; #hint SDMult: Multiplier for Standard Deviation input ATRmult = 1.5;#hint ATRmult: Multiplier for the Average True Range input SecondaryAggregation = AggregationPeriod.Fifteen_Min; def h = high; def l = low; def c = close; def c2 = close(period = SecondaryAggregation)[1]; def h2 = high(period = SecondaryAggregation)[1]; def l2 = low(period = SecondaryAggregation)[1]; def K = (Highest(h, Klength) + Lowest(l, Klength)) / 2 + ExpAverage(c, Klength); def K2 = (Highest(h2, Klength) + Lowest(l2, Klength)) / 2 + ExpAverage(c2, Klength); plot Momo = Inertia(c - K / 2, Klength); Momo.setPaintingStrategy(PaintingStrategy.Histogram); Momo.setLineWeight(4); Momo.assignValueColor(if Momo > Momo[1] and Momo > 0 then Color.Cyan else if Momo > 0 and Momo < Momo[1] then Color.Blue else if Momo < 0 and Momo < Momo[1] then Color.Red else Color.Yellow); plot Momo2 = Inertia(c2 - K2 / 2, Klength); Momo2.setPaintingStrategy(PaintingStrategy.Line); Momo2.setLineWeight(2); Momo2.assignValueColor(if Momo2 > Momo2[1] and Momo2 > 0 then Color.Cyan else if Momo2 > 0 and Momo2 < Momo2[1] then Color.Blue else if Momo2 < 0 and Momo2 < Momo2[1] then Color.Red else Color.Yellow); def SD = StDev(c, Slength); def Avg = Average(c, Slength); def ATR = Average(TrueRange(h, c, l), Slength); def SDup = Avg + (SdMult * Sd); def ATRup = Avg + (AtrMult * ATR); def Pointlocation = Round(HighestAll(Momo) *1.1, 0); plot Squeeze = if SDup < ATRup then pointLocation else Double.NaN; Squeeze.SetPaintingStrategy(PaintingStrategy.Points); Squeeze.SetLineWeight(4); Squeeze.SetDefaultColor(Color.Red); plot zero = if IsNaN(c) then Double.NaN else 0; zero.SetPaintingStrategy(PaintingStrategy.line); zero.SetLineWeight(1); zero.SetDefaultColor(Color.gray); def SD2 = StDev(c2, Slength); def Avg2 = Average(c2, Slength); def ATR2 = Average(TrueRange(h2, c2, l2), Slength); def SDup2 = Avg2 + (SdMult * SD2); def ATRup2 = Avg2 + (AtrMult * ATR2); plot Squeeze2 = if SDup2 < ATRup2 then if isNaN(c) then double.nan else PointLocation * 1.10 else Double.NaN; Squeeze2.SetPaintingStrategy(PaintingStrategy.Points); Squeeze2.SetLineWeight(4); Squeeze2.SetDefaultColor(Color.Red); def aggregation = SecondaryAggregation / 1000 / 60; AddLabel(!isNaN(Squeeze), "Squeeze On Chart Aggregation", if isAscending(Momo) then Color.Green else Color.Red); AddLabel(!isNaN(Squeeze2), "Squeeze On " + Aggregation + " Min. Aggregation", if isAscending(Momo2) then Color.Green else Color.Red); # End Code - Momentum Squeeze
Code:# Momentum Squeeze Multiple Aggregations # Mobius # V01.06.2011 Chat room discussion #hint: Squeeze Label with directional color for both aggregations. Label is green when momentum is ascending, red when descending. User Input for separate Squeeze and Oscillator lenghts and Secondary Aggregation. declare lower; input Slength = 20; #hint Slength: Length for Squeeze input Klength = 20; #hint Klength: Length for Oscillator input SDmult = 2.0; #hint SDMult: Multiplier for Standard Deviation input ATRmult = 1.5;#hint ATRmult: Multiplier for the Average True Range input SecondaryAggregation = AggregationPeriod.Fifteen_Min; def h = high; def l = low; def c = close; def c2 = close(period = SecondaryAggregation); def h2 = high(period = SecondaryAggregation); def l2 = low(period = SecondaryAggregation); def K = (Highest(h, Klength) + Lowest(l, Klength)) / 2 + ExpAverage(c, Klength); def K2 = (Highest(h2, Klength) + Lowest(l2, Klength)) / 2 + ExpAverage(c2, Klength); plot Momo = Inertia(c - K / 2, Klength); Momo.setPaintingStrategy(PaintingStrategy.Histogram); Momo.setLineWeight(4); Momo.assignValueColor(if Momo >= Momo[1] and Momo > 0 then Color.Cyan else if Momo > 0 and Momo < Momo[1] then Color.Blue else if Momo < 0 and Momo < Momo[1] then Color.Red else Color.Yellow); plot Momo2 = Inertia(c2 - K2 / 2, Klength); Momo2.setPaintingStrategy(PaintingStrategy.LINE_VS_SQUARES); Momo2.setLineWeight(5); Momo2.assignValueColor(if Momo2 >= Momo2[1] and Momo2 >= 0 then Color.Cyan else if Momo2 > 0 and Momo2 <= Momo2[1] then Color.Blue else if Momo2 <= 0 and Momo2 <= Momo2[1] then Color.Red else Color.Yellow); def SD = StDev(c, Slength); def Avg = Average(c, Slength); def ATR = Average(TrueRange(h, c, l), Slength); def SDup = Avg + (SdMult * Sd); def ATRup = Avg + (AtrMult * ATR); def Pointlocation = Round(HighestAll(Momo) *1.1, 0); plot Squeeze = if SDup < ATRup then pointLocation else Double.NaN; Squeeze.SetPaintingStrategy(PaintingStrategy.Points); Squeeze.SetLineWeight(4); Squeeze.SetDefaultColor(Color.Red); plot zero = if IsNaN(c) then Double.NaN else 0; zero.SetPaintingStrategy(PaintingStrategy.line); zero.SetLineWeight(1); zero.SetDefaultColor(Color.gray); def SD2 = StDev(c2, Slength); def Avg2 = Average(c2, Slength); def ATR2 = Average(TrueRange(h2, c2, l2), Slength); def SDup2 = Avg2 + (SdMult * SD2); def ATRup2 = Avg2 + (AtrMult * ATR2); plot Squeeze2 = if SDup2 < ATRup2 then if isNaN(c) then double.nan else PointLocation * 1.10 else Double.NaN; Squeeze2.SetPaintingStrategy(PaintingStrategy.Points); Squeeze2.SetLineWeight(4); Squeeze2.SetDefaultColor(Color.Red); def aggregation = SecondaryAggregation / 1000 / 60; AddLabel(!isNaN(Squeeze), "Squeeze On Chart Aggregation", if isAscending(Momo) then Color.Green else Color.Red); AddLabel(!isNaN(Squeeze2), "Squeeze On " + Aggregation + " Min. Aggregation", if isAscending(Momo2) then Color.Green else Color.Red); # End Code - Momentum Squeeze
I found Mobius' MTF Momentum Squeeze in the OneNote that plots a secondary aggregation squeeze histogram as a line on top of the normal histogram. The increasing portion of the line correctly matches the color of the higher time frame histogram, however, the horizontal line portion of the line plot always displays as yellow, (instead of matching the correct color) no matter if the histogram is increasing or decreasing. Does anyone know how to fix the assignvaluecolor statement so that the line color matches? (For example in the screen shot, the increasing histogram line above 0 is both cyan and yellow, decreasing above 0 is both blue and yellow, and decreasing below 0 is both red and yellow). Screen shot below is SPX from today on a 5m chart with 15m higher aggregation. Thanks!
Ruby:# Momentum Squeeze Multiple Aggregations # Mobius # V01.06.2011 Chat room discussion #hint: Squeeze Label with directional color for both aggregations. Label is green when momentum is ascending, red when descending. User Input for separate Squeeze and Oscillator lenghts and Secondary Aggregation. declare lower; input Slength = 20; #hint Slength: Length for Squeeze input Klength = 20; #hint Klength: Length for Oscillator input SDmult = 2.0; #hint SDMult: Multiplier for Standard Deviation input ATRmult = 1.5;#hint ATRmult: Multiplier for the Average True Range input SecondaryAggregation = AggregationPeriod.Fifteen_Min; def h = high; def l = low; def c = close; def c2 = close(period = SecondaryAggregation)[1]; def h2 = high(period = SecondaryAggregation)[1]; def l2 = low(period = SecondaryAggregation)[1]; def K = (Highest(h, Klength) + Lowest(l, Klength)) / 2 + ExpAverage(c, Klength); def K2 = (Highest(h2, Klength) + Lowest(l2, Klength)) / 2 + ExpAverage(c2, Klength); plot Momo = Inertia(c - K / 2, Klength); Momo.setPaintingStrategy(PaintingStrategy.Histogram); Momo.setLineWeight(4); Momo.assignValueColor(if Momo > Momo[1] and Momo > 0 then Color.Cyan else if Momo > 0 and Momo < Momo[1] then Color.Blue else if Momo < 0 and Momo < Momo[1] then Color.Red else Color.Yellow); plot Momo2 = Inertia(c2 - K2 / 2, Klength); Momo2.setPaintingStrategy(PaintingStrategy.Line); Momo2.setLineWeight(2); Momo2.assignValueColor(if Momo2 > Momo2[1] and Momo2 > 0 then Color.Cyan else if Momo2 > 0 and Momo2 < Momo2[1] then Color.Blue else if Momo2 < 0 and Momo2 < Momo2[1] then Color.Red else Color.Yellow); def SD = StDev(c, Slength); def Avg = Average(c, Slength); def ATR = Average(TrueRange(h, c, l), Slength); def SDup = Avg + (SdMult * Sd); def ATRup = Avg + (AtrMult * ATR); def Pointlocation = Round(HighestAll(Momo) *1.1, 0); plot Squeeze = if SDup < ATRup then pointLocation else Double.NaN; Squeeze.SetPaintingStrategy(PaintingStrategy.Points); Squeeze.SetLineWeight(4); Squeeze.SetDefaultColor(Color.Red); plot zero = if IsNaN(c) then Double.NaN else 0; zero.SetPaintingStrategy(PaintingStrategy.line); zero.SetLineWeight(1); zero.SetDefaultColor(Color.gray); def SD2 = StDev(c2, Slength); def Avg2 = Average(c2, Slength); def ATR2 = Average(TrueRange(h2, c2, l2), Slength); def SDup2 = Avg2 + (SdMult * SD2); def ATRup2 = Avg2 + (AtrMult * ATR2); plot Squeeze2 = if SDup2 < ATRup2 then if isNaN(c) then double.nan else PointLocation * 1.10 else Double.NaN; Squeeze2.SetPaintingStrategy(PaintingStrategy.Points); Squeeze2.SetLineWeight(4); Squeeze2.SetDefaultColor(Color.Red); def aggregation = SecondaryAggregation / 1000 / 60; AddLabel(!isNaN(Squeeze), "Squeeze On Chart Aggregation", if isAscending(Momo) then Color.Green else Color.Red); AddLabel(!isNaN(Squeeze2), "Squeeze On " + Aggregation + " Min. Aggregation", if isAscending(Momo2) then Color.Green else Color.Red); # End Code - Momentum Squeeze
#mod2
#set a var = # depending on last chg
#ref it in assigncolor
def colornum =
# above+ , cyan = 1
if Momo2 > 0 and Momo2 > Momo2[1] then 1
# above- , blue=2
else if Momo2 > 0 and Momo2 < Momo2[1] then 2
# below- , red=3
else if Momo2 < 0 and Momo2 < Momo2[1] then 3
# below+ , yellow=4
else if Momo2 < 0 and Momo2 > Momo2[1] then 4
else colornum[1];
Momo2.assignValueColor(
if colornum = 1 then Color.Cyan
else if colornum = 2 then Color.Blue
else if colornum = 3 then Color.Red
else Color.Yellow);
Is there any way to add red and green dots to version 2, and perhaps trigger arrows?MOBIUS MOMENTUM SQUEEZE V02 dated 4/1/2020
@Jonas99 shared this on Discord. He provided this image with the comparison of the indicator which is the one on the very bottom.Ruby:# Momentum Squeeze V02 # Mobius # V02.04.01.2020 # New faster Momentum Oscillator with outer band markers. New more accurate Squeeze indication. declare lower; input n = 20; def c = close; def mean = Inertia(c, n); def SD = Sqrt((fold i = 0 to n with s do s + Sqr(mean - GetValue(c, i))) / n); plot Momo = Inertia((c - mean) / SD, Floor(n )); Momo.SetPaintingStrategy(PaintingStrategy.HISTOGRAM); Momo.assignValueColor(if Momo > Momo[1] and Momo > 0 then Color.Cyan else if Momo > 0 and Momo < Momo[1] then Color.Blue else if Momo < 0 and Momo < Momo[1] then Color.dark_Red else Color.Yellow); def upper = mean + (2 * SD); def lower = mean - (2 * SD); def W = (upper - lower) / mean; def B = Highest(W, n * 2); def Sq = Lowest(W, n * 2); plot Squeeze = if ((W - Sq) / (B - Sq)) <= .01 then 0 else Double.NaN; Squeeze.SetStyle(Curve.POINTS); Squeeze.SetLineWeight(3); Squeeze.SetDefaultColor(Color.YELLOW); AddLabel(Squeeze, "Squeeze", Color.YELLOW); plot "0" = if !IsNaN(Squeeze) or IsNaN(c) then Double.NaN else 0; "0".SetStyle(Curve.Points); "0".SetDefaultColor(Color.GRAY); plot "1" = if IsNaN(c) then Double.NaN else 1; "1".SetDefaultColor(Color.GREEN); plot "-1" = if IsNaN(c) then Double.NaN else -1; "-1".SetDefaultColor(Color.dark_RED); # End Code V02 Momentum Squeeze
View attachment 821
#hint:test test test test
declare lower;
input Slength = 20; #hint Slength: Length for Squeeze
input Klength = 20; #hint Klength: Length for Oscillator
input price = close;
input SDmult = 2.0;
input ATRmult = 1.5;
def K = (Highest(high, Klength) + Lowest(low, Klength)) /
2 + ExpAverage(close, Klength);
plot Momo = Inertia(price - K / 2, Klength);
Momo.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Momo.SetLineWeight(3);
Momo.AssignValueColor(if Momo > Momo[1] and Momo > 0
then Color.CYAN
else if Momo > 0 and Momo < Momo[1]
then Color.BLUE
else if Momo < 0 and Momo < Momo[1]
then Color.RED
else Color.YELLOW);
def SD = StDev(close, Slength);
def Avg = Average(close, Slength);
def ATR = Average(TrueRange(high, close, low), Slength);
def SDup = Avg + (SDmult * SD);
def ATRup = Avg + (ATRmult * ATR);
plot Squeeze = if SDup < ATRup
then 0
else Double.NaN;
Squeeze.SetPaintingStrategy(PaintingStrategy.POINTS);
Squeeze.SetLineWeight(3);
Squeeze.SetDefaultColor(Color.RED);
plot zero = if IsNaN(close) or !IsNaN(Squeeze) then Double.NaN else 0;
zero.SetPaintingStrategy(PaintingStrategy.POINTS);
zero.SetLineWeight(3);
zero.SetDefaultColor(Color.GREEN);
AddLabel(!IsNaN(Squeeze), "Squeeze", if IsAscending(Momo)
then Color.GREEN
else Color.RED);
# End Code - Momentum Squeeze
Yes, MTF indicators repaint. MTF arrows repaint@JP782 does the code you posted repaint or are the arrows that show up on the chart permanent? Thanks.
GREAT STUFFF in this thread!!!
MOBIUS MOMENTUM SQUEEZE V02 dated 4/1/2020
@Jonas99 shared this on Discord. He provided this image with the comparison of the indicator which is the one on the very bottom.Ruby:# Momentum Squeeze V02 # Mobius # V02.04.01.2020 # New faster Momentum Oscillator with outer band markers. New more accurate Squeeze indication. declare lower; input n = 20; def c = close; def mean = Inertia(c, n); def SD = Sqrt((fold i = 0 to n with s do s + Sqr(mean - GetValue(c, i))) / n); plot Momo = Inertia((c - mean) / SD, Floor(n )); Momo.SetPaintingStrategy(PaintingStrategy.HISTOGRAM); Momo.assignValueColor(if Momo > Momo[1] and Momo > 0 then Color.Cyan else if Momo > 0 and Momo < Momo[1] then Color.Blue else if Momo < 0 and Momo < Momo[1] then Color.dark_Red else Color.Yellow); def upper = mean + (2 * SD); def lower = mean - (2 * SD); def W = (upper - lower) / mean; def B = Highest(W, n * 2); def Sq = Lowest(W, n * 2); plot Squeeze = if ((W - Sq) / (B - Sq)) <= .01 then 0 else Double.NaN; Squeeze.SetStyle(Curve.POINTS); Squeeze.SetLineWeight(3); Squeeze.SetDefaultColor(Color.YELLOW); AddLabel(Squeeze, "Squeeze", Color.YELLOW); plot "0" = if !IsNaN(Squeeze) or IsNaN(c) then Double.NaN else 0; "0".SetStyle(Curve.Points); "0".SetDefaultColor(Color.GRAY); plot "1" = if IsNaN(c) then Double.NaN else 1; "1".SetDefaultColor(Color.GREEN); plot "-1" = if IsNaN(c) then Double.NaN else -1; "-1".SetDefaultColor(Color.dark_RED); # End Code V02 Momentum Squeeze
View attachment 821
I've searched around, but didn't turn up anything. Would anyone be able to point me to the scripts that appear in the @Jonas99 screenshot shared by @MerryDay?
- MACD_SHAFF_MerryDay
- Better_MACD_Sq_Mo
- Momentum_of_Delta_Price_Mo - This is the MOBIUS MOMENTUM SQUEEZE V02 in @MerryDay's message?
- Theo_ ORHL
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
S | Mobius Squeeze and Custom Labels For ThinkOrSwim | Indicators | 54 | |
Mobius Volume Waves for ThinkorSwim | Indicators | 44 | ||
Repaints Mobius Full Stochastic MTF for ThinkorSwim | Indicators | 4 | ||
Trend Pivot Points Indicator by Mobius For ThinkOrSwim | Indicators | 85 | ||
Mobius (Demarks Pivot and Demarks MA) for ThinkorSwim | Indicators | 6 |
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.