Break Price Momentum BPM For ThinkOrSwim

don't get wrong I know you trying to help and appreciate a lot believe me! what do you think about this line here, can be possible to create this more dynamic, the signal every time increase 0.5 show another signal, right now looks to manual?

Code:
plot ext1 = if mSig crosses above obL1 or mSig crosses below -obL1 then mSig else
            if mSig crosses above obL2 or mSig crosses below -obL2 then mSig else
            if mSig crosses above obL3 or mSig crosses below -obL3 then mSig else
            if mSig crosses above obL4 or mSig crosses below -obL4 then mSig else Double.NaN;
Alright, here you go. Automatically calculates the crossing of overbought/oversold levels in 0.5 increments. The increment is a variable so you can change it.

I also added an option to look forward or not. You can turn that on to go back to your original implementation. Added hints, etc. Variable names can be cleaned up, but it is all cosmetic at that point.

Code:
# Break Price Momentum, BPM by mbarcala and usethinkscript.com on 12/21/21(9)
# StochasticFull

# 20211229 - barbaros - rework
# 20211230 - barbaros - added autmatic calculation of obL dots
# 20211230 - barbaros - added option to look forward and hints

declare lower;

input highLowLookback = 17; #HINT highLowLookback: Look back period for highs and lows
input movAvgLength = 6; #HINT movAvgLength: Length used in exponential moving average
input lookForward = no; #HINT lookForward: Look forward to remove non confirmed signals. If turned on, might repaint.

def slength = 20;
def mLev = 1.1;
def trendL = 0.3;
def obL1 = 1.8;
def obLStep = 0.5;
def nDev = 2.0;

def AvgExp = ExpAverage(close, slength);
def UpSignal = close crosses above AvgExp;
def DnSignal = close crosses below AvgExp;
def SignUpDn = UpSignal or DnSignal;

def lowest_k = Lowest(low, highLowLookback);
def c1 = close - lowest_k;
def c2 = Highest(high, highLowLookback) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;

def FullK = MovAvgExponential(FastK, movAvgLength);
def FullD = Max(-100, Min(100, (MovAvgExponential(FullK, 1))) - 50) / 50;
def flen = 0.5 * (Log((1 + FullD) / (1 - FullD)) + flen[1]);

plot mSig = flen;
mSig.SetDefaultColor(Color.MAGENTA);
mSig.SetLineWeight(2);
mSig.HideBubble();
mSig.HideTitle();

AddCloud(mSig,  0,  Color.DARK_GREEN,  Color.CURRENT);
AddCloud(mSig, 0, Color.CURRENT, Color.DARK_RED);
AddCloud(mSig,  mLev,  Color.GREEN,  CreateColor(27, 27, 27));
AddCloud(mSig, -mLev, CreateColor(27, 27, 27), Color.RED);

plot cLine = 0;
cLine.SetPaintingStrategy(PaintingStrategy.LINE);
cLine.SetDefaultColor(Color.GRAY);
cLine.SetLineWeight(2);
cLine.HideTitle();

plot oBl = mLev;
oBl.SetPaintingStrategy(PaintingStrategy.LINE);
oBl.SetDefaultColor(CreateColor(0, 155, 255));
oBl.SetLineWeight(1);
oBl.HideTitle();

plot oSl = -mLev;
oSl.SetPaintingStrategy(PaintingStrategy.LINE);
oSl.SetDefaultColor(CreateColor(0, 155, 255));
oSl.SetLineWeight(1);
oSl.HideTitle();

############### Price Crossing Level ################
plot upArrow = if mSig crosses above 0 then mSig else Double.NaN;
upArrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
upArrow.SetDefaultColor(Color.GREEN);
upArrow.SetLineWeight(3);
upArrow.HideBubble();
upArrow.HideTitle();

plot dnArrow = if mSig crosses below 0 then mSig else Double.NaN;
dnArrow.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
dnArrow.SetDefaultColor(Color.RED);
dnArrow.SetLineWeight(3);
dnArrow.HideBubble();
dnArrow.HideTitle();

############### Signal Reversal ################
plot trendUp = if mSig crosses above mSig[1] and mSig[1] > trendL[1] then mSig else Double.NaN;
trendUp.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
trendUp.SetDefaultColor(Color.CYAN);
trendUp.SetLineWeight(1);
trendUp.HideBubble();
trendUp.HideTitle();
#--------------
plot trendDn = if mSig crosses below mSig[1] and mSig[1] < -trendL[1] then mSig else Double.NaN;
trendDn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
trendDn.SetDefaultColor(Color.CYAN);
trendDn.SetLineWeight(1);
trendDn.HideBubble();
trendDn.HideTitle();

############## Exit Levels #################
def extValue = if msig >= obL1 then RoundDown((msig - obL1) / obLStep, 0) + 1 else if msig <= -obL1 then RoundDown((-obL1 - msig) / obLStep, 0) + 1 else 0;
plot exts = if extValue > 0 and extValue[1] != extValue then mSig else Double.NaN;
exts.SetPaintingStrategy(PaintingStrategy.POINTS);
exts.SetDefaultColor(CreateColor(255,255,0));
exts.SetLineWeight(5);
exts.HideBubble();
exts.HideTitle();

############## Vertical Lines #################
AddVerticalLine(if lookForward then UpSignal and !SignUpDn[-1] else UpSignal and !UpSignal[1], "Up", Color.GREEN, Curve.SHORT_DASH);
AddVerticalLine(if lookForward then DnSignal and !SignUpDn[-1] else DnSignal and !UpSignal[1], "Down", Color.RED, Curve.SHORT_DASH);

########## BB Squeeze ###########
def sDev = StDev(data = close, slength);
def MidLine = MovingAverage(averageType = AverageType.EXPONENTIAL, data = close, slength);
def LowerBand = MidLine + -nDev * sDev;
def UpperBand = MidLine + nDev * sDev;

def shhigh = 1.0 * MovAvgExponential(TrueRange(high, close, low), slength);
def shMid = 1.5 * MovAvgExponential(TrueRange(high, close, low), slength);
def shlow = 2.0 * MovAvgExponential(TrueRange(high, close, low), slength);
def average =  MovAvgExponential(close, slength);

def UpperBandKCLow = average + shlow;
def LowerBandKCLow = average - shlow;
def UpperBandKCMid = average + shMid;
def LowerBandKCMid = average - shMid;
def UpperBandKCHigh = average + shhigh;
def LowerBandKCHigh = average - shhigh;

def preSqueeze = LowerBand > LowerBandKCLow and UpperBand < UpperBandKCLow;
def oriSqueeze = LowerBand > LowerBandKCMid and UpperBand < UpperBandKCMid;
def ExtSqueeze = LowerBand > LowerBandKCHigh and UpperBand < UpperBandKCHigh;

plot squeezeline = if ExtSqueeze or oriSqueeze or preSqueeze then 0 else Double.NaN;
squeezeline.AssignValueColor(if ExtSqueeze then Color.ORANGE else if oriSqueeze then Color.RED else if preSqueeze then Color.BLACK else Color.GREEN);
squeezeline.SetPaintingStrategy(PaintingStrategy.POINTS);
squeezeline.SetLineWeight(4);
squeezeline.HideTitle();
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Alright, here you go. Automatically calculates the crossing of overbought/oversold levels in 0.5 increments. The increment is a variable so you can change it.

I also added an option to look forward or not. You can turn that on to go back to your original implementation. Added hints, etc. Variable names can be cleaned up, but it is all cosmetic at that point.

Code:
# Break Price Momentum, BPM by mbarcala and usethinkscript.com on 12/21/21(9)
# StochasticFull

# 20211229 - barbaros - rework
# 20211230 - barbaros - added autmatic calculation of obL dots
# 20211230 - barbaros - added option to look forward and hints

declare lower;

input highLowLookback = 17; #HINT highLowLookback: Look back period for highs and lows
input movAvgLength = 6; #HINT movAvgLength: Length used in exponential moving average
input lookForward = no; #HINT lookForward: Look forward to remove non confirmed signals. If turned on, might repaint.

def slength = 20;
def mLev = 1.1;
def trendL = 0.3;
def obL1 = 1.8;
def obLStep = 0.5;
def nDev = 2.0;

def AvgExp = ExpAverage(close, slength);
def UpSignal = close crosses above AvgExp;
def DnSignal = close crosses below AvgExp;
def SignUpDn = UpSignal or DnSignal;

def lowest_k = Lowest(low, highLowLookback);
def c1 = close - lowest_k;
def c2 = Highest(high, highLowLookback) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;

def FullK = MovAvgExponential(FastK, movAvgLength);
def FullD = Max(-100, Min(100, (MovAvgExponential(FullK, 1))) - 50) / 50;
def flen = 0.5 * (Log((1 + FullD) / (1 - FullD)) + flen[1]);

plot mSig = flen;
mSig.SetDefaultColor(Color.MAGENTA);
mSig.SetLineWeight(2);
mSig.HideBubble();
mSig.HideTitle();

AddCloud(mSig,  0,  Color.DARK_GREEN,  Color.CURRENT);
AddCloud(mSig, 0, Color.CURRENT, Color.DARK_RED);
AddCloud(mSig,  mLev,  Color.GREEN,  CreateColor(27, 27, 27));
AddCloud(mSig, -mLev, CreateColor(27, 27, 27), Color.RED);

plot cLine = 0;
cLine.SetPaintingStrategy(PaintingStrategy.LINE);
cLine.SetDefaultColor(Color.GRAY);
cLine.SetLineWeight(2);
cLine.HideTitle();

plot oBl = mLev;
oBl.SetPaintingStrategy(PaintingStrategy.LINE);
oBl.SetDefaultColor(CreateColor(0, 155, 255));
oBl.SetLineWeight(1);
oBl.HideTitle();

plot oSl = -mLev;
oSl.SetPaintingStrategy(PaintingStrategy.LINE);
oSl.SetDefaultColor(CreateColor(0, 155, 255));
oSl.SetLineWeight(1);
oSl.HideTitle();

############### Price Crossing Level ################
plot upArrow = if mSig crosses above 0 then mSig else Double.NaN;
upArrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
upArrow.SetDefaultColor(Color.GREEN);
upArrow.SetLineWeight(3);
upArrow.HideBubble();
upArrow.HideTitle();

plot dnArrow = if mSig crosses below 0 then mSig else Double.NaN;
dnArrow.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
dnArrow.SetDefaultColor(Color.RED);
dnArrow.SetLineWeight(3);
dnArrow.HideBubble();
dnArrow.HideTitle();

############### Signal Reversal ################
plot trendUp = if mSig crosses above mSig[1] and mSig[1] > trendL[1] then mSig else Double.NaN;
trendUp.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
trendUp.SetDefaultColor(Color.CYAN);
trendUp.SetLineWeight(1);
trendUp.HideBubble();
trendUp.HideTitle();
#--------------
plot trendDn = if mSig crosses below mSig[1] and mSig[1] < -trendL[1] then mSig else Double.NaN;
trendDn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
trendDn.SetDefaultColor(Color.CYAN);
trendDn.SetLineWeight(1);
trendDn.HideBubble();
trendDn.HideTitle();

############## Exit Levels #################
def extValue = if msig >= obL1 then RoundDown((msig - obL1) / obLStep, 0) + 1 else if msig <= -obL1 then RoundDown((-obL1 - msig) / obLStep, 0) + 1 else 0;
plot exts = if extValue > 0 and extValue[1] != extValue then mSig else Double.NaN;
exts.SetPaintingStrategy(PaintingStrategy.POINTS);
exts.SetDefaultColor(CreateColor(255,255,0));
exts.SetLineWeight(5);
exts.HideBubble();
exts.HideTitle();

############## Vertical Lines #################
AddVerticalLine(if lookForward then UpSignal and !SignUpDn[-1] else UpSignal and !UpSignal[1], "Up", Color.GREEN, Curve.SHORT_DASH);
AddVerticalLine(if lookForward then DnSignal and !SignUpDn[-1] else DnSignal and !UpSignal[1], "Down", Color.RED, Curve.SHORT_DASH);

########## BB Squeeze ###########
def sDev = StDev(data = close, slength);
def MidLine = MovingAverage(averageType = AverageType.EXPONENTIAL, data = close, slength);
def LowerBand = MidLine + -nDev * sDev;
def UpperBand = MidLine + nDev * sDev;

def shhigh = 1.0 * MovAvgExponential(TrueRange(high, close, low), slength);
def shMid = 1.5 * MovAvgExponential(TrueRange(high, close, low), slength);
def shlow = 2.0 * MovAvgExponential(TrueRange(high, close, low), slength);
def average =  MovAvgExponential(close, slength);

def UpperBandKCLow = average + shlow;
def LowerBandKCLow = average - shlow;
def UpperBandKCMid = average + shMid;
def LowerBandKCMid = average - shMid;
def UpperBandKCHigh = average + shhigh;
def LowerBandKCHigh = average - shhigh;

def preSqueeze = LowerBand > LowerBandKCLow and UpperBand < UpperBandKCLow;
def oriSqueeze = LowerBand > LowerBandKCMid and UpperBand < UpperBandKCMid;
def ExtSqueeze = LowerBand > LowerBandKCHigh and UpperBand < UpperBandKCHigh;

plot squeezeline = if ExtSqueeze or oriSqueeze or preSqueeze then 0 else Double.NaN;
squeezeline.AssignValueColor(if ExtSqueeze then Color.ORANGE else if oriSqueeze then Color.RED else if preSqueeze then Color.BLACK else Color.GREEN);
squeezeline.SetPaintingStrategy(PaintingStrategy.POINTS);
squeezeline.SetLineWeight(4);
squeezeline.HideTitle();
This idea with the vertical line, I like more now because it can be turn on and off, many people prefer to see all the signals but I think the idea of avoiding false signal is even better. At the end, the way we all trade is what really matter. The exit signal calculation part a like it now more, the only think is that it show again the signal when the signal going in decreasing and my beginning idea is to avoid lateralization but I can live with this because really improve big time. thanks for helping me to improve and optimize the indicator and yes rest is cosmetic in my opinion too!
 
Last edited:
This idea with the vertical line, I like more now because it can be turn on and off, many people prefer to see all the signals but I think the idea of avoiding false signal is even better. At the end, the way we all trade is what really matter. The exit signal calculation part a like it now more, the only think is that it show again the signal when the signal going in decreasing and my beginning idea is to avoid lateralization but I can live with this. thanks for helping me to improve and optimize the indicator and yes rest is cosmetic in my opinion too!
No problem. I'm glad I was able to help. I think what you should work on next is to avoid choppy signals. This indicator has good potential.
 
I little update on the indicator. This will let you play with the possibles exit depend of you experience, then you can stay more or less on your trade! primary code will be updated too!

change
Code:
def obL1 = 1.8;
def obLStep = 0.5;

for this
Code:
input exitLevelBeg = 1.8;
input calDays = 0.5;

and this other line here
Code:
def extValue = if msig >= obL1 then RoundDown((msig - obL1) / obLStep, 0) + 1 else if msig <= -obL1 then RoundDown((-obL1 - msig) / obLStep, 0) + 1 else 0;

for this
Code:
def extValue = if msig >= exitLevelBeg then RoundDown((msig - exitLevelBeg) / calDays, 0) + 1 else if msig <= -exitLevelBeg then RoundDown((-exitLevelBeg - msig) / calDays, 0) + 1 else 0;
 
BPM is base in my way of trading every day, I never fight again the price movement with specific exceptions that I learned over time. I do combine this BPM with a Double Bollinger Band

I thanks this site for the contribution that it has giving me to put all these ideas together, help from members like SleepyZ, MarryDay, BenTen, barbaros, they help me to visualize, improve and optimize my daily work, thanks big time!


Any improvement idea is more than welcome!

Code:
# Break Price Momentum, BPM by mbarcala and usethinkscript.com on 12/21/21(9)

declare lower;

input highLowLookback = 17;
input movAvgLength = 6;
input lookForward = yes;
input exitLevelBeg = 1.8;
input calDays = 0.5;

def slength = 20;
def mLev = 1.1;
def trendL = 0.3;
def nDev = 2.0;

def AvgExp = ExpAverage(close, slength);
def UpSignal = close crosses above AvgExp;
def DnSignal = close crosses below AvgExp;
def SignUpDn = UpSignal or DnSignal;

def lowest_k = Lowest(low, highLowLookback);
def c1 = close - lowest_k;
def c2 = Highest(high, highLowLookback) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;

def FullK = MovAvgExponential(FastK, movAvgLength);
def FullD = Max(-100, Min(100, (MovAvgExponential(FullK, 1))) - 50) / 50;
def flen = 0.5 * (Log((1 + FullD) / (1 - FullD)) + flen[1]);

plot mSig = flen;
mSig.SetDefaultColor(Color.MAGENTA);
mSig.SetLineWeight(2);
mSig.HideBubble();
mSig.HideTitle();
AddCloud(mSig, 0, Color.DARK_GREEN, Color.CURRENT);
AddCloud(mSig, 0, Color.CURRENT, Color.DARK_RED);
AddCloud(mSig, mLev, Color.GREEN, CreateColor(27, 27, 27));
AddCloud(mSig, -mLev, CreateColor(27, 27, 27), Color.RED);

plot cLine = 0;
cLine.SetPaintingStrategy(PaintingStrategy.LINE);
cLine.SetDefaultColor(Color.GRAY);
cLine.SetLineWeight(2);
cLine.HideTitle();

plot oBl = mLev;
oBl.SetPaintingStrategy(PaintingStrategy.LINE);
oBl.SetDefaultColor(CreateColor(0, 155, 255));
oBl.SetLineWeight(1);
oBl.HideTitle();

plot oSl = -mLev;
oSl.SetPaintingStrategy(PaintingStrategy.LINE);
oSl.SetDefaultColor(CreateColor(0, 155, 255));
oSl.SetLineWeight(1);
oSl.HideTitle();

############### Price Crossing Level ################
plot upArrow = if mSig crosses above 0 then mSig else Double.NaN;
upArrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
upArrow.SetDefaultColor(Color.GREEN);
upArrow.SetLineWeight(3);
upArrow.HideBubble();
upArrow.HideTitle();

plot dnArrow = if mSig crosses below 0 then mSig else Double.NaN;
dnArrow.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
dnArrow.SetDefaultColor(Color.RED);
dnArrow.SetLineWeight(3);
dnArrow.HideBubble();
dnArrow.HideTitle();

############### Posible Price Reversals ################
plot trendUp = if mSig crosses above mSig[1] and mSig[1] > trendL[1] then mSig else Double.NaN;
trendUp.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
trendUp.SetDefaultColor(Color.CYAN);
trendUp.SetLineWeight(1);
trendUp.HideBubble();
trendUp.HideTitle();
#--------------
plot trendDn = if mSig crosses below mSig[1] and mSig[1] < -trendL[1] then mSig else Double.NaN;
trendDn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
trendDn.SetDefaultColor(Color.CYAN);
trendDn.SetLineWeight(1);
trendDn.HideBubble();
trendDn.HideTitle();

############## Exit Possible Levels #################
def extValue = if msig >= exitLevelBeg then RoundDown((msig - exitLevelBeg) / calDays, 0) + 1 else if msig <= -exitLevelBeg then RoundDown((-exitLevelBeg - msig) / calDays, 0) + 1 else 0;
plot exts = if extValue > 0 and extValue[1] != extValue then mSig else Double.NaN;
exts.SetPaintingStrategy(PaintingStrategy.POINTS);
exts.SetDefaultColor(CreateColor(255,255,0));
exts.SetLineWeight(5);
exts.HideBubble();
exts.HideTitle();

############## Vertical Lines #################
AddVerticalLine(if lookForward then UpSignal and !SignUpDn[-1] else UpSignal and !UpSignal[1], "Up", Color.DARK_GREEN, Curve.SHORT_DASH);
AddVerticalLine(if lookForward then DnSignal and !SignUpDn[-1] else DnSignal and !UpSignal[1], "Down", Color.DARK_RED, Curve.SHORT_DASH);

########## BB Squeeze ###########
def sDev = StDev(close, slength);
def MidLine = MovAvgExponential(close, slength);
def LowerBand = MidLine + -nDev * sDev;
def UpperBand = MidLine + nDev * sDev;

def shhigh = 1.0 * MovAvgExponential(TrueRange(high, close, low), slength);
def shMid = 1.5 * MovAvgExponential(TrueRange(high, close, low), slength);
def shlow = 2.0 * MovAvgExponential(TrueRange(high, close, low), slength);
def average =  MovAvgExponential(close, slength);

def UpperBandKCLow = average + shlow;
def LowerBandKCLow = average - shlow;
def UpperBandKCMid = average + shMid;
def LowerBandKCMid = average - shMid;
def UpperBandKCHigh = average + shhigh;
def LowerBandKCHigh = average - shhigh;

def preSqueeze = LowerBand > LowerBandKCLow and UpperBand < UpperBandKCLow;
def oriSqueeze = LowerBand > LowerBandKCMid and UpperBand < UpperBandKCMid;
def ExtSqueeze = LowerBand > LowerBandKCHigh and UpperBand < UpperBandKCHigh;

plot squeezeline = if IsNaN(close) then Double.NaN else if ExtSqueeze or oriSqueeze or preSqueeze then 0 else Double.NaN;
squeezeline.AssignValueColor(if ExtSqueeze then Color.ORANGE else if oriSqueeze then Color.RED else if preSqueeze then Color.BLACK else Color.GREEN);
squeezeline.SetPaintingStrategy(PaintingStrategy.POINTS);
squeezeline.SetLineWeight(4);
squeezeline.HideTitle();
MBarcela, this is an interesting indicator. Is it a lower indicator only? How do you use it? I know you mentioned you also have a double BB probably to help with confirmation I suspect. Do you trade on the Daily? Do you think it would be helpful for lower timeframes? Thanks. Joe
 
MBarcela, this is an interesting indicator. Is it a lower indicator only? How do you use it? I know you mentioned you also have a double BB probably to help with confirmation I suspect. Do you trade on the Daily? Do you think it would be helpful for lower timeframes? Thanks. Joe
Yes, I start putting all together to used as lower indicator and for the last 3 years I being trading only on daily. In my opinion you can use on any timeframe. the way I use it, if the price below 20ema and the signal below 0 I going in a put position same if is above 20ema and above 0.

 
Yes, I start putting all together to used as lower indicator and for the last 3 years I being trading only on daily. In my opinion you can use on any timeframe. the way I use it, if the price below 20ema and the signal below 0 I going in a put position same if is above 20ema and above 0.

Thanks and I saw that reference. can you give a few more screenshot examples if you wouldn't mind? The signal you are referring to is the Up or Down arrow at the Squeeze 0 line??? Thanks. Joe
 
The signal is the Magenta line the arrows just letting you know when the signal its over 0 or below 0.

I tried the scan for the mSig greater than value 0 to signify an uptrend. But the scanner is not recognizing the value of mSig.

https%3A//i.imgur.com/zo2d99o.jpg[/img]']
zo2d99o.jpg
 
I tried the scan for the mSig greater than value 0 to signify an uptrend. But the scanner is not recognizing the value of mSig.

https%3A//i.imgur.com/zo2d99o.jpg[/img]']
zo2d99o.jpg
You can use this. create 2 studies one for Up and the other for down

Code:
def length = 20;
def smlength = 6;

def ksv = Max(-100, Min(100, (StochasticFull(KPeriod = length, slowing_period = smlength, averageType = AverageType.EXPONENTIAL))) - 50) / 50;
def flen = CompoundValue(1, if IsNaN(0.5 * (Log((1 + ksv) / (1 - ksv)) + flen[1])) then flen[1] else 0.5 * (Log((1 + ksv) / (1 - ksv)) + flen[1]), 0);

def mSig = if !IsNaN(close) then flen else Double.NaN;

plot upArrow = mSig crosses above 0 and mSig < 0.1;

#plot dnArrow = mSig crosses below 0 and mSig < -0.1;
 
You can use this. create 2 studies one for Up and the other for down

Code:
def length = 20;
def smlength = 6;

def ksv = Max(-100, Min(100, (StochasticFull(KPeriod = length, slowing_period = smlength, averageType = AverageType.EXPONENTIAL))) - 50) / 50;
def flen = CompoundValue(1, if IsNaN(0.5 * (Log((1 + ksv) / (1 - ksv)) + flen[1])) then flen[1] else 0.5 * (Log((1 + ksv) / (1 - ksv)) + flen[1]), 0);

def mSig = if !IsNaN(close) then flen else Double.NaN;

plot upArrow = mSig crosses above 0 and mSig < 0.1;

#plot dnArrow = mSig crosses below 0 and mSig < -0.1;
MBARCALA... Thank you very much for your quick response. The scan worked to look for stocks with mSig crossing above value 0 within 1 bar. Is there a way to scan for all stocks where mSig value that is greter than value 0.
 
You can use this. create 2 studies one for Up and the other for down

Code:
def length = 20;
def smlength = 6;

def ksv = Max(-100, Min(100, (StochasticFull(KPeriod = length, slowing_period = smlength, averageType = AverageType.EXPONENTIAL))) - 50) / 50;
def flen = CompoundValue(1, if IsNaN(0.5 * (Log((1 + ksv) / (1 - ksv)) + flen[1])) then flen[1] else 0.5 * (Log((1 + ksv) / (1 - ksv)) + flen[1]), 0);

def mSig = if !IsNaN(close) then flen else Double.NaN;

plot upArrow = mSig crosses above 0 and mSig < 0.1;

#plot dnArrow = mSig crosses below 0 and mSig < -0.1;
Hi, this indicator looks promising on a 5-minute chart. Quick question for you, however: Are the vertical lines that read "up" and "down" necessary, as, at times, they seem to contradict the arrows which, at least to me, appear to be more accurate?
 
MBARCALA... Thank you very much for your quick response. The scan worked to look for stocks with mSig crossing above value 0 within 1 bar. Is there a way to scan for all stocks where mSig value that is greter than value 0.
the scan search for all Stocks as you want. The number 1 that you see is not for within 1 bar is only there to tell the signal no to search over that 0.1 level
 
Hi, this indicator looks promising on a 5-minute chart. Quick question for you, however: Are the vertical lines that read "up" and "down" necessary, as, at times, they seem to contradict the arrows which, at least to me, appear to be more accurate?
vertical lines represent when the price cross the 20 ema, many time they coincide
 
Do u trade stock or options with this? And if option, since u are doing Daily do you buy weeklies?

Also what is the percentage so far?
 
Do u trade stock or options with this? And if option, since u are doing Daily do you buy weeklies?

Also what is the percentage so far?
I do both stocks and options. I always take my contracts minimum 60+ days of expiration.

what percentage you asking about?
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
353 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

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.

How do I get started?

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.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top