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

Combining EMA crossover and ADX for Amibroker (AFL)

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

Have been trying to get a better hit ratio with combination of some trend following indicators. Most trend following indicators have worked well in India only on the long side, was trying to come up with some combination that works on the short side as well.

Have tried various combinations targeting a better hit rate and high P/L ratio but smaller drawdown. EMA cross with ADX and RSI worked well. Let me know your thots. Did not find putting a stop (trailing or otherwise) useful.

Its a draft version, need to work on some more combinations and posotion sizing. Has given good returns on a basket of stocks (3+) in India.

Similar Indicators / Formulas

Rahul Mohindar Oscillator (RMO)
Submitted by kaiji almost 15 years ago
Heikin-Ashi Candles Oscillator for Long term
Submitted by NTA almost 12 years ago
Price Oscillator
Submitted by ariful_islam about 14 years ago
ZeroLag RSI with Buy/Sell
Submitted by erecruiters over 13 years ago
TSI V.2
Submitted by Anonymous almost 12 years ago
Trending Wave 2 System
Submitted by Dryden over 12 years ago

Indicator / Formula

Copy & Paste Friendly
//Shortavg=Param("Short average",13,5,25,2);
Longavg=Param("Long average",13,5,80,2);
TrendAvg=Param("Trender average",21,5,100,3);
Dix = Param ("Directional Index",14,5,25,1);
Oversold = Param ( "Oversold", 50, 20, 70, 5 );
Overbot = Param ("Overbot", 50, 50, 100, 5 );
ADXThreshold = Param ("ADXThreshold",15,5,25,1);


//MACD//
FAST = Param("FAST",12,0,100,1);
SLOW = Param("SLOW",26,0,100,1);
SIG  = Param("SIG",5,0,100,1);
 
MACDLine   = MACD(FAST,SLOW);
MACDSignal = Signal(FAST,SLOW,SIG);
 
 
//Trendscore//
TrendScore =
IIf(C>=Ref(C,-13),1,-1)+
IIf(C>=Ref(C,-14),1,-1)+
IIf(C>=Ref(C,-15),1,-1)+
IIf(C>=Ref(C,-16),1,-1)+
IIf(C>=Ref(C,-17),1,-1)+
IIf(C>=Ref(C,-18),1,-1)+
IIf(C>=Ref(C,-19),1,-1)+
IIf(C>=Ref(C,-20),1,-1)+
IIf(C>=Ref(C,-21),1,-1)+
IIf(C>=Ref(C,-22),1,-1);
 
/////////////////AROON////////////////////
 
Period = 14;
LLVBarsSince = LLVBars(L, Period) + 1;
HHVBarsSince = HHVBars(H, Period) + 1;
 
AroonDn = 100 * (Period - LLVBarsSince) / (Period - 1);
AroonUp   = 100 * (Period - HHVBarsSince) / (Period - 1);

///Buy and cover// 
Buy = Cross(C, EMA(C,Longavg)) //AND (C>=EMA(C,TrendAvg))
AND (ADX (Dix) > ADXThreshold)
AND PDI(Dix)>MDI(Dix) 
//AND MACDLine>MACDSignal;
AND (RSI(14)>Oversold);
//AND AroonUp>30;
Cover = C>EMA(C,Longavg) AND RSI(14)>Oversold;

//Short AND Sell//
Short = Cross(EMA(C,Longavg), C) //AND (C<=EMA(C,TrendAvg))
AND (ADX (Dix) > ADXThreshold)
AND PDI(Dix)>MDI(Dix)
//AND MACDLine<MACDSignal;
AND (RSI(14)<Overbot);
//AND AroonDn>30;
Sell = C<EMA(C,Longavg) AND RSI(14)<Overbot;
 
Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );

Cover = ExRem(Cover, Short);
Short = ExRem(Short, Cover);
PlotShapes(Buy *shapeUpArrow, colorLime, 0, L, Offset = -20);
PlotShapes(Sell *shapeHollowDownArrow, colorOrange, 0, H, Offset = -10);
PlotShapes(Short *shapeDownArrow, colorRed, 0, H, Offset = -20);
PlotShapes(Cover *shapeHollowUpArrow, colorGreen, 0, L, Offset = -10);
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
 
PositionSize = -20;
//StopAmount = 10 * ATR( 20 );
//ApplyStop( 0, 2, StopAmount, 1 );
//AND (ADX (Dix) < 50)
// trendscore>5;
// AND trendscore>5

11 comments

1. rajaswamy

NOTHING DISPLAYING SIR

2. prakash2009

chart is empty.pls check.

3. esnataraj

WORKING FINE

4. sreenath77

Hollow arrows are acting as better buy and short signals. From my visual backtesting, I find it profitable. Buying and Shorting on solid arrows, Selling and Covering on hollow arrows is leading to losses.

5. prakash2009

Extra codes added as mentioned above. last line shows syntax error.Admin-pls correct.Amibroker 5.30.

6. administrator

Hello

Formula is working fine on my end

7. esnataraj

FORMULA IS WORKING FINE

8. administrator

I updated the formula so there is no need to add anything yourself now.

9. esnataraj

Yes, Many Thanks to administrator..
NOW FORMULA IS WORKING FINE

10. RaviNazre

Don’t rely on this indicator. ( personal view )

11. manoj230674

chart is empty.pls check.

Leave Comment

Please login here to leave a comment.

Back