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

Modification of Reversal By pranafrans for Amibroker (AFL)

Rating:
3 / 5 (Votes 3)
Tags:
amibroker, candlestick, pattern

Originally posted by pranafrans (http://wisestocktrader.com/indicators/5499-reversal)
Just added Section “Transaction” with fee, Buy/Sell and arrow shape for buy/sell. Now you can backtesting this beautiful piece of coding originally posted by pranafrans. Terima kasih.

Screenshots

Indicator / Formula

Copy & Paste Friendly
// Reversal.afl by pranafrans http://wisestocktrader.com/indicators/5499-reversal
_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", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 

// REVERSAL by Candlestick


C1 = Ref(C,-1);
C2 = Ref(C,-2);
A1 = Ref(Avg,-1);
A2 = Ref(Avg,-2);
A3 = Ref(Avg,-3);
A4 = Ref(Avg,-4);
A5 = Ref(Avg,-5);
O1 = Ref(O,-1);
O2 = Ref(O,-2);

Syarat1 = ((A1 < A2) AND (A2 < A3) AND (A1 < A4)); //AND (A3 < A4) ) ;//OR ( A1 < A3);
Syarat2 = (C1 <= O1) AND (C2 <= O2);
SyaratTurun = Syarat1 AND Syarat2;
Syarat3 = (A1 > A2) AND (A2 > A3) AND (A1 > A4) ;
Syarat4 = (C1 >= O1) AND (C2 >= O2);
SyaratNaik = Syarat3 AND Syarat4;

DibawahMA20 = C < MA(C,20);
DiatasMA20  = C > MA(C,20);

//HammerItem =
BodyI = O - C;
TailI = C - L;
HammerItem = (O==H) AND (C < O) AND (TailI >= 2*BodyI);

//HammerPutih =
BodyP = C - O;
TailP = O - L;
HammerPutih = (C==H) AND (C > O) AND (TailP >= 2*BodyP);

Hammer = HammerPutih OR HammerItem;// Syarat Candlestick Bullish dan Bearish Reversal
Doji = O == C;
BodiPutih = C > O ;//AND (TailI < BodyI) ;
BodiItem = C < O ;//AND (TailP < BodyP);

BullishReversal = Doji OR BodiPutih OR Hammer;
BearishReversal = Doji OR BodiItem OR Hammer;

SyaratBullishR = SyaratTurun AND BullishReversal ;
SyaratBearishR = SyaratNaik  AND BearishReversal ;

PlotShapes(IIf(SyaratBullishR ,shapeHollowSmallCircle,shapeNone),colorBlue,0,L,-15);
PlotShapes(IIf(SyaratBearishR ,shapeHollowSmallCircle,shapeNone),colorRed,0,H,15);


_SECTION_END();

_SECTION_BEGIN("Transaction");//added this section by Sosrodiningrat http://bit.ly/SosrodiningratV1
//SetTradeDelays(1,1,0,0);
//FeeBeli atau FeeJual dapat diabaikan dengan mengisi angka nol.
FeeBeli=0.19;//dalam persen, penggunaannya tidak menjamin akurasi, hanya memberikan gambaran sekilas
FeeJual=0.29;//dalam persen, penggunaannya tidak menjamin akurasi, hanya memberikan gambaran sekilas

BuyPrice=O*(1+FeeBeli/100);
SellPrice=O*(1-FeeJual/100);

Buy=Ref(SyaratBullishR,-1);
Sell=Ref(SyaratBearishR,-1);

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

PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0,L,-25);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,H,-25);

printf("\nBuyPrice= "+BuyPrice);
printf("\nSellPrice= "+SellPrice);
printf("\nFeeBeli= "+(1+FeeBeli/100));
printf("\nFeeJual= "+(1-FeeJual/100));

_SECTION_END();

1 comments

1. NHUCHAU

Thanks !

Leave Comment

Please login here to leave a comment.

Back