[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Missing Something Simple



PureBytes Links

Trading Reference Links


I am trying to create a simple indicator to indicate the probability 
that if a day Closes below an MA the next day will be a down day.

THe code for this is:
per= Optimize("PER", 2, 2, 8,1);
UseEMa=Param("UseEMA",0,1,1);
LookBack=Param("Lookback",50,20,100,5);

MAC2=IIf(UseEMA,EMA(C,per),MA(C,per));
DownCross =C <MAC2;
downday=C<O;
//Check for where a downday was preceded by a DownCross
downPairs=downday AND Ref(downcross,1);


// When i use the following code to mark the days the system flags as 
downPairs
// The results are strange. The following code plots tha days that 
satify the downpair criteria
// i.e. Today is down and yesterday was a downcross (Marked by blue 
and yellow dots)
// and the days the system actually identifies as downpairs -they 
don't line up?
// What am I missing.????
Plot(C,"Close",1,64);
Plot(MAC2,"MA",6,4);

PlotShapes(IIf(Ref(DownCross,-
1) ,shapeSmallCircle,shapeNone),colorYellow,0,L,-10);
PlotShapes(IIf(downday,shapeSmallCircle,shapeNone),colorBlue,0,L,-20);
PlotShapes(IIf(downPairs,shapeSmallCircle,shapeNone),colorRed,0,H,10);


// Probability is calculated by dividing the number of times you have 
a downday by the number of times you have a downpair
// I do this both on a cumulative basis for overall probability and 
for a fifty day lookback period
// When I divide these out I get funny numbers especially for the 
cumulative.
downCum=Cum(DownCross );
downPCum=Cum(downPairs);
DownProb=downPCum/downCum;
downSum=Sum(DownCross ,LookBack);
downPSum=Sum(downPairs,LookBack);
DownProbLB=downPSum/downSum;

Be grateful for any suggestions

Thanks





------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/