Hi,
This is my first development.
And I’m happy to share it with you.
This is a simple indicator to identify a trend.
Using the position of the moving averages.
If the short average above the long average = trend increases
But, if the long average above the short average = trend declines.
So far everything is simple,
The idea in this indicator is that it does not tell when the short average began to rise above the long average
But counting the number of candles chosen – and only if during all this time they are still arranged in the same order – he will signal.
Reading the signals:
0 = No trend
1 = upward trend
1 = downward trend
The following data is subject to change:
– Number of candles in the short average.
– The number of candles of the long average.
– Number of candles that the indicator will count (before the signal).
I personally think of using it as a database for scanning.
But it can also be used for other things …
I’m happy to share this with everyone. Because I believe that in this way we can all contribute to each other for progress and success.
Note: I’d love to get ideas for improving …
//Indicator for trend identification (based on position of moving averages)
//Editor - balance.
//21/05/2017
count1 = 0
count2=0
upcount=0
downcount=0
lma = Average[longma](close)
sma = Average[shortma](close)
increase = sma>lma
decrease=lma>sma
while (increase[count1]) do
upcount =upcount +1
count1=count1+1
wend
while (decrease[count2]) do
count2 = count2+1
downcount=downcount-1
wend
UPtrend = upcount > unitsforthetrend
DOWNtrend= downcount < -unitsforthetrend
v=0
if (uptrend)then
v=1
elsif (downtrend)then
v=-1
else
v=0
endif
a=0
return v coloured(0,0,0)as "trend line",a coloured(255,0,0)as "zero line"