A little code conversion help please. This is plots the indicator developed by Andrew Abraham in the Trading the Trend article of TASC September 1998 but in ProRealTime. Is there anyway this could be converted into Empty4/5 code enabling it's use on my FX price chart window please?
The calculation uses a 21-period weighted average of the true range, giving higher weight to the true range of the most recent bar. The final value is then multiplied by 3.
The volatility indicator is used as a stop-and-reverse method. Let's say the market has been rising, then the volatility indicator is calculated each day and subtracted from the highest close during the rising market. The highest close is always used, even if there has been a series of lower closes since the highest close. If the market closes below the volatility indicator, then for the next day, the current reading of the volatility indicator is added to the lowest close. This step is followed each day until the market closes above the trailing volatility indicator.
We now have a definition of the trend. An upward trend exists as long as the volatility indicator is below the market and a downtrend is in force if the volatility indicator is above the market.
Code: Select all
//Abrahams Trend Trade
Length =21
Multiplier = 3
avrTR = weightedaverage[Length](AverageTrueRange[1](close))
highestC = highest[Length](high)
lowestC = lowest[Length](low)
hiLimit = highestC[1]-(avrTR[1]*Multiplier)
lolimit = lowestC[1]+(avrTR[1]*Multiplier)
if(close > hiLimit AND close > loLimit) THEN
ret = hiLimit
ELSIF (close < loLimit AND close < hiLimit) THEN
ret = loLimit
ELSE
ret = ret[1]
ENDIF
RETURN ret coloured(238,238,0) as "Trend Trader"Best
Grim