ema-sma + Volume

Category: Indicators By: Nicolas Created: June 28, 2021, 8:21 AM
June 28, 2021, 8:21 AM
Indicators
2 Comments

Oscillator from the difference between Ema and Sma around line 0, fairly reactive if you use the crossing of the 2 lines, more conservative if you expect the lines to cross the zero line. Histogram / column for the large change in volume with the cut so that it only shows a large divergence with the mean. colors show trends.

//PRC_ema-sma vol | indicator
//28.06.2021
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//converted from pinescript

// --- settings 
length = 9 //input(9, minval=1, title="short ema")
lensma = 17 //input(17, title="long sma")
// --- end of settings 

vol = volume
src=close
vm = 100 * ((average[length](vol) - average[length](vol)[4]) / average[length](vol)[4])
vvm = 100 * average[3]((vm - vm[1]) / vm[1])
osc = average[3](exponentialaverage[length](src) - average[lensma](src))
sig = (osc + 2 * osc[1] + 2 * osc[2] + osc[3]) / 6
if osc>0 then
 r=0
 g=255
 else
 r=255
 g=0
endif
if abs(vvm / 8) > abs(average[5](vvm)) then
 cut=osc/.7
else
 cut=0
endif
if cut>0 then
 r1=0
 g1=255
 b1=255
else
 r1=255
 g1=165
 b1=0
endif
return sig coloured(r,g,0) as "Sig", osc coloured(r,g,0) style(line,2) as "ROC", 0 style(line,2) as "zero line", cut coloured(r1,g1,b1) style(histogram)

Download
Filename: PRC_ema-sma-vol.itf
Downloads: 473
Nicolas Master
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

Logo Logo
Loading...