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

Trade with several indicators for Amibroker (AFL)

Copy & Paste Friendly
//============== PRICE ==============
_SECTION_BEGIN("Price");
	n = 15;
	a = C > ( MA( H, n ) + MA( L, n ) ) / 2;// then Buy next bar at market;
	b = C < ( MA( H, n ) + MA( L, n ) ) / 2;// then Sell Short next bar at market;
	state = IIf( BarsSince( a ) < BarsSince( b ), 1, 0 );
	Longs = state == 1;
	shorts = state == 0;
	Colorbar = IIf( Longs, colorseaGreen, IIf( Shorts, colorRed, colorGrey40 ) );
	Plot( C, "Close", Colorbar, styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();

//============== VOLUME ==============
_SECTION_BEGIN("VOLUME");
	Volume_to = Sum(Volume, 31);
	Volume_to = Volume_to - Volume;
	Volume30 = Volume_to / 30;
	percentage = ( abs( Volume - Volume30 ) ) / Volume30;
	percentage = percentage * 100;
_SECTION_END();

//============== MACD ==============
_SECTION_BEGIN("MACD");
	r1 = Param( "Fast avg", 12, 2, 200, 1 );
	r2 = Param( "Slow avg", 26, 2, 200, 1 );
	r3 = Param( "Signal avg", 9, 2, 200, 1 );
	ml = MACD(r1, r2);
	sl = Signal(r1,r2,r3);
	Hitg = ml-sl;
	MACUP = Hitg > Ref(Hitg,-1);
	MACDN = Hitg < Ref(Hitg,-1);

			
	Period = Optimize("Period", 17, 2, 200, 1);
	EMACALC = EMA(C, Period);
	COND1 = Close > EMACALC AND MACD() > Signal();
	COND2 = Close > EMACALC AND MACD() < Signal() OR Close < EMACALC AND MACD() > Signal();
	COND3 = Close < EMACALC AND MACD() < Signal();
	 
	UPBAR = COND1;
	DOWNBAR = COND2 OR COND3;
_SECTION_END();

//============== VOLUME ==============
_SECTION_BEGIN("VOLUME");
	Volume_to = Sum(Volume, 10);
	Volume_to = Volume_to - Volume;
	Volume10 = Volume_to / 10;
	percentage = ( abs( Volume - Volume10 ) ) / Volume10;
	percentage = percentage * 100;
_SECTION_END();

//============== RSI ==============
_SECTION_BEGIN("RSI");
	periods = Param( "Periods", 14, 1, 200, 1 );
	z = RSI( periods);
	
	Lookback = Param("LookBack", 10, 10, 50, 1); // Default for interday commodity currency trading
	Lookback = 15;
	H11 = LastValue(Ref(HHV(RSI(14), Lookback),  - 1));
	L11 = LastValue(Ref(LLV(RSI(14), Lookback),  - 1));
_SECTION_END();

_SECTION_BEGIN("MCDX - Multi Color Dragon Extended");

	GraphXSpace    = Param("GraphXSpace - Zoom Chart",10,5,300,5);   //Chon che do Zoom

	Bankerbase     = Param("Banker Base", 50, 10, 100, 1);
	Bankerperiod   = Param("Banker Period", 50, 10, 100, 1);
	Hotbase        = Param("Hot Base", 30, 10, 100, 1);
	Hotperiod      = Param("Hot Period", 40, 10, 100, 1);
	Bankersen      = Param("Banker Sensitivity", 1.5, 0.1, 10, 0.1);
	Hotsen         = Param("Hot Sensitivity", 0.7, 0.1, 10, 0.1);
	MAbankerPeriod = Param("MA Banker Period ", 10,  1, 260, 1); 

	Banker_rsi     = Bankersen * (RSI(Bankerperiod) - Bankerbase);
	Hot_rsi        = Hotsen * (RSI(Hotperiod) - Hotbase);
	Banker         = IIf(Banker_rsi > 20, 20, IIf(Banker_rsi < 0, 0, Banker_rsi));
	Hot            = IIf(Hot_rsi > 20, 20, IIf(Hot_rsi < 0, 0, Hot_rsi));

	Retailcolor    = ParamColor("Retail Color", colorRed);
	MAbanker       = MA(Banker,MAbankerPeriod); 
	Bankercolor    = IIf(Banker>=MAbanker OR Banker>=20, ParamColor("Banker Color", colorGreen),IIf(Banker<MAbanker,colorSeaGreen,Null));

_SECTION_END();

//============== TITLE ==============
_SECTION_BEGIN("Price");
	SetChartOptions(0,chartShowArrows|chartShowDates);
	dec = (Param("Decimals",2,0,7,1)/10)+1;
			Title = EncodeColor(55)	+  Title = 
			EncodeColor(41)+ Name() + " - Trade + - " + 
			EncodeColor(41)+ FullName() + "     " + 
			EncodeColor(32)+ Date() + "      " 	+ EncodeColor(5) + "{{INTERVAL}}  " +
			EncodeColor(55)+ "  -   Open = "		+ EncodeColor(52)+ WriteVal(O,dec) 	+ 
			EncodeColor(55)+ "  -   High = "		+ EncodeColor(5) + WriteVal(H,dec) 	+
			EncodeColor(55)+ "  -   Low = "		+ EncodeColor(32)+ WriteVal(L,dec) 	+ 
			EncodeColor(55)+ "  -   Close = "		+ EncodeColor(52)+ WriteVal(C,dec)	+
			EncodeColor(55)+ "  -   % Change = "		+ EncodeColor(52)+ WriteVal((C-Ref(C,-1))/Ref(C,-1)*100,dec)	+
			EncodeColor(55)+ "  -   Volume = "	+ EncodeColor(52)+ WriteVal(V,1) +
			EncodeColor(55)+ "  -   Volume 10 = "	+ EncodeColor(52)+ WriteVal(Volume10,1);
_SECTION_END();

_SECTION_BEGIN("TOP BOTTOM");
	sen = Param("% change",5,0.1,25,0.1);
	High = Peak( H, Sen ) ; 
	Low = Trough( L, Sen ) ;
	Mid = (H+L)/2; 
	Top = High;    
	Bottom = Low;   
	//Plot(Top,"TOP",colorGreen,styleDots|styleNoLine|styleNoRescale);
	//Plot(Bottom,"BOTTOM",colorRed,styleDots|styleNoLine|styleNoRescale); 
_SECTION_END();

//============== Fib Retracements ==============
//_SECTION_BEGIN("Fib Retracements");
//	fibs = ParamToggle("Plot Fibs","Off|On",1);
//	pctH = Param ("Pivot Hi %", 0.325,0.001,2.0,0.002);
//	HiLB = Param ("Hi LookBack",1,1,BarCount-1,1);
//	pctL = Param ("Pivot Lo %", 0.325,0.001,2.0,0.002);
//	LoLB = Param ("Lo LookBack",1,1,BarCount-1,1);
//	Back = Param ("Extend Left = 2",1,1,500,1);
//	Fwd  = Param("Plot Forward", 0, 0, 500, 1);
//	text = ParamToggle("Plot Text","Off|On",1);
//	hts  = Param ("Text Shift", -33.5,-50,50,0.10);
//	style =ParamStyle("Line Style",styleLine,styleNoLabel);
//	x = BarIndex();
//	pRp  = PeakBars( H, pctH, 1) == 0;
//	yRp0 = SelectedValue(ValueWhen( pRp, H, HiLB));
//	xRp0 = SelectedValue(ValueWhen( pRp, x, HiLB));
//	pSp  = TroughBars( L, pctL, 1) == 0;
//	ySp0 = SelectedValue(ValueWhen( pSp, L, LoLB));
//	xSp0 = SelectedValue(ValueWhen( pSp, x, LoLB));
//	Delta = yRp0 - ySp0;

//	function fib(ret)
//	{
//		retval = (Delta * ret);
//		Fibval = IIf(ret < 1.0 
//		AND xSp0 < xRp0, yRp0 - retval, IIf(ret < 1.0 
//		AND xSp0 > xRp0, ySp0 + retval,IIf(ret > 1.0 
//		AND xSp0 < xRp0, yRp0 - retval, IIf(ret > 1.0 
//		AND xSp0 > xRp0, ySp0 + retval, Null)))); 
//		return FibVal;
//		}

//	x0 = Min(xSp0,xRp0)-Back;
//	x1 = (BarCount -1);
	////////////////////////////////////////////////////////////////
//	r236 = fib(0.236);	r236I = LastValue (r236,1);
//	r382 = fib(0.382);	r382I = LastValue (r382,1);
//	r050 = fib(0.50);		r050I = LastValue (r050,1);
//	r618 = fib(0.618);	r618I = LastValue (r618,1);
//	r786 = fib(0.786);	r786I = LastValue (r786,1);
//	e127 = fib(1.27);		e127I = LastValue (e127,1);
//	e162 = fib(1.62);		e162I = LastValue (e162,1);
//	e200 = fib(2.00);		e200I = LastValue (e200,1);
//	e262 = fib(2.62);		e262I = LastValue (e262,1);
//	e424 = fib(4.24);		e424I = LastValue (e424,1);
	////////////////////////////////////////////////////////////////
//	p00 = IIf(xSp0 > xRp0,ySp0,yRp0); 	p00I = LastValue (p00,1);
//	p100 = IIf(xSp0 < xRp0,ySp0,yRp0); 	p100I = LastValue (p100,1);
//	color00 =IIf(xSp0 > xRp0,colorLime,colorRed);
//	color100 =IIf(xSp0 < xRp0,colorLime,colorRed);
	////////////////////////////////////////////////////////////////
//	numbars = LastValue(Cum(Status("barvisible")));
//	fraction= IIf(StrRight(Name(),3) == "", 3.2, 3.2);
	////////////////////////////////////////////////////////////////
//	if(fibs==1)
//	{
//		Plot(LineArray(xRp0-Fwd,yRp0,x1,yRp0,Back),"PR",colorGreen,8|styleNoRescale,Null, Null,Fwd);
//		Plot(LineArray(xSp0-Fwd,ySp0,x1,ySp0,Back),"PS",colorRed,8|styleNoRescale,Null, Null,Fwd);
//	}
//_SECTION_END();

_SECTION_BEGIN("Background text");
C11=ParamColor("up panel",colorDarkOliveGreen );
C12=ParamColor("dn panel",colorDarkGrey );
C13=Param("fonts",20,10,30,1 );
C14=Param("left-right",2.1,1.0,5.0,0.1 );
C15=Param("up-down",12,1,20,1 );
Miny = Status("axisminy");
Maxy = Status("axismaxy");
lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
pxwidth = Status("pxwidth");
pxheight = Status("pxheight");
GfxSetBkMode( 0 ); 
GfxSetOverlayMode(1);
GfxGradientRect(0,0,pxwidth, pxheight, C11, C12 ); 
GfxSelectFont("Tahoma", Status("pxheight")/C13 );
GfxSetTextAlign( 6 );
GfxTextOut( Name(), Status("pxwidth")/C14, Status("pxheight")/C15 );
GfxSelectFont("Tahoma", Status("pxheight")/C13*0.5 );
//GfxTextOut( "Volatility Bands - stocks", Status("pxwidth")/C14, Status("pxheight")/C15*2.5 );
GfxSelectFont("Tahoma", Status("pxheight")/C13*0.5 );
//GfxTextOut( " www.TAtechnics.in", Status("pxwidth")/C14, Status("pxheight")/C15*4 );
_SECTION_END();


SPWidth=param("Swing Point Width",9,7,13,2); //suggest 7,9,13

HV=HighestVisibleValue(H);
LV=LowestVisibleValue(L);
ymin=LV-.05*(hv-lv);
ymax=HV+.05*(hv-lv);
SetChartOptions(1,1,chartGridMiddle,ymin,ymax);

HB=Max(C,O);
LB=Min(C,O);
sp1=sp2=0;

sph = (HB==HHV(HB,SPWidth)) AND (HB==Ref(HHV(HB,SPWidth),SPWidth-1));
spl = (LB==LLV(LB,SPWidth)) AND (LB==Ref(LLV(LB,SPWidth),SPWidth-1));

lasti=0;
	for(i=0;i<=BarCount-1;i++){
		if(sph[i] AND sph[lasti]){
			if(HB[i]>HB[lasti]){
				sph[lasti]=0;
			}else{
				sph[i]=0;
			}	
		}	
		if(spl[i] AND spl[lasti]){
			if(LB[i]<LB[lasti]){
				spl[lasti]=0;
			}else{
				spl[i]=0;
			}	
		}
		if(sph[i] OR spl[i])	
			lasti=i;
	}		

BullBearZone = ( High - Low ) / 3;
bullbar = C > ( High - BullBearZone );
bearbar = C < ( Low + BullBearZone );

_SECTION_BEGIN("RRC");
	ticker= ParamStr("ticker","VNINDEX");
	Value = Param( "Trx Value (in Billion)", 50, 0, 1000, 1 );

	function getrs ( sc, t )
	{
		bc = Foreign(Ticker,"Close");
		sbr = sc / bc;

		rs1 = MA( sbr, 12 );
		rs2 = MA( sbr, 26 );
		rs = 100 * ( ( rs1 - rs2 ) / rs2 + 1 );

		rm1 = MA( rs, 1 );
		rm2 = MA( rs, 9 );
		rm = 100 * ( ( rm1 - rm2 ) / rm2 + 1 );

		return IIf( t, rs , rm ) - 100;
	}

	rs = getrs( C, 1 );
	rm = getrs( C, 0 );

	Lagging = rs < 0 AND rm < 0;
	Improving = rs < 0 AND rm > 0;
	Leading = rs > 0 AND rm > 0;
	Weakening = rs > 0 AND rm < 0;

	pos = WriteIf( Lagging, "3. Lagging",
	               WriteIf( Improving, "4. Improving",
	                        WriteIf( Leading, "1. Leading",
	                                 WriteIf( Weakening, "2. Weakening", "5." ) ) ) );
	                                                            
	poss = IIf( Lagging, 3,
	               IIf( Improving, 4,
	                        IIf( Leading, 1,
	                                 IIf( Weakening, 2, 5 ) ) ) );

	qcolor = IIf( Lagging, colorOrange,
				  IIf( Improving, colorSkyblue,
					   IIf( Leading, colorBrightGreen,
							IIf( Weakening, colorYellow, colorLightGrey ) ) ) );

	VAL = V * C / ( 10 ^ 9 * 0.01);
	Chg = ROC( C, 1 );
_SECTION_END();

Buy = 	(state == 1 AND UPBAR) OR (C>TOP AND Ref(C,-1)<=TOP) AND bearbar //(Ref(state,1) == 1 AND Ref(UPBAR,1) AND (Banker>=MAbanker OR Banker>=20) AND Banker > MA(Banker,10)) OR (C>TOP AND Ref(C,-1)<=TOP)
	;
Sell= 	(state == 0 AND DOWNBAR) AND Ref(state,-3) == 1//Ref(state,1) == 0 AND Ref(DOWNBAR,1)
	;

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

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

PlotShapes(IIf(Buy,shapeHollowSmallUpTriangle,shapeNone),colorYellow,0,Graph0Low,-12);
PlotShapes(IIf(Sell,shapeHollowSmallDownTriangle,shapeNone),colorWhite,0,Graph0High,-12);

Filter = pos == "1. Leading" OR pos == "4. Improving";
	
Filter = Filter AND (Buy OR Sell) AND V>1000000 AND V>5;


	
//----------------------------------------------------------------------------------------------
AddColumn( IIf( Buy, 66,1 ), "Buy", formatChar, 1, bkcolor =IIf (Buy,colorGreen, colorRed ));
AddColumn( IIf( Sell, 83,1 ), "Sell", formatChar, 1, bkcolor =IIf (Sell,colorRed, colorGreen ));
AddColumn(C, "Close",1.2,colorYellow,colorCustom16);
AddColumn(Top, "Top",1.2,colorGreen);
AddColumn(Bottom, "Bottom",1.2,colorRed);
AddColumn(IIf((C>TOP AND Ref(C,-1)<=TOP),1,0), "Break",1.2,colorDefault);
AddColumn(Volume,"Volume Today", 1.2,colorYellow,colorCustom16);
AddColumn(Volume10,"Ave 10 days Volume", 1, colorBlue);
AddColumn(Percentage," % Increase", 1.2, colorBlue);
AddColumn(z,"RSI", 1.2,IIF(z >= 50, colorSeaGreen,colorRed));
//----------------------------------------------------------------------------------------------	
AddColumn(Ref(C,1),"Price 1D",1.2);
	_Change1d = IIf(Buy,((Ref(C,1)-Close)/Close)*100,IIf(Sell,((Close-Ref(C,1))/Ref(C,1))*100,((Ref(C,1)-Close)/Close)*100));
AddColumn(_Change1d,"% Price 1D",1.2,IIf(_Change1d >= 0,colorGreen,colorRed));
AddColumn(Ref(C,3),"Price 3D",1.2);
	_Change3d = IIf(Buy,((Ref(C,3)-Close)/Close)*100,IIf(Sell,((Close-Ref(C,3))/Ref(C,3))*100,((Ref(C,1)-Close)/Close)*100));
AddColumn(_Change3d,"% Price 3D",1.2,IIf(_Change3d >= 0,colorGreen,colorRed));
AddColumn(Ref(C,5),"Price 1W",1.2);
	_Change5d = IIf(Buy,((Ref(C,5)-Close)/Close)*100,IIf(Sell,((Close-Ref(C,5))/Ref(C,5))*100,((Ref(C,1)-Close)/Close)*100));
AddColumn(_Change5d,"% Price 1W",1.2,IIf(_Change5d >= 0,colorGreen,colorRed));
AddColumn(Ref(C,20),"Price 1M",1.2);
	_Change20d = IIf(Buy,((Ref(C,20)-Close)/Close)*100,IIf(Sell,((Close-Ref(C,20))/Ref(C,20))*100,((Ref(C,1)-Close)/Close)*100));
AddColumn(_Change20d,"% Price 1M",1.2,IIf(_Change20d >= 0,colorGreen,colorRed));
//----------------------------------------------------------------------------------------------
SetSortColumns(2,4,5);
Back