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

Intraday Trend Break System for Amibroker (AFL)

Rating:
3 / 5 (Votes 6)
Tags:
trading system, amibroker, exploration
Author : Nishant Kulkarni (nishantndk@yahoo.com)

Intraday Trend Break System. This system is based on the double bottom and double top detection technique. A line joining two tops when connected together and another line joining bottom line is connected together and when both line extended forms a funnel and a break outside gives very strong break out.

It is recomended to have Heikin Ashi plot bellow main price plot as confirmation. Big heikin ashi candles confirm price movement.

Note: Use 15 Minute interval for better result.

Disclaimer – Trade with caution. Author does not take any responsibility. The system is to guide traders and does not
guaranty any performance. The system is used in Indian market condition. For other markets, may need to be altered slightly. However I am personally using this system and booking profit, hence contributing
this formula for community as give back.

Similar Indicators / Formulas

OPTIMIZED ICHIMOKU
Submitted by ritesh.bafna88 over 11 years ago
Reaction Trend System
Submitted by ajayjain90 almost 14 years ago
Behgozin Strength Finder
Submitted by hotaro3 over 11 years ago
KPL with RSI
Submitted by pdkg_gal almost 14 years ago
ema crossovers
Submitted by rushee.g1100 over 13 years ago
mutlitime frame with trendline
Submitted by nsetraderonline over 13 years ago

Indicator / Formula

Copy & Paste Friendly
/**
*  ######         Intraday Trend Break System          ########
*
* Author : Nishant Kulkarni (nishantndk@yahoo.com)
*
* Intraday Trend Break System. This system is based on the double bottom and double top detection technique.
* A line joining two tops when connected togather and another line joining bottom line is connected togather 
* and when both line extended forms a funnel and a break outside gives very strong break out. 
* 
*
* It is recomended to have Heikin Ashi plot bellow main price plot as confirmation. Big heikin ashi candles confirm 
* price movement. 
* 
* Note: Use 15 Minute interval for better result. 
* 
* Disclaimer - Trade with caution. Author does not take any responsibility. The system is to guide traders and does not 
*              guaranty any performance. However I am personally using this system and booking profit, hence contributing 
*              this formula for community as give back. 
*
*/

_SECTION_BEGIN("INIT");

	SetChartOptions(0,chartShowArrows|chartShowDates);
	ScanLookBack = Param("Scan Lookback", 2, 1, 25 );
	fraction= IIf(StrRight(Name(),3) == "", 3.2, 3.2);

_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, _DEFAULT_NAME(), colorBlack , styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();

_SECTION_BEGIN("Up Trend Line");
	
	UTValue1=LastValue(Trough(L,0.5,2)); 
	UTValue2=LastValue(Trough(L,0.5,1));
	UTBar1=BarCount - 1 - LastValue(TroughBars(L,0.5 ,2)); 
	UTBar2=BarCount - 1 - LastValue(TroughBars(L,0.5 ,1));  
	UpTrendLine = LineArray( UTBar1, UTValue1, UTBar2,UTValue2, 1 );
	UTLine = LineArray( UTBar1, UTValue1, UTBar2,UTValue2, 0 );
	Plot( UpTrendLine , _DEFAULT_NAME(), colorGreen,styleLine | styleNoTitle | styleNoLabel); 
	Plot( UTLine , _DEFAULT_NAME(), colorGreen,styleLine | styleNoTitle | styleNoLabel); 

_SECTION_END();


_SECTION_BEGIN("Down Trend Line");

	DTValue1=LastValue(Peak(H,0.5 ,2)); 
	DTValue2=LastValue(Peak(H,0.5 ,1)); 
	DTBar1=BarCount - 1 - LastValue(PeakBars(H,0.5 ,2)); 	
	DTBar2=BarCount - 1 - LastValue(PeakBars(H,0.5 ,1));  
	DownTrendLine = LineArray( DTBar1, DTValue1, DTBar2,DTValue2, 1 );
	DTLine = LineArray( DTBar1, DTValue1, DTBar2,DTValue2, 0 );

	Plot( DownTrendLine ,_DEFAULT_NAME(), colorRed,styleLine | styleNoTitle | styleNoLabel); 
	Plot( DTLine ,_DEFAULT_NAME(), colorRed,styleLine | styleNoTitle | styleNoLabel);
	
	PlotText("PV = " + WriteVal(DTValue2 ,fraction), LastValue(BarIndex())+2, (DTValue2 ), colorRed);
	PlotText("TV = " + WriteVal(UTValue2,fraction), LastValue(BarIndex())+2, UTValue2, colorGreen);
	PlotOHLC( UpTrendLine , UpTrendLine , DownTrendLine , DownTrendLine , "", colorYellow, styleCloud | styleNoRescale);
	
	Plot(LineArray( DTBar2, DTValue2, BarCount,DTValue2, 0 ),"",colorRed);
	Plot(LineArray( UTBar2, UTValue2, BarCount,UTValue2, 0 ),"",colorGreen);

_SECTION_END();

_SECTION_BEGIN("Pivot");

	YH = TimeFrameGetPrice("H", inDaily, -1);		// yesterdays high
	YL = TimeFrameGetPrice("L", inDaily, -1);		//				low
	YC = TimeFrameGetPrice("C", inDaily, -1);		//				close
	TO = TimeFrameGetPrice("O", inDaily);			// current day open

	//Normal Pivot
	PP = (YH + YL + YC) / 3;
	R1 = (2 * PP) - YL;
	R2 = PP + (YH - YL);
	R3 = YH + 2*(PP-YL);
	S1 = (2 * PP) - YH;
	S2 = PP - (YH - YL);
	S3 = YL - 2*(YH - PP) ;
	
_SECTION_END();

_SECTION_BEGIN("Title");

Title = EncodeColor(colorBlack)+ Date() + "   Close = " + EncodeColor(colorRed) +Close +
		EncodeColor(colorBlack) + "     Open = " + EncodeColor(colorBlack) + O + 
		EncodeColor(colorBlack) + "     High = " + EncodeColor(5) + H +
		EncodeColor(colorBlack) + "      Low = " + EncodeColor(colorRed) + L +
		EncodeColor(colorBlack) + "     Volume = " + EncodeColor(colorBlack) + V + "\n\n"+
		EncodeColor(colorBlack) + "Pivot Point= " + EncodeColor(colorBlack) + PP +
		EncodeColor(colorBlack) + "     Day's Open= " + EncodeColor(colorBlack) + TO +"\n\n"+
		EncodeColor(colorGreen) + "If days open is greater than Pivot Point, market is in uptrend and \n"+EncodeColor(colorRed)+"if days Open is less than Pivot Point, market is in downtrend" +"\n\n"+
		EncodeColor(colorRed) + "R1= " + EncodeColor(colorBlack) + R1 +
		EncodeColor(colorRed) + "  R2= " + EncodeColor(colorBlack) + R2 +
		EncodeColor(colorRed) + "  R3= " + EncodeColor(colorBlack) + R3 +"\n"+
		EncodeColor(colorGreen) + "S1= " + EncodeColor(colorBlack) + S1 +
		EncodeColor(colorGreen) + "  S2= " + EncodeColor(colorBlack) + S2 +
		EncodeColor(colorGreen) + "  S3= " + EncodeColor(colorBlack) + S3 +"\n"+
		EncodeColor( colorBlack) +"____  _____  _______  _______  _______"+"\n";
 
_SECTION_END();

_SECTION_BEGIN("Target"); 

	CBuy = Cross(C,DownTrendLine);
	CSell = Cross(UpTrendLine ,C);

	baratbuy = ValueWhen(CBuy ,BarIndex()) ;
	baratsell = ValueWhen(CSell ,BarIndex()) ;

	PlotShapes(shapeUpTriangle* CBuy ,colorBlue,O,L);
	PlotShapes(shapeDownTriangle * CSell ,colorRed,O,H);


_SECTION_END();

_SECTION_BEGIN("Auto");


	Buy  = ( CBuy ) AND  ( (BarCount - baratbuy )<=ScanLookBack ); 
	Sell = ( CSell ) AND  ( (BarCount - baratsell )<=ScanLookBack  ) ;

	price = C[BarCount-1];

	AlertIf(Buy,"","Buy @"+C+"  Price @ Trigger="+price,1);
	AlertIf(Sell,"","Sell @"+C+"  Price @ Trigger="+price,2);

	Filter =  Buy OR Sell ;

	Var = WriteIf(Buy,"BUY",WriteIf(Sell,"SELL",""));

	AddTextColumn( Var , "Buy/Sell", 1.2 , colorBlack, IIf( Buy, colorLime, IIf(Sell,colorOrange,colorWhite) ));	
	AddColumn(price ,"Price",1.2,colorBlack, IIf( Buy, colorLime, IIf(Sell,colorOrange,colorWhite) ));
	AddColumn(C ,"Price @ Trigger",1.2,colorBlack, IIf( Buy, colorLime, IIf(Sell,colorOrange,colorWhite) ));

	stoploss = IIf(Buy, (price  * (1-0.01)) , IIf(Sell, (price  * (1+0.01)),0));
	target1per = IIf(Buy, (price  * (1+0.01)) , IIf(Sell, (price  * (1-0.01)),0));
	target15per = IIf(Buy, (price  * (1+0.015)) , IIf(Sell, (price * (1-0.015)),0));
	target2per = IIf(Buy, (price  * (1+0.02)) , IIf(Sell, (price  * (1-0.02)),0));
	
	AddColumn(stoploss ,"Stop Loss",1.2,colorBlack, IIf( Buy, colorLime, IIf(Sell,colorOrange,colorWhite) ));
	AddColumn(target1per ,"1% Target",1.2,colorBlack, IIf( Buy, colorLime, IIf(Sell,colorOrange,colorWhite) ));
	AddColumn(target15per ,"1.5% Target",1.2,colorBlack, IIf( Buy, colorLime, IIf(Sell,colorOrange,colorWhite) ));
	AddColumn(target2per ,"2% Target",1.2,colorBlack, IIf( Buy, colorLime, IIf(Sell,colorOrange,colorWhite) ));
	AddColumn(V ,"Volume",1.2,colorBlack, IIf( Buy, colorLime, IIf(Sell,colorOrange,colorWhite) ));
	
	bardiff = BarCount - IIf(Buy,baratbuy,IIf(Sell,baratsell,0));
	AddColumn(bardiff  ,"Bar Diff",1.2,colorBlack, IIf( Buy, colorLime, IIf(Sell,colorOrange,colorWhite) ));


_SECTION_END();

3 comments

1. nishantndk

The code is fixed to support earlier version of Amibroker.

2. sjagadish4u

very good one. thanks

3. vijayss

Hi Nishant,

This appears to be good.

The backtest shows only 1 trade for last 45 days even after adding
Cover = Buy;
Short = Sell;

Can you please modify so a backtest be rub?

Thaks

Leave Comment

Please login here to leave a comment.

Back