TAT indicator

Category: Indicators By: Nicolas Created: April 13, 2017, 12:35 PM
April 13, 2017, 12:35 PM
Indicators
3 Comments
sar

This TAT indicator combines the MACD and the Parabolic SAR and is to be considered as a trend indicator.

A study using the MACD and parabolic SAR revealed that it was interesting to link this with a certain calculation and weighting.

If the TAT indicator upward cuts through its signal line, the trend is upwards. If the TAT indicator crosses the signal line downwards, the trend is negative.

Coded by a request on english forum (link in the indicator code).

Original idea developed by Gerrit Bosboom.

//PRC_TAT | indicator
//12.04.2017
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//https://www.prorealcode.com/topic/tat-indicator/

//--- settings
MACDFastPeriod=12
MACDSlowPeriod=26
MACDSignalPeriod=9
SARStep=0.02
SARMaximum=0.2
TATMACDMultiplier=66.67
TATSARMultiplier=6.67
TATSignalPeriod=12
// --- end of settings

islong = 1
af = SARStep
extreme = Max(close, close[1])
sn = Min(close, close[1])
sarr = sn
sn = sn + af * (extreme - sn)
if islong then
 if (low[1] < sn) then
  islong = 0//false;
  af = sarstep
  sn = extreme
  extreme = low[1]
 else
  if (extreme < high[1]) then
  extreme = high[1]
  af = af + sarstep
  if (af > sarmaximum) then
  af = sarmaximum
 endif
endif
if (high[1] > sn) then
 islong = 1//true;
 af = sarstep
 sn = extreme
 extreme = high[1]
else
 if (extreme > low[1]) then
  extreme = low[1]
  af = af + sarstep
   if (af > sarmaximum) then
    af = sarmaximum
   endif
  endif
 sarr = sn
 endif
endif
endif
tatsar = 0
tatmacd = 0
macdmain=macdline[MACDFastPeriod,MACDSlowPeriod,MACDSignalPeriod]
macdsig=exponentialaverage[MACDSignalPeriod](macdmain)
if sarr <> 0 then
 tatsar = (close - sarr) / sarr
  if close <> 0 then
   tatmacd = (macdmain - macdsig)/ close
   tatmain = 50*(tatsar * tatsarmultiplier + tatmacd * tatmacdmultiplier)
  endif
  signal=ExponentialAverage[tatsignalperiod](tatmain)
endif

return tatmain style(histogram) as "TAT", signal style(line) as "signal line"

 

Download
Filename: PRC_TAT.itf
Downloads: 256
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...