StockFetcher Forums · Filter Exchange · TAT indicator<< >>Post Follow-up
bramdc
6 posts
msg #114904
Ignore bramdc
8/16/2013 1:56:57 AM

Dear all,

I came across an interesting indicator, namely the 'TAT' indicator, combining MACD and parabolic SAR,

anyone having good skills to translate this to stockfetcher?

I have pasted the code here below:

thanks!

-------------------------------------------
indicator TAT;
input
macd_fast_period = 12,
macd_slow_period = 26,
macd_signal_period = 9,
sar_step = 0.02,
sar_maximum = 0.2,
tat_macd_multiplier = 66.67,
tat_sar_multiplier = 6.67,
tat_signal_period = 12,
overbought_level = 1,
oversold_level = -1;
draw
tat_main("TAT", solid_line, green),
tat_sig("TAT Signal", solid_line, red),
ob("Overbought level", dash_line, white),
os("Oversold level", dash_line, white),
zero("Zero", dash_line, white);
vars
islong(bool),
af(number),
extreme(number),
s(number),
sar(series),
i(number),
macd_main(series),
macd_sig(series),
tat_sar(number),
tat_macd(number);

begin
if macd_fast_period < 1 or macd_slow_period < 1 or macd_signal_period < 1 or tat_signal_period < 1 or back(close) < front(close) then
return;

macd_main := ema(close, macd_fast_period) - ema(close, macd_slow_period);
macd_sig := ema(macd_main, macd_signal_period);

islong := true;
af := sar_step;
extreme := high[front(close)];
s := low[front(close)];
sar[front(close)] := s;
for i := front(close) + 1 to back(close) do begin
s := s + af * (extreme - s);
if islong then
if low[i] < s then begin
islong := false;
af := sar_step;
s := extreme;
extreme := low[i];
end else begin
if extreme < high[i] then begin
extreme := high[i];
af := af + sar_step;
if af > sar_maximum then
af := sar_maximum;
end;
end
else
if high[i] > s then begin
islong := true;
af := sar_step;
s := extreme;
extreme := high[i];
end else begin
if extreme > low[i] then begin
extreme := low[i];
af := af + sar_step;
if af > sar_maximum then
af := sar_maximum;
end;
end;
sar[i] := s;
end;

for i := front(close) to back(close) do begin
tat_sar := 0;
tat_macd := 0;
if sar[i] <> 0 then
tat_sar := (close[i] - sar[i]) / sar[i];
if close[i] <> 0 then
tat_macd := (macd_main[i] - macd_sig[i])/ close[i];
tat_main[i] := 50*(tat_sar*tat_sar_multiplier + tat_macd*tat_macd_multiplier);
zero[i] := 0;
ob[i] := overbought_level;
os[i] := oversold_level;
end;
tat_sig := ema(tat_main, tat_signal_period);
end.

StockFetcher Forums · Filter Exchange · TAT indicator<< >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2022 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.