PureBytes Links
Trading Reference Links
|
anyone has experience with the KASE stops I believe itīs called Dev
stops ? I read somewhere this stop levels are one of the best even
better then MBīs pivot stop levels ?
Thanks
--- In amibroker@xxxxxxxxxxxxxxx, "treliff" <treliff@xxxx> wrote:
> An efficiency improvement in the Kase PeakOscillator code posted
> earlier.
>
> My enthusiasm about picking up the looping stuff spun out of
control
> and made me loop thinks unnecessarily. In the PeakOut lines part of
> the KPO code we need to turn our set PeakOut percentiles into
> standard deviations (PC cycle into THcycle and PChist into THhist,
> TH for threshold). For that we iterated through the standard
> deviations to reach the set PeakOut percentiles using the formula
>
> percentile = ( 2*N(stdev) 1 )*100
>
> and using the Hastings formula to approximate N(ormal distribution).
>
> However we'd be better off using the INVERSE normal distribution
> and calculate the standard deviations directly:
>
> stdev = N-1(0.5*(Percentile/100 + 1))
>
> Just like Hastings is a polynomial approximation for the
> distribution itself, there are approximations for the inverse
> distribution. This eliminates the loop and creates a
straightforward
> calculation.
>
> For who's interested I used an approximation I found on page 4 of
>
> http://www.math.toronto.edu/almgren/mmf/monte-carlo-02/notes2.pdf
>
> Although I think values below 80 hardly make sense (I had
previously
> limited to 81 in order to somewhat limit the # of loops) there is
> now no more theoretical limitation to the settings of PCcycl and
> PChist, you can choose any number between 1 and 99 so in the
> beginning of the code you can change that line to
>
> /* Set percentiles for PeakOut lines using numbers between 1 and 99
> */
>
> Below is PeakOut part of the code including the correction.
>
> /* Definition of PeakOut lines POmax and POmin */
>
> UPcycle = minLB;
> for (i=minLB+1;i<=maxLB;i++)
> { UPcycle = IIf(KSDIup(i)==maxKSDIup,i,UPcycle); }
>
> DNcycle = minLB;
> for (i=minLB+1;i<=maxLB;i++)
> { DNcycle = IIf(KSDIdn(i)==maxKSDIdn,i,DNcycle); }
>
> function f(x)
> { return sqrt(-2*log(1-x)) ; }
>
> function g(x)
> { return f(x) - (2.515517 + 0.802853*f(x) + 0.010328*f(x)^2) / (1 +
> 1.432788*f(x) + 0.189269*f(x)^2 + 0.001308*f(x)^3) ; }
>
> function NDSINV(x)
> { return IIf(0<x AND x<0.5, -g(1-x), IIf(0.5<=x AND x<1, g(x),
> 0)) ; }
>
> if (PCcycl<1) PCcycl=1;
> if (PCcycl>99) PCcycl=99;
> if (PChist<1) PChist=1;
> if (PChist>99) PChist=99;
>
> THcycl = NDSINV(0.5*(PCcycl/100+1));
> THhist = NDSINV(0.5*(PChist/100+1));
>
> CYCL = IIf(KPO>=0,UPcycle,DNcycle);
> MNcycl = MA(KPO,CYCL);
> SDcycl = SD(KPO,CYCL);
> Vcycl1 = MNcycl + THcycl*SDcycl;
> Vcycl2 = MNcycl - THcycl*SDcycl;
> POcycl = IIf(KPO>0,Vcycl1,IIf(KPO<0,Vcycl2,0));
>
> HIST = BarIndex()-maxLB+1;
> MNhist = MA(KPO,HIST);
> SDhist = SD(KPO,HIST);
> Vhist1 = MNhist + THhist*SDhist;
> Vhist2 = MNhist - THhist*SDhist;
> POhist = IIf(KPO>0,Vhist1,IIf(KPO<0,Vhist2,0));
>
> POmax = IIf(abs(POcycl)>abs(POhist),POcycl,POhist);
> POmin = IIf(abs(POcycl)<abs(POhist),POcycl,POhist);
>
> /* end */
>
> -treliff
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->
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/
|