Just add something like this properly including your conditions and then scan:
Buy = iif(sum(hist > histprev, 5) == 4 and ref(hist < histprev, -1), 1, 0);

Bill

----- Original Message ----- 
From: "protraderinc" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, October 17, 2007 12:12 PM
Subject: [amibroker] MACD Histogram


> Hi everyone,
> 
> I just bought Amibroker for stocks trading. I usually use a small
> setup criteria to scan for my stocks but now I can't :(
> 
> I would like to seek help to write the scanner. 
> 
> Settings:
> MACD default, 
> I look for Histogram 4 down bars and 1 up bar for buy signal(I used to
> have the histogram set to red for down and blue for up so I can see
> clearly) I have this indicator but was give to me with another setting 
> 
> MACD above Zero Line
> 
> RSI Above 30
> 
> This system is base on trend trading. Buying on pullback when the
> market continue its up trend.
> 
> Thank you for your help in advance, greatly appreciated :)
> 
> 
> 
> 
> r1 = Param( "Fast avg", 12, 2, 200, 1 );
> r2 = Param( "Slow avg", 26, 2, 200, 1 );
> r3 = Param( "Signal avg", 9, 2, 200, 1 );
> Plot( ml = MACD(r1, r2), StrFormat(_SECTION_NAME()+"(%g,%g)", r1, r2),
> ParamColor("MACD color", colorAqua ), ParamStyle("MACD style",
> styleThick) );
> Plot( sl = Signal(r1,r2,r3), "Signal" + _PARAM_VALUES(),
> ParamColor("Signal color", colorRed ), ParamStyle("Signal style",
> styleThick) );
> //Plot( ml-sl, "MACD Histogram", ParamColor("Histogram color",
> colorBlack ), styleNoTitle | ParamStyle("Histogram style",
> styleHistogram | styleNoLabel, maskHistogram ) );
> 
> m1=MACD(r1,r2);
> s1=Signal(r1,r2,r3);
> Hist= m1-s1;
> Histprev=Ref(Hist,-1);
> 
> Color = IIf(Hist>Histprev,ParamColor("MACD-H Up Color", colorGreen),
> IIf(hist<histprev,ParamColor("MACD-H Down
> Color",colorCustom16),colorRed));
> 
> Plot(m1-s1,"MACD Histogram",Color,styleHistogram|styleNoTitle|styleThick);
> 
> 
> 
> SetChartBkGradientFill( ParamColor("Backgroud Top Color",
> colorRed),ParamColor("Background Bottom Color", colorDarkGrey));
> 
> 
> 
> //This indicator shows the value of tomorrow's Closing Price 
> //in order for the slope of the MACD Histogram to change Direction. 
> //(ie. changing from a positive slope to a negative slope OR changing 
> //from a negative slope to a positive slope)
> GraphXSpace = 8;
> 
> 
> f1 = ((r3+1)*M1-2*S1)/(r3-1);
> f2 = EMA(C,r1)*(r1-1)/(r1+1);
> f3 = EMA(C,r2)*(r2-1)/(r2+1);
> f4 = 2/(r1+1) - 2/(r2+1);
> 
> dcv = (f1-f2+f3)/ f4;
> 
> 
> Title = Name() + "  -  " + FullName() + "  -  " + Date() + "  -  Close
> = " +
> WriteVal(C,0.3) + "  -  DCV = " + WriteVal(dcv,0.3);
> 
> 
> 
> Please note that this group is for discussion between users only.
> 
> To get support from AmiBroker please send an e-mail directly to 
> SUPPORT {at} amibroker.com
> 
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
> 
> For other support material please check also:
> http://www.amibroker.com/support.html
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition. 
> Version: 7.5.488 / Virus Database: 269.14.13/1074 - Release Date: 10/16/2007 
> 2:14 PM
> 
>

Reply via email to