Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

TTF for Amibroker (AFL)

Rating:
3 / 5 (Votes 2)
Tags:
trading system, amibroker, exploration

TTF is a nice indicator. it gives accureate signals most of the times. The parameters need to be optimized as per individual shares. I do not know where i got this from but i have bee using this successfully. The original name is ORB. I have changed the indicator to include the fibonicci levels.

Screenshots

Similar Indicators / Formulas

OPTIMIZED ICHIMOKU
Submitted by ritesh.bafna88 about 12 years ago
Reaction Trend System
Submitted by ajayjain90 over 14 years ago
Behgozin Strength Finder
Submitted by hotaro3 about 12 years ago
KPL with RSI
Submitted by pdkg_gal over 14 years ago
Intraday Trend Break System
Submitted by nishantndk over 14 years ago
ema crossovers
Submitted by rushee.g1100 over 14 years ago

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("ORB");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
//Plot( C, "Close", ParamColor("Color", colorYellow ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
if( ParamToggle("Tooltip shows", "All Values|Only Prices" ) )
{
 ToolTip=StrFormat("Open: %g\nHigh:  %g\nLow:   %g\nClose:  %g (%.1f%%)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 )));
}


//An n Bar Reversal Program
//The theory says that this indicator gives reliable signals of strong trends.
//Its disadvantage is that the signal can be a little late, but is offset by its reliability.
// An uptrend is assumed to be in place if todays high is higher than those
// of the previous n days,and a downtrend is in place when todays low is lower 
//than those of the previous n days. Otherwise the existing trend persists.
//n is commonly set at 3 but can be any value.
//The implementation here simply shows arrows at trend reversals.

n= Param("No. of Bars",50,2,500,1); //default values for n as 3,2,8,1
TrendUp = H > Ref(HHV(H,n),-1);
TrendDn = L < Ref(LLV(L,n),-1);
TrendUp = ExRem(TrendUp,TrendDn);
TrendDn = ExRem(TrendDn,TrendUp);

Buy1 = TrendUp;
Short1= TrendDn;
Sell1 = TrendDn;
Cover1 = TrendUp;

Buy1 = ExRem(Buy1,Sell1);
Sell1 = ExRem(Sell1,Buy1);
Short1 = ExRem(Short1,Cover1);
Cover1 = ExRem(Cover1,Short1);

Filter = Buy1 OR Sell1;
Filter = Short1 OR Cover1;
PlotShapes(Buy1*shapeUpArrow,colorWhite);
PlotShapes(Sell1*shapeDownArrow,colorWhite);


_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
//Plot( C, "Close", ParamColor("Color", colorGold ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_BEGIN("CrH-L Prec");


function TTF( periods )
{
BuyPower = HHV( High, periods ) - Ref( LLV( Low, periods ), -periods );
SellPower = Ref( HHV( High, periods ), -periods ) - LLV( Low, periods );
return 100 * (BuyPower - SellPower) / (1* (BuyPower + SellPower));
} 
ttf15 = TTF( 15 );

//Plot( ttf15, "TTF(15)", colorRed );
OptimizerSetEngine("trib");

OptimizerSetOption("MaxEval", 5000 ); // 5000 evaluations 

bt = Param( "Buy Trigger", 42, -150, 150, 1 );
st = Param( "Sell Trigger", -54, -100, 60, 1 );

Buy2 = Cross( ttf15, bt );
Sell2 = Cross( -st, ttf15 );


Buy2   = ExRem(Buy2, Sell2);
Sell2  = ExRem(Sell2, Buy2);


//Plot( Close, "Price", colorBlack, styleCandle );


PlotShapes(IIf(Buy2,shapeUpArrow,shapeNone),colorGreen,0,L,-15);
PlotShapes(IIf(Buy2,shapeHollowUpArrow,shapeNone),colorWhite,0,L,-15);
PlotShapes(IIf(Buy2,shapeHollowSmallCircle,shapeNone),colorWhite,0,BuyPrice,0);

PlotShapes(IIf(Sell2,shapeDownArrow,shapeNone),colorRed,0,H,-15);
PlotShapes(IIf(Sell2,shapeHollowDownArrow,shapeNone),colorWhite,0,H,-15);
PlotShapes(IIf(Sell2,shapeHollowSmallCircle,shapeNone),colorWhite,0,SellPrice,0);
_SECTION_END();
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
//Plot( C, "Close", ParamColor("Color", colorYellow ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
if( ParamToggle("Tooltip shows", "All Values|Only Prices" ) )
{
 ToolTip=StrFormat("Open: %g\nHigh:  %g\nLow:   %g\nClose:  %g (%.1f%%)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 )));
}


ttf15 = TTF( 15 );

//Plot( ttf15, "TTF(15)", colorRed );
OptimizerSetEngine("trib");

OptimizerSetOption("MaxEval", 5000 ); // 5000 evaluations 

bt = Param( "Buy Trigger", -63, -150, 150, 1 );
st = Param( "Sell Trigger", 4, -100, 60, 1 );

Buy3 = Cross( ttf15, bt );
Sell3 = Cross( -st, ttf15 );

Buy = Buy2 OR Buy3 ;
Sell = Sell2 OR Sell3 ;

Buy   = ExRem(Buy, Sell);
Sell  = ExRem(Sell, Buy);


//Plot( Close, "Price", colorBlack, styleCandle );


PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,L,-15);
PlotShapes(IIf(Buy,shapeHollowUpArrow,shapeNone),colorWhite,0,L,-15);
PlotShapes(IIf(Buy,shapeHollowSmallCircle,shapeNone),colorWhite,0,BuyPrice,0);

PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,H,-15);
PlotShapes(IIf(Sell,shapeHollowDownArrow,shapeNone),colorWhite,0,H,-15);
PlotShapes(IIf(Sell,shapeHollowSmallCircle,shapeNone),colorWhite,0,SellPrice,0);
if (EndValue(Buy)==1) Say("Buy for long peiod immediately but please confirm with nine trade chart"); 
if (EndValue(Sell)==1) Say("Sell for long period immediately but please confirm with nine trade chart");
_SECTION_END(); 

_SECTION_END();

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
if( ParamToggle("Tooltip shows", "All Values|Only Prices" ) )
{
 ToolTip=StrFormat("Open: %g\nHigh:  %g\nLow:   %g\nClose:  %g (%.1f%%)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 )));
}
//DynamicSR 
iPeriods = Param("iPeriods",200 ,1, 200,1); 
Dynamic_R = HHV(H,iPeriods); 
Dynamic_S = LLV(L,iPeriods); 

Dynamic_R = IIf(H >= Dynamic_R, H, Dynamic_R); 
Dynamic_S = IIf(L <= Dynamic_S ,L,Dynamic_S); 
 
DynamicRange = Dynamic_R - Dynamic_S; 
fib1 = Dynamic_S + .24 * DynamicRange; 
fib2 = Dynamic_S + .38 * DynamicRange; 
fib3 = Dynamic_S + .50 * DynamicRange; 
fib4 = Dynamic_S + .62 * DynamicRange; 
fib5 = Dynamic_S + .76 * DynamicRange; 



Plot(Dynamic_R,"DR",colorRed,1); 
Plot(Dynamic_S,"DS",colorBlue,1); 
Plot(fib1,"F1", colorPaleGreen,1|styleDashed); 
Plot(fib2,"F2", colorBrown,1|styleDashed); 
Plot(fib3,"F3", colorWhite,1|styleDashed); 
Plot(fib4,"F4", colorDarkYellow,1|styleDashed); 
Plot(fib5,"F5", colorGold,1|styleDashed);  
  
 

 
 
					_SECTION_END();

9 comments

1. anil

not working
showing syntax error 30 at

ttf15 = TTF;
//Plot( ttf15, “TTF”, colorRed ); OptimizerSetEngine(“trib”);
OptimizerSetOption(“MaxEval”, 5000 ); // 5000 evaluations

2. vaenu999

me also not working

3. ramantondon

IT IS WORKING FINE AT MY END. i HAVE COPIED FROM HERE AGAIN TO CHECK , THERE IS NO PROBLEM.

4. tigernifty

Dear frind, am try this afl, but not working, showing some errot, pls try to solve the problem. thank you.

5. cnbondre

HI,

Admin,ramantondon and other friends,

I have blocked the following lines will it make any difference?
Anybody can suggest a better way,please?
Comments please, it is really a good afl.

//OptimizerSetEngine(“trib”);
//OptimizerSetOption(“MaxEval”, 5000 ); // 5000 evaluations

6. administrator

No that shouldn’t matter. It only matters when running a very long optimization.

7. ramantondon

PLEASE REMOVE THE FOLLOWING LINES AND SEE IF THIS WORKS. ANY WAY, IT WORKS EVEN WITH THESE LINES AND WITHOUT THESE LINES AT MY END. THESE LINES HAVE BEEN INCLUDED FOR OPTIMIZATION AS PER DIFFERENT STOCKS WITH A SPECIAL LOGARITHM.
//Plot( ttf15, “TTF”, colorRed ); OptimizerSetEngine(“trib”); OptimizerSetOption(“MaxEval”, 5000 ); // 5000 evaluations

8. tigernifty

Dear sir, this formula give some error, line 59,60 and more 2 lines..pls try to rectify..thanks.

9. joeoil

Works fine here, backtesting and indicator.

Amibroker v. 5.30

Leave Comment

Please login here to leave a comment.

Back