please give me a sample moving average crossover AFL,with Pi plug in to be used in Amibroker,on following parameteres
Buy and long ,when 2 ema close above 10 sma,means a long position
Sell and short,when 2 ema close below 10 sma.,means a short position,
Means reversal of positions,No stoploss will be there.
Along with this AFL,pi plugin should be attached as sample for NIFTY
Below is the AFL...
EMA1 = EMA(C,2);
SMA1 = MA(C,10);
Buy = Cross(EMA1,sma1);
Short = Cross(SMA1,EMA1);
Buy = ExRem(Buy,Short);
Short = ExRem(Short,Buy);
ORder = IIf(Buy,1,IIf(Short,2,0));
BSCond = LastValue(ORder,1);
NLmtPrice = LastValue(ValueWhen(BSCond > 0,C),1);
if (BSCond > 0)
{brd = CreateStaticObject("pibridge.Bridge");
brd.PlaceOrder ("NSE", "ACC-EQ" ,"ACC","MYAFL", BScond ,100,0, NLmtPrice, 0, "L", "MIS", "AB1234","DAY");}
Thanks,choks, you are an expert