amibroker help required - signal coming twice

#1
I have created my first afl in amibroker

_SECTION_BEGIN("EMA CROSSOVER CHART");
LongPer = Param("Long Period", 5, 30, 100, 5);
ShortPer = Param("Short Period", 10, 30, 100, 5);
LongMA = EMA(C, LongPer);
ShortMA = EMA(C, ShortPer);
LastHigh = HHV(H, LongPer);
GraphXSpace = 10;
Plot(LongMA, " EMA(C, " + WriteVal(LongPer, 1) + ")", colorDarkBlue, styleLine);
Plot(ShortMA, " EMA(C, " + WriteVal(ShortPer, 1) + ")", colorRed, styleLine);
Buy = Cross(LongMA, ShortMA);
Sell = Cross(ShortMA, LongMA);
PlotShapes(shapeUpArrow * Buy, colorBrightGreen, 0, L, - 10);
PlotShapes(shapeDownArrow * Sell, colorRed, 0, H, - 10);

if (LastValue(Buy))
{
_TRACE("last value of buy from lastvalue(buy) : " + C);
}

if (LastValue(Sell))
{
_TRACE("Last value of sell from lastvalue(sell) : " + C);
}


Sell=ExRem(Sell,Buy);

Buy=ExRem(Buy,Sell);


------------------------------------------------------------------
THE PROBLEM IS :
buy & sell indicators are coming 2-6 times randomly.
I am seeing tick chart. If I see 1 minute chart the same signal comes 8 times

ANY HELP ?
 

TradersZone

Well-Known Member
#2
Can You Post Chart With Lots OF Buy Sell Signal So I Can Help You
 
#4
PHP:
  _SECTION_BEGIN("EMA CROSSOVER CHART");
LongPer = Param("Long Period", 5, 30, 100, 5);
ShortPer = Param("Short Period", 10, 30, 100, 5);
LongMA = EMA(C, LongPer);
ShortMA = EMA(C, ShortPer);
LastHigh = HHV(H, LongPer);
GraphXSpace = 10;
Plot(LongMA, " EMA(C, " + WriteVal(LongPer, 1) + ")", colorDarkBlue, styleLine);
Plot(ShortMA, " EMA(C, " + WriteVal(ShortPer, 1) + ")", colorRed, styleLine);
Buy = Cross(LongMA, ShortMA);
Sell = Cross(ShortMA, LongMA);


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




if (LastValue(Buy))
{
_TRACE("last value of buy from lastvalue(buy) : " + C);
}

if (LastValue(Sell))
{
_TRACE("Last value of sell from lastvalue(sell) : " + C);
}

Plot(C,"",colorWhite,styleCandle);

PlotShapes(shapeUpArrow * Buy, colorBrightGreen, 0, L, - 10);
PlotShapes(shapeDownArrow * Sell, colorRed, 0, H, - 10);
I have created my first afl in amibroker

_SECTION_BEGIN("EMA CROSSOVER CHART");
LongPer = Param("Long Period", 5, 30, 100, 5);
ShortPer = Param("Short Period", 10, 30, 100, 5);
LongMA = EMA(C, LongPer);
ShortMA = EMA(C, ShortPer);
LastHigh = HHV(H, LongPer);
GraphXSpace = 10;
Plot(LongMA, " EMA(C, " + WriteVal(LongPer, 1) + ")", colorDarkBlue, styleLine);
Plot(ShortMA, " EMA(C, " + WriteVal(ShortPer, 1) + ")", colorRed, styleLine);
Buy = Cross(LongMA, ShortMA);
Sell = Cross(ShortMA, LongMA);
PlotShapes(shapeUpArrow * Buy, colorBrightGreen, 0, L, - 10);
PlotShapes(shapeDownArrow * Sell, colorRed, 0, H, - 10);

if (LastValue(Buy))
{
_TRACE("last value of buy from lastvalue(buy) : " + C);
}

if (LastValue(Sell))
{
_TRACE("Last value of sell from lastvalue(sell) : " + C);
}


Sell=ExRem(Sell,Buy);

Buy=ExRem(Buy,Sell);


------------------------------------------------------------------
THE PROBLEM IS :
buy & sell indicators are coming 2-6 times randomly.
I am seeing tick chart. If I see 1 minute chart the same signal comes 8 times

ANY HELP ?
 

Similar threads