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

Profit Trading system with Target and Stoploss for Amibroker (AFL)
samkum
over 10 years ago
Amibroker (AFL)

Rating:
4 / 5 (Votes 13)
Tags:
trading system, amibroker

Modified with Target and Stoploss

Screenshots

Similar Indicators / Formulas

EMA crossover
Submitted by Ketan-0 about 13 years ago
Kase Peak Osc. V2 batu
Submitted by batu1453 over 9 years ago
Kase CD V2batu
Submitted by batu1453 over 9 years ago
Ichimoku
Submitted by prashantrdx over 9 years ago
buy and sell two EMAS
Submitted by mundo0007 about 12 years ago
Adaptive Price Zone (APZ)
Submitted by AndrewThomas about 13 years ago

Indicator / Formula

Copy & Paste Friendly
_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 ) ) ));

SD = StochD(8, 3, 3);
MH = MACD(8, 21) - Signal(8, 21, 5);
trendup = IIf(MH > 0 OR (MH > 0 AND MH > Ref(MH, -1)) AND RSI(3) >50 AND SD < 80 AND SD > Ref(SD, -1) AND ValueWhen(C,O<C), colorBlue, colorWhite);
trendcolor = IIf(MH < 0 OR (MH < 0 AND MH < Ref(MH, -1)) AND RSI(3) <50 AND SD > 20 AND SD < Ref(SD, -1) AND ValueWhen(C,O>C), colorRed, trendup);
Plot( C, "Close", trendcolor, styleCandle | styleThick );

_SECTION_END();

no=Param( "Swing", 5, 1, 55 );
res=HHV(H,no);
sup=LLV(L,no);
tsl=IIf(ValueWhen(IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0))!=0,IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0)),1)==1,sup,res);
Plot(tsl, _DEFAULT_NAME(), colorBlue, styleStaircase);
Buy = Cross(C,res) ;
Sell = Cross(sup,C)  ;
_SECTION_END();

a=C;
g=(EMA(Close,3) * (2 / 4 - 1)-EMA(Close,5) * (2 / 6 - 1)) / (2 /4- 2 /6);
e=Ref(tsl,-1);
Buy = Cross(C,tsl) ;
Sell = Cross(tsl,C)  ;
SellPrice=ValueWhen(Sell,e,1);
BuyPrice=ValueWhen(Buy,e,1);
Long=Flip(Buy,Sell);
Shrt=Flip(Sell,Buy );
Filter=Buy OR Sell;
Buy = Cross(C,tsl) ;
Sell = Cross(tsl,C)  ;
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ),0, IIf( Buy, Low, High ) );
a1=Ref(tsl,-1);

dist = 0.8*ATR(1); //0.8
dist1 = 1.8*ATR(1); //1.2
for( i = 0; i < BarCount; i++ ) 
{ 
 if( Buy[i] ) 
 {
  PlotText( "Buy:" + L[ i ] + "\nTgt: " + (a1[i]*1.005) + "\nSL: " + (tsl[i]*0.9975), i, L[ i ]-dist[i], colorLime);
 }
 if( Sell[i] )
 {
  PlotText( "Sell:" + H[ i ] + "\nT: " + (a1[i]*0.995) + "\nSL: " + (tsl[i]*1.0025), i, H[ i ]+dist1[i], colorBlack); 
 }
}

15 comments

1. s.ganesh

sell signal colour light iruku.

2. soumen.bag1

This Signal is good. Now i want to add human voice alert. But I don’t how to add alert in the formula.
So I request to all member that please help me to add human voice alert when signal arrow is appear in the chart.

Regards
Soumen

3. soumen.bag1

Dear members,
This AFL is very useful for me and for this and i need human voice sound alert for more easy to work. So please please add sound alert for me
Thanks in advance

soumen bag

4. samkum

@soumen bag

Just add this code after line number 35, Thanks for indrajit_16

if (EndValue(Buy)==1) Say("Buy");
if (EndValue(Sell)==1) Say("Sell");



5. abhig10

Please check your system for sell signals…. I think their is some problem with the stop loss and target…. For example on one of my stock it gave Sell: 441.4 SL 452.077 T: 439.293…. Buy calls are however working good..

Edit: I have modified the SL for sell calls by this multiplying it with 0.995 (temporary fix)…..

PlotText( "Sell:" + H[ i ] + "\nT: " + (a1[i]*0.995) + "\nSL: " + (tsl[i]*0.995), i, H[ i ]+dist1[i], colorOrange);

6. dpstavnii

Which is the best time for this formula kindly suggest i am trading SILVER but confuse which time has to use.

7. systemtrader

i think this indi is faulty. the signal is coming after the candle close but, the price is way ahead of the signaled call.

8. samkum

Dear Friends…….. Delete after Line Number 37…. and copy paste these codes..
Plz feel free to post ur valuable Feed Back… Thnak you

GraphXSpace = 5;
dist = 1.0*ATR(5); 
dist1 = 1.8*ATR(5); 

for( i = 0; i < BarCount; i++ ) 
{ 
if( Buy[i] ) PlotText( "Buy:  " + C[ i ], i, L[ i ]-dist[i], colorWhite ); 
if( Sell[i] ) PlotText( "Sell:  " + C[ i ], i, L[ i ]+dist1[i], colorWhite ); 
} 

GraphXSpace = 5;
dist = 1.6*ATR(5); 
dist1 = 1.2*ATR(5); 
for( i = 0; i < BarCount; i++ ) 
{if( Buy[i] ) PlotText( "SL " + L[ i ], i, L[ i ]-dist[i], colorYellow ); 
if( Sell[i] ) PlotText( "SL " + H[ i ], i, H[ i ]+dist1[i], colorYellow); 
} 
9. kmmasoud

samkum : thanks but it gives me buy and sell different 0.25 amount , so short of amount .thanks dear

10. samkum

if u feel it is too short means.
try this
Replace this line

{if( Buy[i] ) PlotText( "SL " + L[ i ] * 0.9969, i, L[ i ]-dist[i], colorYellow );
if( Sell[i] ) PlotText( "SL " + H[ i ] * 1.0035, i, H[ i ]+dist1[i], colorYellow);

11. Monk

Dear Samkum,

If possible, please, make non repainting system, i mean that buy or close signals will show at close of bar.

Sry for my english. i hope u understand what i mean.

12. MotaSheth

Hi

Good work dear friend,

I have spotted an error which if you can rectify, it would be great.

The Stop Loss moves away from price on several occasions when price breaches the level.
For Example :
Trade long at 100
Stop loss at 98
when price breaches 98, SL revises to 97.5 when bar gets completed.
In fact, in live markets, the trade is squared and reversed.

Please disallow change of stop loss in this fashion (i.e. SL can only move up from previous bar SL in case of Long Trade and cannot move down , and vice a versa)

Please post revised version.
Thanks,
MotaSheth

13. alexmaz

a normal system

14. yottas168

This system is flawed… not easy to notice until you read carefully about how the entry prices are set:

e=Ref(tsl,-1);
SellPrice=ValueWhen(Sell,e,1);
BuyPrice=ValueWhen(Buy,e,1);

15. Sam Mcgee

Is this system flawed because it’s looking back through data? Does anyone have a corrected version of it that they can post?

Leave Comment

Please login here to leave a comment.

Back