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

Rãspuns: [amibroker] Re: Ehler's formulas coded in AFL



PureBytes Links

Trading Reference Links


I remember reading this stuff and as an engineer it making total 
sense to me. I didnt code it as i didnt have anything to do it so 
glad to see it , wat a program !!! 
My question is though is it really going to result in better 
profitablity ..the market is essentially random and one must deal 
with it being unpredictable . I am yet to see anything that 
correlates with over 60 % correct outcomes consistently. One really 
needs only 30% + to create profit but my point is all this science 
for 50% ..flipa coin is easier .

regards
moz
thanks for this post as I can learn about arrays etc
:-)



--- In amibroker@xxxxxxxxxxxxxxx, "MPLM (Intel EPSD) Razvan Andrei" 
<ra@xxxx> wrote:
> Thanks, Cris, for your help.
> Razvan
>   -----Mesaj original-----
>   De la: Christoper [mailto:turkey@x...]
>   Trimis: 26 octombrie 2004 23:12
>   Catre: amibroker@xxxxxxxxxxxxxxx
>   Subiect: [amibroker] Re: Ehler's formulas coded in AFL
> 
> 
> 
>   Below is one I dug up from my library.
> 
>   Later,
>   Chris
> 
>   --------------------------------
>   /*
>   >From Ehlers book: Cybernetic Analysis for Stocks and Futures
>   */
> 
>   SetBarsRequired(1000000,1000000);
>   freq =Param("Freq",40,3,100,1);
>   price=((H+L)/2);
>   alpha=Param("alpha",0.07,0,1,0.001);
> 
>   BurstLength = 2*freq;
>   pi=4*atan(1);
>   RTD=180/pi;
>   DTR=pi/180;
> 
>   
SWcount=0;SWGate=0;Jcount=0;SWCycle=0;Cycle=0;I1=0;Q1=0;InstPeriod=0;D
>   eltaPhase=0;MedianDelta=0;DC=0;Value1=0;
>   DCPeriod=0;RealPart=0;ImagPart=0;DCPhase=0;MedianDelta=0;Smooth=0;
>   GraphXSpace=5;
> 
>   //{ Sine wave Test}
> 
>   SWcycle =  sin( Cum(1)*(360*DTR)/freq );
>   for (j=0;j<BarCount;j++)
>   {
>     Jcount[j] = j % burstLength[j];
> 
>         if (SWcount[j]==1 AND Jcount[j] == 0)  SWcount[j] = 0;
>               else
>         if (SWcount[j]==0 AND Jcount[j]== 0)  SWcount[j] = 1;
> 
>         if (SWcount[j] ==0)   SWGate[j] = 1;
>               else
>               SWGate[j] = 0;
> 
> 
>   SWGate[j] = SWcount[j] % 2 ;
>   SWGen[j]  = SWCycle[j];// * SWGate[j];
>   }
>   //Plot(SWGen,"",2,1);
> 
>   //Select sinewave test pattern OR real prices
>   Price = IIf(Param("Prices or test",1,1,2,1)==1,Price,SWGen);
> 
>   Smooth = (Price + 2*Ref(Price,-1) + 2*Ref(Price,-2) + Ref(Price,-
>   3))/6;
> 
>   for(i=6;i<BarCount;i++)
>   {
>         Cycle[i]  = (1-0.5*alpha)^2*(Smooth[i] - 2*Smooth[i-1] +
>   Smooth[i-2] + 2*(1-alpha)*Cycle[i-1] - (1-alpha)^2*Cycle[i-2]);
> 
>         //if (i < 7)  Cycle[i] = (Price[i] - 2*Price[i-1] + Price[i-
>   2])/4;
>         //Cycle[i] = Price[i];
> 
>   //Hilbert Transform}
>         Q1[i] = (0.0962*Cycle[i] + 0.5769*Cycle[i-2] - 0.5769*Cycle
[i-
>   4] - 0.0962*Cycle[i-6]) * (0.5 + 0.08*InstPeriod[i-1]);
>         I1[i] = Cycle[i-3];
> 
>         if (Q1[i] != 0 AND Q1[i-1] != 0) DeltaPhase[i] = (I1[i]/Q1
>   [i] - I1[i-1]/Q1[i-1]) / (1 + I1[i]*I1[i-1]/(Q1[i]*Q1[i-1]));
>         if (DeltaPhase[i] < 0.1) DeltaPhase[i] = 0.1;
>         if (DeltaPhase[i] > 1.1) DeltaPhase[i] = 1.1;
>   }
>   MedianDelta = Median(DeltaPhase , 5);
> 
>   //Plot(MedianDelta,"MedianDelta",2,8);
>   //Plot(DeltaPhase,"DeltaPhase",3,8);
>   //Plot(Q1,"Q1",4,8);Plot(I1,"I1",5,8);
>   //Plot(Cycle,"Cycle",5,8);
>   //Plot(Smooth,"Smooth",6,8);
> 
>   for(i=50;i<BarCount;i++)
>   {
> 
>         if (MedianDelta[i] == 0) DC[i]=15;
>         else
>         DC[i] = (6.28318/MedianDelta[i]) + 0.5;
> 
>         InstPeriod[i] = 0.33*DC[i] + 0.67*InstPeriod[i-1];
>         Value1[i] = 0.15*InstPeriod[i] + 0.85*Value1[i-1];
> 
>   //Plot(InstPeriod,"InstPeriod",2,8);
>   //Plot(Value1,"Value1",3,8);
>   //Plot(MedianDelta,"MedianDelta",4,8);
> 
>   //Compute Dominant Cycle Phase
>         DCPeriod[i] = int(Value1[i]);
>         //RealPart[i] = 0; ImagPart[i] = 0;
>         for (Count1=0; Count1 < DCPeriod[i] ;Count1++)//DCPeriod-1
>               {
>                     RealPart[i] = RealPart[i] + sin
>   (360*DTR*Count1/DCPeriod[i]) *Cycle[i-Count1];
>                     ImagPart[i] = ImagPart[i] + cos
>   (360*DTR*Count1 / DCPeriod[i]) * (Cycle[i-Count1]);
>               }
> 
>         if (abs(ImagPart[i]) > 0.001) DCPhase[i] = atan(RealPart
>   [i]/ImagPart[i])*RTD;
>         if (abs(ImagPart[i]) <= 0.001) DCPhase[i] = 90*sign(RealPart
>   [i]);
> 
>            DCPhase[i] = DCPhase[i] + 90;
>            if (ImagPart[i] < 0) DCPhase[i] = DCPhase[i] + 180;
>            if (DCPhase[i] > 345) DCPhase[i] = DCPhase[i] - 360;
> 
>   }
>         SineWave = sin(DCPhase*DTR);
>         LeadSine = sin((DCPhase+45)*DTR);
> 
>   //Plot(DCPeriod,"DCPeriod",0,1);
>   Plot(SineWave,"SineWave",colorGreen,1);
>   Plot(LeadSine,"LeadSine",colorRed,1);
>   Title=" Ehlers Sinewave Indicator (Cybernetic Analysis for Stocks 
and
>   Futures) by cs     \\c01Lead Sine "+LeadSine+"
>   \\c00Sine "+sineWave+" ";
> 
>   Buy = Cross(Sinewave,LeadSine);
>   Sell = Cross(LeadSine, Sinewave);
>   --- In amibroker@xxxxxxxxxxxxxxx, "ra_randrei" <ra@xxxx> wrote:
>   >
>   >
>   > Hi,
>   > I am now evaluating AmiBroker, moving from MetaStock, so I am 
new
>   to
>   > AFL. I am looking for Ehler's formulas coded in AFL. Yes, I know
>   > that some are included in the indicators.dll, but I am not quite
>   > sure that the results are accurate. Beside, I will learn much 
more
>   > from seeing/trying AFL code than from just applying a 
function... I
>   > found a previous post about Instantaneous Trendline, very useful
>   > (Thanks Corey, AMA makes some sense for me now). I am looking 
now
>   > for Sinewave, MAMA/FAMA and mainly Market Mode Indicator. More
>   > details about Ehler's formulas can be found at:
>   > http://www.mesasoftware.com/seminars.htm
>   > also at:
>   > http://www.mesasoftware.com/OWorld2000RocketScience.ppt
>   > Sorry if you received this message twice...
>   > Thanks,
>   > Razvan
> 
> 
> 
> 
> 
>   Check AmiBroker web page at:
>   http://www.amibroker.com/
> 
>   Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> 
> 
>         Yahoo! Groups Sponsor
>               ADVERTISEMENT
> 
> 
> 
> 
> 
> --------------------------------------------------------------------
--------
> --
>   Yahoo! Groups Links
> 
>     a.. To visit your group on the web, go to:
>     http://groups.yahoo.com/group/amibroker/
> 
>     b.. To unsubscribe from this group, send an email to:
>     amibroker-unsubscribe@xxxxxxxxxxxxxxx
> 
>     c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.
> 
> 
> 
> [Non-text portions of this message have been removed]





------------------------ 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/