Hi friend rv

The condition you are aiming is probably,
macd histogram > 0;
macdhistogram > ref(macdhistogram,-1);
rise or fall in histogram in 5 bars > x% of histogram;
The below formula may help
--------------------------------------------------
//Use on weekly charts to determine Trend Changes.
// if the Weekly Bars are Green check the daily bars for LONG entries, if the 
Weekly Bars on Red check the daily for Short entires. 

//Formula:
/*--------------------------------------------------------------------
MTR Investors Group - www.MTRIG.com

Color price bars with MACD Histogram Bars changes. Use on weekly chart 
to determine market trend. See Elder "Come into my trading room"
----------------------------------------------------------------------*/
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g,
Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

TimeFrameSet( inDaily) ;//ignore this codeline if you deal with intraday

//MACD
r1 = Param( "Impulse Fast avg", 12, 2, 200, 1 );
r2 = Param( "Impulse Slow avg", 26, 2, 200, 1 );
r3 = Param( "Impulse Signal avg", 9, 2, 200, 1 );

ml = MACD(r1, r2);
sl = Signal(r1,r2,r3);
Hist = ml-sl;

MACUP = Hist > Ref(Hist,-1);
MACDN = Hist < Ref(Hist,-1);

BarColor  = IIf(MACUP,colorGreen,IIf(MACDN,colorRed,colorBlue));

Plot( C, "Close", BarColor, styleNoTitle | ParamStyle("Style") |
GetPriceStyle() );
===================================================
please note
you need to add hist plot code line
and modify lines here below for action on histogram
MACUP = Hist > Ref(Hist,-1);//gives rising histogram
MACDN = Hist < Ref(Hist,-1);//gives falling histogram
then the complex condition
hist rise in 5 bars to be more than x%,where x =1 or 2 etc
The rise of x units must happen in 5 bars,
starting from?? which point not clear(from wherever the rise of fall begins)
This part only an expert can do.
if rise of hist happens as planned,trade validated  signal comes
otherwise no signal or trade validation failed may come.


here
  hist > 0  or hist < 0 
is to be added in MACUP and MACDN codelines
then 
plot the histogram ,plot the macd line,plot signal line
exclude price


BarColor  = IIf(MACUP,colorGreen,IIf(MACDN,colorRed,colorBlue));
change this to hist color
------------------------
Any way the final afl is possible only if an expert ike mike or reinsley etc 
spare their coding skills.
In the absence of other info, try with above info as a base guideline,though 
may not be correct,as I am a novice.
cheers
ford

--- In amibroker@yahoogroups.com, "rvlv" <r...@...> wrote:
>
> Hi Afl experts
> 
> Please help by providing code lines for following condition
> 
> If the histogram lines of MACD are above zero line, and if the histogram line 
> value rises up by say,2%, within a limited timespan of say 5 bars,then buy 
> signal shows up.
> In case the rise of macd histogram line magnitude is not upto the required 
> level, it gives NO TRADE signal.
> similarly a sellshort sinal is to indicated when
> the histogram line is below zero line, and drops in value more than x %
> in a span of 5 bars,to validate sell signal.
> sell signal appears.
> if required move on downside has not occurred, then No trade signal occurs or 
> nothing happens.
> 
> Appreciate your help
> regards with advance thanks,
> rv
>


Reply via email to