Please help in converting the meta code in afl

#1
Hi,

Please help in converting the below meta code into an afl.


Trend Direction & Force Index (TDF Index)

{TDF Index by Piotr Wojdyło}
{Wskaźnik kierunku i siły trendu}

per1:=Input("Major MA",1,200,17);
MMA:=Mov(C,per1,E);
SMMA:=Mov(MMA,per1,E);
IMPETMMA:=MMA - Ref(MMA,-1);
IMPETSMMA:=SMMA - Ref(SMMA,-1);
DIVMA:= Abs(MMA - SMMA);
AVERIMPET:= (IMPETMMA+IMPETSMMA)/2;
TDF:= Power(DIVMA,1)*Power(AVERIMPET,3);
NTDF:=TDF/HHV(Abs(TDF),per1*3);
-0.05;0.05;ntdf

The indicator looks like



Thanks.
 

sr114

Well-Known Member
#2
TDF (metastock indi) interpretation

Trend Direction & Force Index (TDF):
TDF can range from -1 to 1 and thus indicate the direction of the trend. The most convenient way to present graphically the two indicators as a histogram.

In periods of consolidation ratios take very low values ​​close to zero as a rule, do not exceed the value of 0.05 (and -0.05 for TDF), which have set arbitrarily as horizontal lines signal. Rate accelerates rapidly to higher values ​​when the period ends and the current fluctuations of horizontal movement is a good chance to become a permanent trend. I assume that as long as the pointer moves above the signal line and do not come down to the low value of less than 0.05 in at least two bars trend continues. So the descent rate below signal line for a NC post and return to higher values ​​should be interpreted as a temporary weakening trend and further assume that it exists. Not before rate remains below 0.05 for at least 2 bars, we can consider that the market is likely to begin to move in a horizontal trend.

In addition, we can assess the strength of the trend, depending on the value of the index - the index reaches one trend is strong (-1 for TDF is a strong downward trend) and generally values ​​above 0.6 should be so interpreted. When the rate of decline should be considered because it means that the trend is losing its momentum.
amibroker code : TDF

// Trend Direction & Force Index (TDF Index)
//{TDF Index by Piotr Wojdylo}
// code translated from Metastock to Amibroker and presented as histogram as mentioned in the interpretation
//translated by subroto ~ (sr114), 16.03.2013

_SECTION_BEGIN("Background_Setting");
SetChartBkGradientFill( ParamColor("BgTop", colorBlack),
ParamColor("BgBottom", colorDarkGrey),ParamColor("TitleBack",colorGrey40));
SetChartBkColor(ParamColor("Outer Panel",colorPaleBlue));
SetChartOptions(0,chartShowArrows|chartShowDates);
_SECTION_END();

_SECTION_BEGIN("TDF");
per=Param("Major MA",5,5,200,10);

mma=EMA(C,per);
smma=EMA(mma,per);

impetmma= mma-Ref(mma,-1);
impetsmma= smma-Ref(smma,-1);

divma=abs(mma-smma);

averimpet=(impetmma+impetsmma)/2;

tdf=(divma^1)*(averimpet^3);
ntdf=tdf/(HHV(abs(tdf),per*3));

Plot(ntdf," T.D.F ",IIf(tdf>0,colorGreen,colorRed),styleHistogram|styleThick);

Plot(0,"",colorWhite,styleLine|styleThick);

_SECTION_END();
screenshots


rgds
subroto
 
Last edited:
#3
Hi sr114,

Thanks for the code.

But the upper part of the indicator is not showing up.

Is the code only for the down indicator?

If yes then, please could you help me get the code for upper part of the indicator.

Thanking you in anticipation.
 

sr114

Well-Known Member
#4
Hi sr114,

Thanks for the code.

But the upper part of the indicator is not showing up.

Is the code only for the down indicator?

If yes then, please could you help me get the code for upper part of the indicator.

Thanking you in anticipation.
the upper part is an expert advisor in metastock - i only translated the TDF part.

the code is for the down part

rgds
subroto
 
#5
Thanks to pnaphade for raising the topic and many thanks to subroto for sparing his sincere efforts to unravel the mistery.

I feel the upper part of the chart seems to contain
price and Bollinger Bands
and Displaced Exponential moving averages as in Alligator code

If anymore info can be shared on this please
thanks
 

KelvinHand

Well-Known Member
#6
Hi,

Please help in converting the below meta code into an afl.


Trend Direction & Force Index (TDF Index)

{TDF Index by Piotr Wojdyło}
{Wskaźnik kierunku i siły trendu}

per1:=Input("Major MA",1,200,17);
MMA:=Mov(C,per1,E);
SMMA:=Mov(MMA,per1,E);
IMPETMMA:=MMA - Ref(MMA,-1);
IMPETSMMA:=SMMA - Ref(SMMA,-1);
DIVMA:= Abs(MMA - SMMA);
AVERIMPET:= (IMPETMMA+IMPETSMMA)/2;
TDF:= Power(DIVMA,1)*Power(AVERIMPET,3);
NTDF:=TDF/HHV(Abs(TDF),per1*3);
-0.05;0.05;ntdf

The indicator looks like



Thanks.
I go straight to the point.
Where did you get the TDF Osillator formula?
Why the Amibroker TDI so much different from your picture ?


Why not you post the whole metastock system you had.
let see whole system converted to amibroker, rather then guessing this or that
 
Last edited:
#7
Hello pnaphade,

Can u provide the Strong and Weak ... above metastock formula..?


i m using metastock too. if possible pls post the above metastock formula...

Strong or weak.. thumps up for Buy and Thumps down for sell.

I m waiting for ur reply.

thnx you
 
#8
Hi,

Please help in converting the below meta code into an afl.


Trend Direction & Force Index (TDF Index)

{TDF Index by Piotr Wojdyło}
{Wskaźnik kierunku i siły trendu}

per1:=Input("Major MA",1,200,17);
MMA:=Mov(C,per1,E);
SMMA:=Mov(MMA,per1,E);
IMPETMMA:=MMA - Ref(MMA,-1);
IMPETSMMA:=SMMA - Ref(SMMA,-1);
DIVMA:= Abs(MMA - SMMA);
AVERIMPET:= (IMPETMMA+IMPETSMMA)/2;
TDF:= Power(DIVMA,1)*Power(AVERIMPET,3);
NTDF:=TDF/HHV(Abs(TDF),per1*3);
-0.05;0.05;ntdf

The indicator looks like



Thanks.

Hello pnaphade,

Can u provide upper part (moving average with Strong and Weak ... above metastock formula)..?


i m using metastock too. if possible pls post the above metastock formula...

Strong or weak.. thumps up for Buy and Thumps down for sell.

I m waiting for ur reply.

thnx you
 

KelvinHand

Well-Known Member
#9
Here the information that
Likely the similarity with above picture

Video
====
http://niftyspecialist.com/Home.php

Manual:
=====
http://niftyspecialist.com/T-D-F--Manual.php


Seen to me that the picture is copied from this website:
http://www.mudraa.com/trading/123784/0/any-one-please-drop-afl-for-amibroker.html

and pnaphade was expected a simple conversion of the T.D.F Formula found elsewhere which meet the requirement of the picture
and also come out the EA.

The T.D.F. Oscillator named cannot be be the same as "Trend Direction & Force Index (TDF)", the amibroker coded and picture shown sharp histogram and unlike the smooth histogram in the pnaphade's picture.


I suspect he don't had the system.
Prove me wrong.
 
Last edited:
#10
hello Kelvinhand,

u have posted the address of Niftyspecialist.. its paid one.

Can anyone paste the TDF metastock formula with moving averages??


thanx you..

waiting for reply.
 

Similar threads