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

BoonC Peak and Trough v1.1 for Amibroker (AFL)
kaiji
almost 15 years ago
Amibroker (AFL)

Rating:
5 / 5 (Votes 1)
Tags:
trading system, amibroker, exploration

Trading system based on peaks and trough’s.

Similar Indicators / Formulas

Reaction Trend System
Submitted by ajayjain90 over 14 years ago
Behgozin Strength Finder
Submitted by hotaro3 about 12 years ago
KPL with RSI
Submitted by pdkg_gal over 14 years ago
Intraday Trend Break System
Submitted by nishantndk over 14 years ago
ema crossovers
Submitted by rushee.g1100 over 14 years ago
Ribbon Trading System
Submitted by trader22 almost 15 years ago

Indicator / Formula

Copy & Paste Friendly
//{BoonC Peak 'n Trough V 1.1}
//{Buy}
x1=5; x2=4; x3=3; x4=2; x5=1; x6=.5;
//{Lowest price stock <5}
Buy = AA=IIf(C<5,Cross(C,ValueWhen(Peak(H,x1,1) !=Ref(Peak(H,x1,1),-1),H,1)),
//{Price between 5 AND 20}
IIf(C>5 AND C<20,Cross(C,ValueWhen(Peak(H,x2,1) !=Ref(Peak(H,x2,1),-1),H,1)),
//{Price between 20 AND 70}
IIf(C>20 AND C<70,Cross(C,ValueWhen(Peak(H,x3,1) !=Ref(Peak(H,x3,1),-1),H,1)),
//{Price between 70 AND 150}
IIf(C>70 AND C<150,Cross(C,ValueWhen(Peak(H,x4,1) !=Ref(Peak(H,x4,1),-1),H,1)),
//{Price between 150 AND 300}
IIf(C>150 AND C<300,Cross(C,ValueWhen(Peak(H,x5,1) !=Ref(Peak(H,x5,1),-1),H,1)),
//{Price over 300}
Cross(C,ValueWhen(Peak(H,x6,1)!=Ref(Peak(H,x6,1),-1),H,1)))))));

//{Sell }
x1=5; x2=4; x3=3; x4=2; x5=1; x6=.5;
//{Lowest price stock <5}
Sell = BB=IIf(C<5,Cross(ValueWhen(Trough(L,x1,1) !=Ref(Trough(L,x1,1),-1),L,1),C),
//{Price between 5 AND 20}
IIf(C>5 AND C<20,Cross(ValueWhen(Trough(L,x2,1) !=Ref(Trough(L,x2,1),-1),L,1),C),
//{Price between 20 AND 70}
IIf(C>20 AND C<70,Cross(ValueWhen(Trough(L,x3,1) !=Ref(Trough(L,x3,1),-1),L,1),C),
//{Price between 70 AND 150}
IIf(C>70 AND C<150,Cross(ValueWhen(Trough(L,x4,1) !=Ref(Trough(L,x4,1),-1),L,1),C),
//{Price between 150 AND 300}
IIf(C>150 AND C<300,Cross(ValueWhen(Trough(L,x5,1) !=Ref(Trough(L,x5,1),-1),L,1),C),
//{Price over 300}
Cross(ValueWhen(Trough(L,x6,1)!=Ref(Trough(L,x6,1) ,-1),L,1),C))))));

Color=IIf(BarsSince(AA)>BarsSince(BB),colorRed,IIf (RSI()>70,colorCustom1,colorDarkGreen));
Plot(C,"",Color,styleCandle);
///// Trailing Stop Module /////

P6=Param("Trailing Stop Risk",2.5,2,3.5,0.1);
P7=Param("Trailing Stop LookBack",14,5,25,1);
P8=Param("Trailing Stop PrevLow Switch",0,0,1,1);
PrevLow=IIf(P8==1, Ref(C,-TroughBars(C,5,1)) ,Null);
Plot(PrevLow,"",colorRed);

//Position sizing//
MyTotalPort = Param("MyTotalPort",1000000,10000,10000000,100000) ;
AcceptableRisk = Param("AcceptableRisk",0.5,0.1,3,0.1);
BarsFromStart = BarsSince(Cross(AA,BB)AND Ref(Color,-1)==colorRed) ;
InitialStopLoss =Ref( H - P6*ATR(P7),-BarsFromStart);
PositionSizing = 0.01*AcceptableRisk*MyTotalPort/( C - InitialStopLoss );

Plot(IIf( HHV(H - P6*ATR(P7),BarsFromStart+1) <C ,HHV(H - P6*ATR(P7),BarsFromStart+1),Null) ,"",colorBlue,1);
PlotShapes(shapeDownArrow*Cross(Ref(HHV(H - P6*ATR(P7),BarsFromStart+1),-1),C),colorCustom1,0,H,Offset=-43);
Title=Name()+" "+Date()+" "+EncodeColor(colorBrown)+"BoonC Peak 'n Trough V 1.1+atr+position"+EncodeColor(colorBlack)+" Vol="+NumToStr(Volume ,1.2)+" "+EncodeColor(1)+"Position Sizing ( " +AcceptableRisk+ "% Risk ) = " + WriteIf(color==colorDarkGreen,NumToStr(PositionSizing ,1.0),"0")+
EncodeColor(colorBlue)+"\nO="+O+EncodeColor(colorBrown)+" Pk-Tgh Exit"+EncodeColor(colorCustom1)+" ATR Trailing Exit"+EncodeColor(colorBlack)+" RSI Exit"+EncodeColor(colorBlack)+" ADX = "+ADX()+EncodeColor(colorBlue)+"\nH="+H+"\nL=" +L+" \nClose="+ C+""+"\nchange= "+NumToStr((Ref(C,-1)-Close) ,1.2) +
" ";
PlotShapes( AA*shapeSmallUpTriangle,colorCustom12,0,L-0.2);
PlotShapes( BB*shapeHollowSmallDownTriangle,colorCustom12,0,H+ 0.2);
GraphXSpace=3;
Filter = Buy OR Sell;
AddColumn(Buy, "Buy", 1.2);
AddColumn(Sell, "Sell", 1.2);

0 comments

Leave Comment

Please login here to leave a comment.

Back