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

ZEMA-atr-trading system for Amibroker (AFL)
rds
over 12 years ago
Amibroker (AFL)

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

Zero lag EMA crossover trading system
You go long/short based on when the faster ema crosses the slower one. The SL is decided by an ATR line that follows the price either up or down.

Similar Indicators / Formulas

All in One
Submitted by Nahid over 13 years ago
Kase Peak Osc. V2 batu
Submitted by batu1453 almost 10 years ago
Kase CD V2batu
Submitted by batu1453 almost 10 years ago
Ichimoku
Submitted by prashantrdx almost 10 years ago
Miftha remix for dse
Submitted by coolpace over 13 years ago
Basic Trading System
Submitted by morgen over 13 years ago

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("ZEMA ATR");

Period1=Param("Period 1",10,1,100,1);//Period1=Optimize("Period 1",10,1,25,1);
EMA1= EMA(C,Period1);
EMA2= EMA(EMA1,Period1);
Difference= EMA1 - EMA2;
ZeroLagEMA1= EMA1 + Difference;

Period2=Param("Period 2",20,1,100,1);//Period2=Optimize("Period 2",10,1,25,1);

EMA3= EMA(C,Period2);
EMA4= EMA(EMA3,Period2);
Difference= EMA3 - EMA4;
ZeroLagEMA2= EMA3 + Difference;

Plot(zerolagema1, "", colorBlue);
Plot(zerolagema2, "", colorRed);


pds=Param("ATR Periods",7,3,100,1);//pds=Optimize("pds",7,3,10,1);
pdslong=pdsshort=pds;
//pdsshort=Param("pds short",7,5,100,1);
//pdslong=Param("pds long",7,5,100,1);

ATRmultiple=Param("ATR Multiple",3,1,5,0.1);//ATRmultiple=Optimize("ATRmultiple",3,1,5,0.1);

AvgATRShort= ATRmultiple*ATR(pdsshort);
AvgATRLong= ATRmultiple*ATR(pdslong);

Ststop=LLV((LLV(L,pdsshort)+ AvgATRShort),pdsshort);
Lgstop=HHV((HHV(H,pdslong)- AvgATRlong),pdslong);
Ststop = LLV(Ststop, pdsshort);
Lgstop = HHV(Lgstop, pdslong);

//ApplyStop(stopTypeTrailing, stopModePoint, Ref(ATRmultiple*ATR(pdslong),-1),True, True);	

//Equity(1);
//Plot(Sell = 4,"ApplyStop Sell",colorRed,1|styleOwnScale);
//Plot(Cover=4,"ApplyStop Cover",colorGreen,1|styleOwnScale);
// Does this do anything. I dont know how to check.


ZemaBuy = (Cross(zerolagema1,zerolagema2));
ZemaSell = (Cross(zerolagema2,zerolagema1));

Short = Cross(Lgstop, C);
Cover = Cross(C, Ststop);

Short = ExRem(Short, Cover);
Cover = ExRem (Cover, Short);

Buy=Cover;
Sell=Short;

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

Stop=IIf(Sell, Ststop, IIf(Buy, Lgstop, Ststop));
//Stop=IIf(Buy, Ststop, Lgstop);
//Stop = Buy * Lgstop + Sell * Ststop);
/* Need some code here to do the following
/* a) During SHort trade, Stop=Ststop, and during Long Trade, Stop=Lgstop
/* b) Plot only on stop loss, either Ststop or Lgstop, based on whether we are in LOng trade or Short Trade
/* c) During Short trade, Ststop of each bar should be equal to or lower than the previous bars Ststop. Reset Lgstop
/* d) During Long trade, Lgstop of each bar should be equal to or Greate than the previous bar's Lgstop. Reset Ststop
*/

PlotShapes(IIf(ZemaBuy, shapeHollowUpArrow, shapeNone), colorGreen);
PlotShapes(IIf(ZemaSell, shapeHollowUpArrow + shapePositionAbove, shapeNone), colorRed);

shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ));
Plot(Ststop," SL for shorts ",colorGreen,styleDots|styleNoLine);
Plot(Lgstop," SL for long ",colorRed,styleDots|styleNoLine);
//Plot(Stop, "Stop Loss", colorBlue,styleDots|styleNoLine);
// Need to plot one single stop loss, Green if its Lgstop (OR) Red if it is Ststop.




_SECTION_END();

1 comments

1. cm_s

ZEMA isn’t used in trading signals.
Why?

Leave Comment

Please login here to leave a comment.

Back