0% found this document useful (0 votes)
25 views1 page

TrendWave Histogram Pine Script Onlinenotepad - Io

The document is a Pine Script code for a trading indicator called 'TrendWave Histogram'. It calculates various directional movement indicators (DIPlus and DIMinus) and the Average Directional Index (ADX) to assess market trends. The script includes input parameters for length and threshold, and it visualizes the results using colored plots based on the calculated values.

Uploaded by

incmail054
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views1 page

TrendWave Histogram Pine Script Onlinenotepad - Io

The document is a Pine Script code for a trading indicator called 'TrendWave Histogram'. It calculates various directional movement indicators (DIPlus and DIMinus) and the Average Directional Index (ADX) to assess market trends. The script includes input parameters for length and threshold, and it visualizes the results using colored plots based on the calculated values.

Uploaded by

incmail054
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

//@version=5

indicator("TrendWave Histogram", overlay=false, scale=scale.left)

len = input.int(title="Length", defval=14)


th = input.int(title="threshold", defval=25)

TrueRange = math.max(math.max(high - low, math.abs(high - nz(close[1]))),


math.abs(low - nz(close[1])))
DirectionalMovementPlus = (high - nz(high[1]) > nz(low[1]) - low) ? math.max(high -
nz(high[1]), 0) : 0
DirectionalMovementMinus = (nz(low[1]) - low > high - nz(high[1])) ?
math.max(nz(low[1]) - low, 0) : 0

var float SmoothedTrueRange = na


var float SmoothedDirectionalMovementPlus = na
var float SmoothedDirectionalMovementMinus = na

SmoothedTrueRange := nz(SmoothedTrueRange[1]) - (nz(SmoothedTrueRange[1]) / len) +


TrueRange
SmoothedDirectionalMovementPlus := nz(SmoothedDirectionalMovementPlus[1]) -
(nz(SmoothedDirectionalMovementPlus[1]) / len) + DirectionalMovementPlus
SmoothedDirectionalMovementMinus := nz(SmoothedDirectionalMovementMinus[1]) -
(nz(SmoothedDirectionalMovementMinus[1]) / len) + DirectionalMovementMinus

DIPlus = SmoothedDirectionalMovementPlus / SmoothedTrueRange * 100


DIMinus = SmoothedDirectionalMovementMinus / SmoothedTrueRange * 100
DX = math.abs(DIPlus - DIMinus) / (DIPlus + DIMinus) * 100
ADX = ta.sma(DX, len)

ve = DIPlus > (DIMinus + (DIPlus * 10) / 100)


ro = DIMinus > (DIPlus + (DIMinus * 10) / 100) and ADX > 11 and ADX <= 25
xve = DIPlus > (DIMinus + (DIPlus * 10) / 100) and ADX > 22
xro = DIMinus > (DIPlus + (DIMinus * 10) / 100) and ADX > 22
fl = DIPlus - DIMinus < math.abs(10) and ADX < 15

di = 25 + (DIPlus - DIMinus)

cr = ADX <= 22 ? color.new(color.green, 20) :


ADX <= 34 ? color.new(color.green, 40) :
ADX <= 46 ? color.rgb(0, 47, 255) :
ADX <= 58 ? color.rgb(0, 4, 255) :
ADX <= 70 ? color.rgb(0, 38, 255) :
color.new(color.green, 100)

cg = ADX <= 22 ? color.new(color.maroon, 20) :


ADX <= 34 ? color.new(color.maroon, 40) :
ADX <= 46 ? #ff0000 :
ADX <= 58 ? #ff0505 :
ADX <= 70 ? #fa0a0a :
color.new(color.maroon, 100)

plot(di, style=plot.style_columns, linewidth=4, color=di >= 25 ? cr : cg,


histbase=th, title="DI")
plot(di, style=plot.style_line, linewidth=2, color=di >= 25 ? cr : cg, histbase=th,
title="DI Line")
plot(ADX, color=color.black, linewidth=2, title="ADX")

You might also like