Alert Buy dan Warning Sell

Alert Buy dan Warning Sell termasuk ke dalam bagian Microscopic Technical Analysis. Intinya adalah Alert Buy dan Warning Sell menunjukkan perubahan “jarak” dari suatu indikator yang memiliki 2 jenis garis seperti Stochastic Oscillator.

Pada Stochastic Oscillator, sebelum terjadi Death Cross maka %K harus semakin mendekati %D dari atas ke bawah. Warning Sell muncul apabila jarak %K dengan %D semakin berkurang. Sebelum terjadi Golden Cross, %K harus semakin mendekati %D dari bawah ke atas. Alert Buy muncul bila jarak %K dengan %D semakin berkurang.

Untuk penjelasannya dapat dilihat di video berikut :

Berikut adalah AFL atau Amibroker Formula Language dari Alert Buy dan Warning Sell untuk Stochastic Oscillator ala The Primary Trader :

_SECTION_BEGIN("The Primary Trader Stochastic Oscillator");

period = Param("Periode", 5, 2, 50);
smooth = Param("Smooth", 2, 2, 10);
a = ( (C - LLV(L, period)) / (HHV(H, period) - LLV(L, period)) * 100) ;
b = WMA(a, smooth);
d = WMA(b, smooth);
 
Plot(b, "Stochastic", colorBlack, styleLine | styleThick);
Plot(d, "Stoch Smooth", colorBlack, styleLine | styleDashed | styleThick);
 
Buy = Cross(b,d) AND b < 60 AND d < 60;
Sell = Cross(d,b) AND d > 40 AND d > 40;

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

PlotShapes(shapeUpArrow*Buy,colorGreen);
PlotShapes(shapeDownArrow*Sell,colorRed);
 
UpLine = Param("Over Bought Level",80,1,100,1) ;
MidLine = Param("Midle Level",50,1,100,1) ;
DownLine = Param("Over Sold Level",20,1,100,1) ;
Plot(Upline ,"Overbought Level",colorBlack, styleDashed | styleNoLabel );
Plot(DownLine ," Oversold Level",colorBlack, styleDashed | styleNoLabel );
 
SetChartOptions(0,0,chartGrid20|chartGrid80);

_N(Title = StrFormat("- The Primary Trader Stochastic Oscillator -"));

_SECTION_END();

The Primary Trader pun menggunakan Stochastic Oscillator Histogram dengan AFL sebagai berikut :

_SECTION_BEGIN("Stochastic Histogram");

period = Param("Periode", 5, 2, 50);
smooth = Param("Smooth", 2, 2, 10);
a = ( (C - LLV(L, period)) / (HHV(H, period) - LLV(L, period)) * 100) ;
b = WMA(a, smooth);
d = WMA(b, smooth);

Plot(b-d, "Histogram", colorBlack, styleHistogram);
Plot(0, "", colorLightGrey, styleDashed | styleNoLabel);

SetChartOptions(0,0,chartGrid20);

_N(Title = StrFormat("- Stochastic Oscillator Histogram -"));

_SECTION_END();

Berikut adalah contoh Stochastic Oscillator dan Stochastic Oscillator Histogram pada IHSG :

Alert Buy adalah sinyal yang muncul apabila Stochastic Oscillator Histogram periode terkini berada di area negatif namun lebih rendah dari periode sebelumnya. Warning Sell adalah sinyal yang muncul apabila Stochastic Oscillator Histogram periode terkini berada di area positif namun lebih rendah dari periode sebelumnya.

The Primary Trader menggunakan periode 5 hari untuk %K yang berarti Stochastic Oscillator tersebut membaca posisi relatif harga close dengan rentang tertinggi dan terendah dalam seminggu terakhir.

Alert Buy dan Warning Sell muncul pada Explorer. Berikut adalah AFL-nya :

Filter = 1;

period = 5;
smooth = 2;
a = ( ( C - LLV( L, period ) ) / ( HHV( H, period ) - LLV( L, period ) ) * 100 ) ;
b = WMA( a, smooth );
d = WMA( b, smooth );
e = b - d ;
Buy = Cross( b, d );
Sell = Cross( d, b );

warningsell = e < Ref( e, -1 ) AND e >= 0 AND Ref( e, -1 ) >= 0 ;
warningbuy = e > Ref( e, -1 ) AND e < 0 AND Ref( e, -1 ) < 0;
Stillbuy = BarsSince( Buy ) < BarsSince( Sell ) AND NOT warningsell;
Stillsell = BarsSince( Buy ) > BarsSince( Sell ) AND NOT warningbuy;
Stillbuybut = warningsell AND BarsSince( Buy ) < BarsSince( Sell );
Stillsellbut = warningbuy AND BarsSince( Buy ) > BarsSince( Sell );

AddColumn( b, "SO", 1.2, IIf( b < 30, colorBlue,IIf( b > 70, colorRed, colorBlack)),colorWhite, 70);
AddTextColumn( WriteIf( Buy, "Buy Now",
                       WriteIf( Sell, "Sell Now",
                                 WriteIf( Stillbuy, "Still Buy",
                                        WriteIf( StillSell, "Still Sell",
                                                  WriteIf( Stillbuybut, "Warning Sell",
                                                    WriteIf( StillSellbut, "Alert Buy", "---" ) ) ) ) ) ), "SOSignal",
           colorDefault, colorDefault, IIf( Buy OR Stillbuy OR StillSellbut, colorPaleGreen,
                                             IIf( Sell OR StillSell OR Stillbuybut, colorPink, colorDefault ) ) );

Semoga terinspirasi.

Author: MM Dandytra

Professional Tactical Asset Allocator, Internationally Awarded Technical Analyst, Private Investor / Trader, Amateur Blogger

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s