PureBytes Links
Trading Reference Links
|
Hi,
This is a simple test system using Projection Oscillator.
It displays practically all signals correctly, but misses (??) one,
most important BUY for YHOO on 12/18/2003, where there IS a crossover
between the indicator and its signal line in the region below 30,
in anticipation of a major move up, but yet no Buy triangle shows up.
Can someone explain/correct this?
Code is:
---------8<--cut and paste in IB window; together w/function below --
pj_slow=Param("Pj_slow",21,10,40,1);
PjOsc=ProjOsc(pj_slow);
pj_trigger = Param("Pj_trig",3,2,7,1);
Pjsignal = EMA(PjOsc,pj_trigger);
Plot(PjOsc,"PjOsc",colorRed,1);
Plot(PjSignal,"Pjsignal",colorBlue,1);
Buyval = Param("Buyval",30,25,40,1);
Sellval = Param("Sellval",70,60,80,1);
Buy = Cross(PjOsc,Pjsignal) AND PjOsc <= Buyval;
Sell = Cross(Pjsignal,PjOsc) AND PjOsc > Sellval;
PlotShapes( shapeSmallUpTriangle * Buy + shapeSmallDownTriangle *
Sell, IIf( Buy, colorGreen, colorRed ) );
GraphXSpace=10;
-----8<---------------------------------------------------
-Alex
---8<------------------------------------------------------
> > > function ProjOsc(n) {
> > >
> > > // Slope of High {n period regression line of High)}
> > > SlopeHigh = ((n * (Sum( Cum(1) * High, n))) - (Sum( Cum(1),n)
* (
> > > Sum(High, n)))) / ((n * Sum( Cum(1) ^ 2 , n)) - (Sum(Cum(1),n)
^
> > > 2));
> > >
> > > //Slope of Low {n period regression line of Low}
> > > SlopeLow = ((n * (Sum( Cum(1) * Low, n))) - (Sum( Cum(1), n) *
(
> > > Sum(Low, n)))) / ((n * Sum( Cum(1)^ 2, n)) - ( Sum(Cum(1),n) ^
> > > 2));
> > >
> > > //Upper Projection Band
> > > UpProjBand = 0;
> > > for (i=0; i<n-1; i++)
> > > {
> > > UpProjBand =
> > > Max(Max(Ref(High,-i)+i*slopehigh,Ref(High,-i-1)+(i+1)
> > *slopehigh),UpProjBand);
> > > }
> > >
> > > //Lower Projection Band
> > > LoProjBand = 10000;
> > > for (i=0; i<n-1; i++)
> > > {
> > > LoProjBand =
> > > Min(Min(Ref(Low,-i)+i*slopelow,Ref(Low,-i-1)+(i+1)
> > *slopelow),LoProjBand);
> > > }
> > >
> > > //Projection Oscillator
> > > ProOsc = 100 * (Close - LoProjBand) / (UpProjBand -
LoProjBand);
> > >
> > > return ProOsc;
> > >
> > > }
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
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/
|