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

Profitunity for Amibroker (AFL)
tandy_lau
almost 10 years ago
Amibroker (AFL)

Rating:
3 / 5 (Votes 7)
Tags:
amibroker, fractal

This is base on book Profitunity
The Profitunity is base on Alligator and WiseMan from Bill Williams.
This Formula is not mine, I just combine the afl found on wisestocktrader.com and custom it a little to macth the book http://www.bukabuku.com/browses/product/9786021868638/trading-with-profitunity-1.html

Here is the screenshot:
screenshot

book look like:
book

Indicator / Formula

Copy & Paste Friendly
// Profitunity-Buku

_SECTION_BEGIN( "Price" );
SetChartOptions( 0, chartShowArrows | chartShowDates );
_N( Title = StrFormat( "{{NAME}} - {{INTERVAL}} {{DATE}}  Open %g,  High %g,  Low %g,  Close %g (%.1f%%)  \n{{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
Plot( C, "Close", ParamColor( "Color", colorDefault ), styleNoTitle | ParamStyle( "Style" ) | GetPriceStyle() );
_SECTION_END();

// BUAYA
A = (H+L)/2 ;
BuayaBiru   = Ref(Wilders(A,13),-8);
Plot(BuayaBiru, "Rahang", colorBlue, styleLine );
BuayaMerah   = Ref(Wilders(A,8),-5);
Plot(BuayaMerah, "Gigi", colorRed, styleLine );
BuayaHijau   = Ref(Wilders(A,5),-3);
Plot(BuayaHijau, "Bibir", colorGreen, styleLine );

// FRACTAL

// Fraktal Naik
fUpA =
    ( Ref( H, -2 )  > Ref( H, -4 ) ) AND
    ( Ref( H, -2 )  > Ref( H, -3 ) ) AND
    ( Ref( H, -2 )  > Ref( H, -1 ) ) AND
    ( Ref( H, -2 )  > H );

fUpB =
    ( Ref( H, -2 )  > Ref( H, -5 ) ) AND
    ( Ref( H, -2 )  > Ref( H, -4 ) ) AND
    ( Ref( H, -2 ) == Ref( H, -3 ) ) AND
    ( Ref( H, -2 )  > Ref( H, -1 ) ) AND
    ( Ref( H, -2 )  > H );

fUpC =
    ( Ref( H, -2 )  > Ref( H, -6 ) ) AND
    ( Ref( H, -2 )  > Ref( H, -5 ) ) AND
    ( Ref( H, -2 ) == Ref( H, -4 ) ) AND
    ( Ref( H, -2 ) == Ref( H, -3 ) ) AND
    ( Ref( H, -2 )  > Ref( H, -1 ) ) AND
    ( Ref( H, -2 )  > H );

fUpD =
    ( Ref( H, -2 )  > Ref( H, -6 ) ) AND
    ( Ref( H, -2 )  > Ref( H, -5 ) ) AND
    ( Ref( H, -2 ) == Ref( H, -4 ) ) AND
    ( Ref( H, -2 )  > Ref( H, -3 ) ) AND
    ( Ref( H, -2 )  > Ref( H, -1 ) ) AND
    ( Ref( H, -2 )  > H );

fUpE =
    ( Ref( H, -2 )  > Ref( H, -8 ) ) AND
    ( Ref( H, -2 )  > Ref( H, -7 ) ) AND
    ( Ref( H, -2 ) == Ref( H, -6 ) ) AND
    ( Ref( H, -2 )  > Ref( H, -5 ) ) AND
    ( Ref( H, -2 ) == Ref( H, -4 ) ) AND
    ( Ref( H, -2 )  > Ref( H, -3 ) ) AND
    ( Ref( H, -2 )  > Ref( H, -1 ) ) AND
    ( Ref( H, -2 )  > H );

// Fraktal Turun
fDnA =
    ( Ref( L, -2 )  < Ref( L, -4 ) ) AND
    ( Ref( L, -2 )  < Ref( L, -3 ) ) AND
    ( Ref( L, -2 )  < Ref( L, -1 ) ) AND
    ( Ref( L, -2 )  < L );

fDnB =
    ( Ref( L, -2 )  < Ref( L, -5 ) ) AND
    ( Ref( L, -2 )  < Ref( L, -4 ) ) AND
    ( Ref( L, -2 ) == Ref( L, -3 ) ) AND
    ( Ref( L, -2 )  < Ref( L, -1 ) ) AND
    ( Ref( L, -2 )  < L );

fDnC =
    ( Ref( L, -2 )  < Ref( L, -6 ) ) AND
    ( Ref( L, -2 )  < Ref( L, -5 ) ) AND
    ( Ref( L, -2 ) == Ref( L, -4 ) ) AND
    ( Ref( L, -2 ) == Ref( L, -3 ) ) AND
    ( Ref( L, -2 )  < Ref( L, -1 ) ) AND
    ( Ref( L, -2 )  < L );

fDnD =
    ( Ref( L, -2 )  < Ref( L, -6 ) ) AND
    ( Ref( L, -2 )  < Ref( L, -5 ) ) AND
    ( Ref( L, -2 ) == Ref( L, -4 ) ) AND
    ( Ref( L, -2 )  < Ref( L, -3 ) ) AND
    ( Ref( L, -2 )  < Ref( L, -1 ) ) AND
    ( Ref( L, -2 )  < L );

fDnE =
    ( Ref( L, -2 )  < Ref( L, -8 ) ) AND
    ( Ref( L, -2 )  < Ref( L, -7 ) ) AND
    ( Ref( L, -2 ) == Ref( L, -6 ) ) AND
    ( Ref( L, -2 )  < Ref( L, -5 ) ) AND
    ( Ref( L, -2 ) == Ref( L, -4 ) ) AND
    ( Ref( L, -2 )  < Ref( L, -3 ) ) AND
    ( Ref( L, -2 )  < Ref( L, -1 ) ) AND
    ( Ref( L, -2 )  < L );

var1	= ValueWhen( fUpE OR fUpD OR fUpC OR fUpB OR fUpA, Ref( H, -2 ), 1 );
var2	= ValueWhen( fDnE OR fDnD OR fDnC OR fDnB OR fDnA, Ref( L, -2 ), 1 );
FrakNaik	= HighestSince( var1 > 0, var1, 1 );
FrakTurun	= LowestSince ( var2 > 0, var2, 1 );

Plot( FrakNaik, "F Up", colorBlue , styleLine | styleDashed );
Plot( FrakTurun, "F Dn", colorRed , styleLine | styleDashed );

// AO dan AC
AOFast	= MA( A, 5 );
AOSlow	= MA( A, 34 );
AO 		= AOFast - AOSlow;
AC		= AO - MA( AO, 5 );
AOUB	= AO > Ref( AO, -1 );
AODB	= AO < Ref( AO, -1 );
ACUB	= AC > Ref( AC, -1 );
ACDB	= AC < Ref( AC, -1 );
GrnBar	= AOUB AND ACUB;
RedBar	= AODB AND ACDB;

// WiseMan
WM1L 	= L < Ref( L, -1 ) AND C > ( ( H + L ) / 2 ) AND AODB AND AO < 0 AND ( O < Ref( BuayaMerah, -5 ) AND C < Ref( BuayaMerah, -5 ) ) AND ( L < Ref( BuayaMerah, -5 ) AND H < Ref( BuayaMerah, -5 ) );
WM1S	= H > Ref( H, -1 ) AND C < ( ( H + L ) / 2 ) AND AOUB AND AO > 0 AND ( O > Ref( BuayaMerah, -5 ) AND C > Ref( BuayaMerah, -5 ) ) AND ( L > Ref( BuayaMerah, -5 ) AND H > Ref( BuayaMerah, -5 ) );
WM2L	= Ref( AODB, -3 ) AND Ref( AOUB, -2 ) AND Ref( AOUB, -1 ) AND AOUB;
WM2S	= Ref( AOUB, -3 ) AND Ref( AODB, -2 ) AND Ref( AODB, -1 ) AND AODB;
WM3L	= Cross( C, FrakNaik );
WM3S	= Cross( FrakTurun, C );
//PlotShapes( IIf( WM2L AND WM3L, shapeDigit4, IIf( WM1L, shapeDigit1, IIf( WM2L, shapeDigit2, IIf( WM3L, shapeDigit3, 0 )  ) ), colorGreen, 0, L, -10 );

PlotShapes( IIf( WM1L, shapeDigit1, IIf( WM2L, shapeDigit2, IIf( WM3L, shapeDigit3, 0 ) ) ), colorGreen, 0, L, -10 );
//PlotShapes( IIf( WM1S, shapeDigit1, 0 ) , colorRed, 0, H, 10 );
PlotShapes( IIf( WM1S, shapeDigit1, IIf( WM2S, shapeDigit2, IIf( WM3S, shapeDigit3, 0 ) ) ), colorRed, 0, H, 10 );

//PlotShapes( IIf( WM2S AND WM3S, shapeDigit4, IIf( WM1S, shapeDigit1, IIf( WM2S, shapeDigit2, IIf( WM3S, shapeDigit3, 0 ) ) ) ), colorOrange, 0, H, 10 );
//PlotShapes( IIf( WM1L, shapeDigit1, 0 ), colorGreen, 0, L, -10 );
//PlotShapes( IIf( WM1S, shapeDigit1, 0 ), colorRed, 0, H, 10 );


//------- ZONE Definition -------------------

	AO=MA(A,5)-MA(A,34); //2nd Wise Man

		AORed=AO<=Ref(AO,-1);  
		AORed1=Ref(AO,-1)<=Ref(AO,-2); 	AORed2=Ref(AO,-2)<=Ref(AO,-3); 	AORed3=Ref(AO,-3)<=Ref(AO,-4); 	AORed4=Ref(AO,-4)<=Ref(AO,-5);

		AOGreen=AO>Ref(AO,-1);  
		AOGreen1=Ref(AO,-1)>Ref(AO,-2); AOGreen2=Ref(AO,-2)>Ref(AO,-3); 	AOGreen3=Ref(AO,-3)>Ref(AO,-4); AOGreen4=Ref(AO,-4)>Ref(AO,-5);

		AOabove0=AO>0; 	AObelow0=AO<0; 

	AC=AO-MA(AO,5);// Accelerator/Decelerator
	
		ACRed=AC<Ref(AC,-1); 
		ACRed1=Ref(AC,-1)<Ref(AC,-2); ACRed2=Ref(AC,-2)<Ref(AC,-3); 	ACRed3=Ref(AC,-3)<Ref(AC,-4); 	ACRed4=Ref(AC,-4)<Ref(AC,-5);

		ACGreen=AC>Ref(AC,-1);
		ACGreen1=Ref(AC,-1)>Ref(AC,-2); ACGreen2=Ref(AC,-2)>Ref(AC,-3);	ACGreen3=Ref(AC,-3)>Ref(AC,-4); ACGreen4=Ref(AC,-4)>Ref(AC,-5);
	
	// Zone Definition
	GreenZone=AOGreen AND ACGreen;
		GreenZ5=GreenZone AND (AOGreen1 AND ACGreen1) AND (AOGreen2 AND ACGreen2) AND (AOGreen3 AND ACGreen3) AND (AOGreen4 AND ACGreen4);
		GreenZ4=GreenZone AND (AOGreen1 AND ACGreen1) AND (AOGreen2 AND ACGreen2) AND (AOGreen3 AND ACGreen3);
		GreenZ3=GreenZone AND (AOGreen1 AND ACGreen1) AND (AOGreen2 AND ACGreen2);
		GreenZ2=GreenZone AND (AOGreen1 AND ACGreen1);
		Greenbar=IIf(greenz5,5,IIf(greenz4,4,IIf(greenz3,3,IIf(greenz2,2,IIf(greenzone,1,0)))));
	RedZone=AORed AND ACRed;
		RedZ5=RedZone AND (AORed1 AND ACRed1) AND (AORed2 AND ACRed2) AND (AORed3 AND ACRed3) AND (AORed4 AND ACRed4);
		RedZ4=RedZone AND (AORed1 AND ACRed1) AND (AORed2 AND ACRed2) AND (AORed3 AND ACRed3);
		RedZ3=RedZone AND (AORed1 AND ACRed1) AND (AORed2 AND ACRed2);
		RedZ2=RedZone AND (AORed1 AND ACRed1);
		Redbar=IIf(redz5,5,IIf(redz4,4,IIf(redz3,3,IIf(redz2,2,IIf(redzone,1,0)))));

	GreyZone= (AOGreen AND ACRed) OR (AORed AND ACGreen);
		GreyZ2=GreyZone AND ((AOGreen1 AND ACRed1) OR (AORed1 AND ACGreen1));
		GreyZ3=GreyZ2 AND ((AOGreen2 AND ACRed2) OR (AORed2 AND ACGreen2));
		GreyZ4=GreyZ3 AND ((AOGreen3 AND ACRed3) OR (AORed3 AND ACGreen3));
		GreyZ5=GreyZ4 AND ((AOGreen4 AND ACRed4) OR (AORed4 AND ACGreen4));
		Greybar=IIf(greyz5,5,IIf(greyz4,4,IIf(greyz3,3,IIf(greyz2,2,IIf(greyzone,1,0)))));

	Zonecolor= IIf(GreenZone,colorBrightGreen,IIf(RedZone,colorRed,colorGrey50));

	Plot(2,"  Zone",Zonecolor,styleOwnScale|styleArea|styleNoLabel|styleNoTitle, -0.5, 100 );



//----------------- MFI Definition -------------------------------
_SECTION_BEGIN("MFI");
D0 = (High-Low)/Volume>= Ref((High-Low)/Volume,-1) AND Volume >= Ref( Volume, -1 );// Green
D1 = (High-Low)/Volume< Ref((High-Low)/Volume,-1) AND Volume <Ref( Volume, -1 );// Red
D2 = (High-Low)/Volume>= Ref((High-Low)/Volume,-1) AND Volume < Ref( Volume, -1 );// Blue
D3 = (High-Low)/Volume< Ref((High-Low)/Volume,-1) AND Volume >= Ref( Volume, -1 );// Pink

dynamic_color = IIf( D0, colorBrightGreen, IIf( D3, colorPink, IIf( D1, colorRed, colorBlue)));

AlligatorMFI=IIf(D0,1,IIf(D1,2,IIf(D2,3,IIf(D3,4,0))));

Plot (4, "MFI", dynamic_color, styleOwnScale|styleArea|styleNoLabel|styleNoTitle, -0.5, 100  ); 

// Syarat Diatas / Dibawah Fraktal
DiatasFrakNaik = C > FrakNaik;
DibawahFrakTurun = C < FrakTurun;


// tadinya dibawa ini di beri slash dan bintang sebagai comment
// Sinyal AO

Tengah = (H+L)/2 ;
var1=MA( A , 34);
var2=MA( A,5);
diff = var2-var1;
 
// Menentukan UpBar dan DownBar
UpBar = diff > Ref(diff,-1); 
DownBar = diff < Ref(diff,-1);


// Syarat Sourcer BUY dan SELL
SoucerUp   = ( Ref(diff,-2) > Ref(diff,-1) AND Ref(diff,-1) < diff ) AND DiatasFrakNaik;
SoucerDown = (Ref(diff,-2) < Ref(diff,-1) AND Ref(diff,-1) > diff ) AND DibawahFrakTurun;
 
SoucerBuy = (SoucerUp AND (diff > 0 AND Ref(diff,-1) > 0 AND Ref(diff,-2) > 0) ) AND DiatasFrakNaik;
//SoucerSell = (SoucerDown AND (diff < 0 AND Ref(diff,-1) < 0 AND Ref(diff,-2) < 0)) AND DibawahFrakTurun ;
 
// Syarat AO Cross
CrossBuy = ( diff > 0 AND Ref(diff,-1) < 0  ) AND DiatasFrakNaik;
CrossSell = (diff < 0 AND Ref(diff,-1) > 0 ) AND DibawahFrakTurun ;
 
// Menampilkan Sinyal Sourcer dan AO Cross 
PlotShapes( IIf(SoucerBuy ,shapeDigit1,0) ,colorBlue, 0, L,-20);
PlotShapes( IIf(CrossBuy ,shapeDigit2,0) ,colorBlue, 0, H, 20);

// Menentukan TwinPeaks Buy 
LatestLowPeak = IIf(diff < 0, Ref(LowestSince(CrossSell, diff, 1), -1), 0);
TwinPeaksBuy = diff < 0 AND Ref(DownBar, -1) AND UpBar AND Ref(diff,-1) > LatestLowPeak;
 
LatestLowPeak = IIf(TwinPeaksBuy, Ref(diff,-1), LatestLowPeak); 
 
PlotShapes( IIf(TwinPeaksBuy AND DiatasFrakNaik ,shapeDigit3,0) ,colorBlue, 0, 0,12);

/* Menentukan TwinPeaks Sell  
LatestHighPeak = IIf(diff > 0, Ref(HighestSince(CrossBuy, diff, 1), -1), 0);
TwinPeaksSell = diff > 0 AND Ref(UpBar, -1) AND downBar AND Ref(diff,-1) < LatestHighPeak ;
 
LatestHighPeak = IIf(TwinPeaksSell, Ref(diff,-1), LatestHighPeak ); 
 
PlotShapes( IIf(TwinPeaksSell ,shapeDigit3,0) ,colorOrange, 0, 0,-12);
*/

SetChartOptions( 0, chartShowArrows|chartShowDates );

GfxSetOverlayMode(1);
GfxSelectFont("Tahoma", Status("pxheight")/6 );
GfxSetTextAlign( 6 );// center alignment
GfxSetTextColor( ParamColor( "Warna", colorLightGrey ) );
GfxSetBkMode(0); // transparent
_SECTION_END();

3 comments

1. val2004

CAN YOU PLEASE GIVE SOME RULES TO USE IT ?

TKS A LOT

2. nareshpriya

try these links: http://www.forexfactory.com/showthread.php?t=26044

http://www.trade2win.com/boards/attachments/training-education/103818d1298553352-trading-chaos-bill-williams-profitunity-trading-system.pdf
3. Sindhu DP

Number 1 (red) & (green)
Number 2 (red) & (green)
Number 3 (red) & (green)

What’s the meaning of it?
Apa artinya ya?

Leave Comment

Please login here to leave a comment.

Back