*UPDATED*
Hello everybody, I wanted to share my first official indicator with the community incase it could be of use to anyone. Especially because there was no WAY this was getting done without giving that search bar a workout. My apologies if this is just another copy of something else on here, I did not see anything like it which is what inspired me to write it. I'm not much of a coder so this may be fairly primitive to the more experienced. I have not even begun to learn how to properly back test yet so I do not have any proof to show yet, but using it today kept me green. ALSO BEFORE ANYBODY ASKS I do NOT have a watchlist/scanner/alert system as that is all still beyond the scope of my knowledge at this time. Now on to the indicator:Lower study developed to help scalp/day-trade in sideways or shorter range market. Plot line follows current price trend while histogram bars measure relative volume. Red Shaded areas on zero line indicate current time frame squeeze. Plot Points are a "nudge" on trend with above price line nudging down (bearish) and below nudging upwards (bullish). Arrows indicate a stronger push and potential trend change. Has tendency to provide early notice. Recommended for use with confirming TA.
Price trend line is based on built in Fisher Transform with stochastic formula. 2nd stochastic type formula is processed through a similar "filter" and used as reference changes in trend. Volume bars below zero line are below volume avg (relative volume ratio below 1) and switch to above zero line if they meet/cross avg. Strong shifts quickly followed by opposing "nudges" or "shoves" are often false signals or a sign of volatility/chop. False signals may also be seen or missed during excessive chop or large gaps in price.
Code:
## Nudge n Shove Indicator
#By: TTsMikeC 10/2021
#hint: Lower study developed to help scalp/day-trade in sideways or shorter range market. Plot line follows current price trend while histogram bars measure relative volume. Red Shaded areas on zero line indicate current time frame squeeze. Plot Points are a "nudge" on trend with above price line nudging down (bearish) and below nudging upwards (bullish). Arrows indicate a stronger push and potential trend change. Has tendency to provide early notice. Recommended for use with confirming TA.
#
# Price trend line is based on built in Fisher Transform with
# stochastic formula. 2nd stochastic type formula is processed
# through a similar "filter" and used as reference for changes
# in trend. Volume bars below zero line are below volume avg
# (relative volume ratio below 1) and switch to above zero line
# if they meet/cross avg.
#
# Strong shifts quickly followed by opposing "nudges" or "shoves"
# are often false signals or a sign of volatility/chop. False
# signals may also be seen or missed during excessive chop or
# large gaps in price.
#
# Updates:
# 11/2/2021 v1.2
# - reworked conditions for Nudges and Shoves for for fewer false
# signals, as well as added a condition based on price action
# - Fixed relative volume bars not plotting correctly
declare lower;
#hint volume_length: Length of SMA in calculating Relative Volume. Relative volume bars are negative(Gray) when below average and positive(Green) when at or above average.
#hint price_length: Used in the calculation of price trend. Based on Fisher Transform. Settings too low show increased noise <b>Recommended setting: 10</b>
#hint Fast_ref: Stochastic based calculation used in referencing "Nudge" and "Shove" signals. Lower settings will result in more false signals. <b>Recommended setting: 24</b>
#hint Arrow_Height: Distance away from Price Trend line
input volume_length = 21;
input price = hl2;
input price_length = 10;
input Fast_ref = 24;
input Arrow_Height = 2.0;
input Hide_Squeeze_Off = yes;
## Fisher Transform - Price trend
def maxHigh = Highest(price, price_length);
def minLow = Lowest(price, price_length);
def range = maxHigh - minLow;
def value = if IsNaN(price)
then Double.NaN
else if IsNaN(range)
then value[1]
else if range == 0
then 0
else 0.66 * ((price - minLow) / range - 0.5) + 0.67 * value[1];
def truncValue = if value > 0.99 then 0.999 else if value < -0.99 then -0.999 else value;
# .3 is down from .5 original formula to shrink plot
def fish = 0.3 * (Log((1 + truncValue) / (1 - truncValue)) + fish[1]);
def FTOneBarBack = fish[1];
plot Price_Trend = fish;
Price_Trend.SetDefaultColor(color.MAGENTA);
Price_Trend.setLineWeight(1);
#### Stochastic ####
def FastKH = Highest(price, Fast_ref);
def FastKL = Lowest(price, Fast_ref);
## Calculate Stochastic and normalize
def fastkFix = ((price - FastKL) / (FastKH - FastKL));
def fastNorm = (2 * fastkFix) - 1;
def fastCap = if fastNorm > 0.99 then 0.999 else if fastNorm < -0.99 then -0.999 else fastNorm;
### Resulting stoch line, the .3 is to shrink the oscilator to size
def fastFinal = .3 * (Log((1 + fastCap) / (1 - fastCap)) + fastFinal[1]);
### Change def to plot for trouble shooting ####
def FastK = fastFinal;
### Nudge alerts ###
def upcross = if FastK crosses above Price_Trend and
((FastK - FastK[1]) > .3) and
(Price_Trend - Price_Trend[1]) > .3 or
((FastK - FastK[1]) > 1) and Price_Trend >= -1.3 then 1 else 0 or
if (Price_Trend - Price_Trend[1]) > .1 and Price_Trend > 0.2 and (Price_Trend[1] - Price_Trend[2]) > .2 and
Price_Trend < .4 then 1 else 0 or
if (close[1] < open[1]) and (open < close) and ((high[1] - low[1]) / (high - low) *100 < 75) then 1 else 0;
def downcross = if FastK crosses below Price_Trend and
((FastK[1] - FastK) > .3) and
(Price_Trend[1] - Price_Trend) > .5 or
((FastK[1] - FastK) > 1) and Price_Trend <= 1.3 then 1 else 0 or
if (Price_Trend[1] - Price_Trend) > .2 and Price_Trend < -0.3 and (Price_Trend[2] - Price_Trend[1]) > .2 and
Price_Trend >-.4 then 1 else 0 or
if (close[1] > open[1]) and (open > close) and ((high[1] - low[1]) / (high - low) *100 < 75) then 1 else 0;
plot Bull_Nudge = if upcross then Price_Trend - .8 else double.NaN;
Bull_Nudge.setPaintingStrategy(paintingStrategy.POINTS);
Bull_Nudge.setDefaultColor(color.Cyan);
Bull_Nudge.setLineWeight(3);
plot Bear_Nudge = if downcross then Price_Trend + .8 else double.NaN;
Bear_Nudge.setPaintingStrategy(paintingStrategy.POINTS);
Bear_Nudge.setDefaultColor(color.yellow);
Bear_Nudge.setLineWeight(3);
### Shove plots for stronger trend change ###
## Commented out add lines to test arrows
def upshove = if upcross and Price_Trend < 0 and Price_Trend crosses above FToneBarBack and (Price_Trend > ((Price_Trend[1]+ Price_Trend[2]) / 2 ))then 1 else 0 or if upcross is true within 1 bars and Price_Trend - Price_Trend[1] > .1 and Price_Trend[1] > Price_Trend[2] then 1 else 0;
;
plot Bull_Shove = if upshove then Price_Trend - Arrow_Height else double.NaN;
Bull_Shove.setPaintingStrategy(paintingStrategy.ARROW_UP);
Bull_Shove.setlineWeight(2);
Bull_Shove.setDefaultColor(color.upTICK);
#AddverticalLine(upshove, "", color.UPTICK, Curve.SHORT_DASH);
def downshove = if downcross and Price_Trend > 0 and Price_Trend crosses below FToneBarBack and (Price_Trend < ((Price_Trend[1]+ Price_Trend[2]) / 2 )) then 1 else 0;
plot Bear_Shove = if downshove then Price_Trend + Arrow_Height else double.NaN;
Bear_Shove.setPaintingStrategy(paintingStrategy.ARROW_DOWN);
Bear_Shove.setlineWeight(2);
Bear_Shove.setDefaultColor(color.DOWNTICK);
#AddverticalLine(downshove, "", color.DOWNTICK, Curve.SHORT_DASH);
#### Relative Volume Histogram ####
def Relvol = absValue(volume / Average(volume, volume_length));
plot Rvol = if Relvol < 1 then (Relvol *-1) else Relvol ;
rvol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
rvol.SetLineWeight(4);
rvol.DefineColor("Pos and Up", Color.GREEN);
rvol.DefineColor("Pos and Down", Color.DARK_GREEN);
rvol.DefineColor("Less but More", Color.Dark_GRAY);
rvol.DefineColor("Less and Less", Color.GRAY);
rvol.AssignValueColor(if rvol >= 0 then if rvol > rvol[1] then rvol.Color("Pos and Up") else rvol.Color("Pos and Down") else if rvol < rvol[1] then rvol.Color("Less and Less") else rvol.Color("Less but More"));
#### Squeeze indicator #####
def c = close;
def squeeze_length = 20;
def sqz = average(c, squeeze_length);
def sdv = stDev(c, squeeze_length);
def bbref = sqz +(2 * sdv) ;
def kelref = sqz + (1.5 * Average(TrueRange(high, close, low), squeeze_length));
def squeeze = bbref < kelref;
plot Squeeze_Line = 0;
Squeeze_Line.setPaintingStrategy(paintingStrategy.LINE);
Squeeze_Line.defineColor("Squeeze off", color.DARK_GRAY);
Squeeze_Line.defineColor("Squeeze on",(createColor(204,000,000)));
Squeeze_Line.AssignValueColor(if squeeze then Squeeze_Line.color("Squeeze on") else Squeeze_Line.color("Squeeze off"));
Squeeze_Line.setLineWeight(2);
def sqz_up_range = 1.5;
def sqz_down_range = -1.5;
addcloud(if squeeze then sqz_up_range else double.NaN, sqz_down_range, (createColor(235,000,000)), (createColor(204,000,000)));
addcloud(if !Hide_Squeeze_Off then sqz_up_range else double.NaN, sqz_down_range, color.GRAY, color.GRAY);
#End
Most updated link: http://tos.mx/pK7qz9V
Feedback is appreciated! Thank you
Update 10/31/2021
Re-worked all the formulas for the plots and this should be much better. This is the current code with updated share link. Reminder: Due to the nature of it being stochastic based, times of higher volatility and larger price swings may give false signals and this indicator should not be taken as "buy"/"sell" signals. Added input for arrow plot adjustments as well.
Update 11/2/2021
Sorry for not having a better working setup before sharing!!
- Bug fixes from last update. Cleaned up code a bit and adjusted formulas again for more accurate plots and less noise.
- Fixed relative volume bars not plotting correctly.
Last edited: