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 …
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
//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" |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Balance thanks for sharing this excellent indicator.
Here are some thoughts.
please add comments to code (many people here are not coders and would greatly benefit from comments to understand and learn learn from you)
reviewing the indicator visually It seems to be reasonable at picking a change to the trend but of course we are dealing with historic data so it’s lagging and will always be. In my reading people suggest weighting the newer data over the older data – something to consider.
generally there are 3 states in the market (1) UPTREND, (2) DOWNTREND and (3) SIDEWAYS/consolidation/lack of trend. Within those states there is HIGH/AVERAGE/LOW volatility but let’s leave that for now.
Is there a way to include (3) sideways/consolidation/lack of trend? = 0
Also: 1 and -1 is a great start but almost too black and white. We need to know how strong the trend actually is 10/-10 = very strong to 0 no trend – how could we do this?