Trading Rush Choppy Indicator

barbaros

Administrator
Staff member
Platform
  1. Thinkorswim
Purpose of this indicator is to keep traders out of choppy markets. Histogram will disappear when the market is choppy. The average line show the quality of price movement. When the price starts getting choppy, the average line will start dropping towards zero.

7Hjn6SR.png


Code:
#Created by Trading Rush https://tradingrush.net/ and converted to ThinkScript by an unemployed nobody

declare lower;
input line = 20;
def line_new = line/10;

def UPa =
if close[1] > close[2] and close[2] > close[3] and close[3] > close[4] and close[4] > close[5] and close[5] > close[6] then yes else no; #Green

def UPb =
if close[1] > close[2] and close[2] > close[3] and close[3] > close[4] then yes else no; #Green Slow

def UPc =
if close[2] > close[3] and close[3] > close[4] and close[4] > close[5] and close[5] > close[6] then yes else no; #Green Slower

def UPd = if close[1] > close[2] and close[3] > close[4] and close[4] > close[5] and close[5] > close[6] then yes else no; #Green Slower

def UPe = if close[1] > close[2] and close[2] > close[3] and close[4] > close[5] and close[5] > close[6] then yes else no; #Green Slower

def UPf = if close[1] > close[2] and close[2] > close[3] and close[3] > close[4] and close[5] > close[6] then yes else no; #Green Slower

def UPg = if close[1] > close[2] and close[2] > close[3] and close[3] > close[4] and close[4] > close[5] then yes else no; #Green Slower


def DNa = if close[1] < close[2] and close[2] < close[3] and close[3] < close[4] and close[4] < close[5] and close[5] < close[6] then yes else no; #Green

def DNb =
if close[1] < close[2] and close[2] < close[3] and close[3] < close[4] then yes else no; #Green Slow

def DNc =
if close[2] < close[3] and close[3] < close[4] and close[4] < close[5] and close[5] < close[6] then yes else no; #Green Slower

def DNd =
if close[1] < close[2] and close[3] < close[4] and close[4] < close[5] and close[5] < close[6] then yes else no; #Green Slower

def DNe =
if close[1] < close[2] and close[2] < close[3] and close[4] < close[5] and close[5] < close[6] then yes else no; #Green Slower

def DNf =
if close[1] < close[2] and close[2] < close[3] and close[3] < close[4] and close[5] < close[6] then yes else no; #Green Slower

def DNg =
if close[1] < close[2] and close[2] < close[3] and close[3] < close[4] and close[4] < close[5] then yes else no; #Green Slower

def hist =
if UPa or DNa then
10
else
if UPb or DNb then
10
else
if UPc or UPd or Upe or UPf or UPg or DNc or DNd or DNe or DNf or DNg then
10
else
0;
#
def main = (hist[1]+hist[2]+hist[3]+hist[4]+hist[5]+hist[6]+hist[7]+hist[8]+hist[9]+hist[10])/10;
#
def mainColor = if(main < main[1]) then
yes
else
no;

plot Choppy = hist*line_new;
Choppy.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Choppy.SetLineWeight(2);
Choppy.AssignValueColor(if UPa or DNa then CreateColor(76, 175, 80) else if UPb or DNb then CreateColor(129, 199, 132) else if UPc or UPd or UPe or UPf or UPg or DNc or DNd or UPe or UPf or UPg then CreateColor(200, 230, 201) else color.white); #ColorGreen, ColorGreenSlow, ColorGreenSlower

plot TheLine = line;
TheLine.SetLineWeight(2);
TheLine.AssignValueColor(color.orange);

plot TheAverage = main;
TheAverage.SetLineWeight(2);
TheAverage.AssignValueColor(if mainColor then color.red else CreateColor(170, 76, 175));
 
Last edited:

bigboss

New member
Back when trading rush originally posted this, I had loaded it up in tradingview to take a look at it. The code has some glaring issues, like the main calculation.

Code:
def main = hist[1]+hist[2]+hist[3]+hist[4]+hist[5]+hist[6]+hist[7]+hist[8]+hist[9]+hist[10]/10;

main adds all the hist values together and divides by ten at the end. The lack of parentheses means only hist[10] is divided by ten - resulting in a maximum value of 91 for main. The division by 10 should probably be removed.

The 20 line appears to be arbitrary, and just a mechanism to draw a histogram. It doesn't constitute some level at which above is choppy and below is not (compared to like say a 25 or 35 level for adx).

I poked at the code a bit to see if it made sense to add in a directional bias and identify chop when net bias was zero, but even that didn't really give great results. In the end I decided there was nothing to see here :p YMMV!
 

barbaros

Administrator
Staff member
Back when trading rush originally posted this, I had loaded it up in tradingview to take a look at it. The code has some glaring issues, like the main calculation.

Code:
def main = hist[1]+hist[2]+hist[3]+hist[4]+hist[5]+hist[6]+hist[7]+hist[8]+hist[9]+hist[10]/10;

main adds all the hist values together and divides by ten at the end. The lack of parentheses means only hist[10] is divided by ten - resulting in a maximum value of 91 for main. The division by 10 should probably be removed.

The 20 line appears to be arbitrary, and just a mechanism to draw a histogram. It doesn't constitute some level at which above is choppy and below is not (compared to like say a 25 or 35 level for adx).

I poked at the code a bit to see if it made sense to add in a directional bias and identify chop when net bias was zero, but even that didn't really give great results. In the end I decided there was nothing to see here :p YMMV!
Good point. Fixed the parentheses issue.
 
Top