Please expalin and optimize this afl code

#1
Dear experts,

I found the following afl somewhere here itself in TJ.

It is MACD. But readings bounded between 0.00 and 0.10.please expalin whats the meaning of the code
It has Buy/sell conditions defined for crossovers. Please remove that and add Buy/sell for below conditions

BUY : When Fsignal = lower boundary
Sell: When Fsignal = upper boundary

----------------------------------------------------------------------

_SECTION_BEGIN("Macd time frame");

TimeFrameSet( inDaily);
LongTermEMA = EMA(Close, 10);
TimeFrameRestore( );

TimeFrameSet( inHourly) ;
MediumTermEMA = EMA(Close, 10);
TimeFrameRestore( );

fMACD = MACD(6,19);
fSignal = Signal(6,19, 9);

Buy = Cross(fMACD, fSignal);
Sell = Cross(fSignal, fMACD);

Plot(TimeFrameExpand(LongTermEMA, inDaily), "Daily EMA",
colorRed);
Plot(TimeFrameExpand(MediumTermEMA, inHourly), "\nHourly EMA",
colorBlue);
Plot(fMACD, "\nCurrent chart MACD", colorGreen, styleOwnScale) ;
Plot(fSignal, "\nCurrent chart Signal", colorGreen, styleDashed |
styleOwnScale) ;

PlotShapes(Buy * shapeUpArrow, colorGreen);
PlotShapes(Sell * shapeDownArrow, colorRed);


-----------------------------------------------------------------------

Please modify the code acordingly.


Regards, Rmesh.
 

mohan.sic

Well-Known Member
#3
Dear Ramesh,

Good one. Hopefully any experts should help out.

I see that it is MACD ( 6, 19) and plotted within a range. That is, MACD movement has been bounded within readings of Max 0.1000 upper side and 0.0000 down side.

That is just like RSI bounded between 0 and 100, here MACD readings movement is limited with in 0.0000 and 0.10000. And buy/sell signals given at crossovers.

Could experts pls modify it so that buy is generated when MACD touches lower limit 0.0000 and sell is generated when MACD touches 0.10000.

Thanks, MoHaN.
 

Similar threads