an indicator which shows a change of direction
Posted: 16 Apr 2014
Hi guys
I would create an indicator which show me when moving average changes direction.
For example : indicator=1 when moving average changes and going up
indicator=-1 when moving average is going down
I have written this code :
I have posted a picture of this code here : http://www.heberger-image.fr/images/874 ... s.png.html
Anybody would have an idea please?
I would create an indicator which show me when moving average changes direction.
For example : indicator=1 when moving average changes and going up
indicator=-1 when moving average is going down
I have written this code :
Code: Select all
Inputs: price(Close), length(10),
zeroLine(0.0), zeroVisible(false),
upColour(Green), downColour(Red), colourDeltaBar(1);
Variables: var0 (0) ;
var0 = jtHMA(price, length);
//when the average changes direction : (moving average is going down)
if var0[2] > var0[1] and var0[1] < var0 then
value2 = 1 ;
//when the average changes direction : (moving average is going up)
if var0[2] < var0[1] and var0[1] > var0 then
value2 = -1 ;
Plot1(Value2, "jtHMA");
Anybody would have an idea please?