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

Re: [amibroker] Re: Ehlers.dll



PureBytes Links

Trading Reference Links

Hello,

because of quick AFL on, you must add before the dll
setbarsrequired
ex:
SetBarsRequired(10000,10000);
price = (H + L) / 2;
Plot(sbDC(price),"DC",4,1);

and it must be fine

stephane
Turkey wrote:

> Stephane,
>
> I'm having trouble with the Dominant Cycle function.  Basically if I use
> your example in the help file:
> price = (H + L) / 2;
> Plot(sbDC(price),"DC",4,1);
>
> I observe two issues:
> (a) I'm getting real wacky results.  Negative numbers, really low numbers
> (0.45) And when I slide the horizontal bar backwards or forwards during
> time, sbDC doesn't seem to 'refresh'.  The graph "freeezes" while all 
> other
> charts move through time normally.  I've tried this for many different
> symbols, and after checking data.  However sometimes...
> (b) If I click on different days, sbDC seems to "recalculate" and refresh,
> sometimes to (i) what I would consider correct values or (ii) to another
> wacky state.
>
> This happens with the exact example above.  I'm using EOD data, with data
> from 1/1/200o through today.  With a few hundred symbols.
>
> Help will be appreciated.
>
> Thanks,
> Chris
>
> -----Original Message-----
> From: s.carrasset [mailto:s.carrasset@xxxxxxxxxxx]
> Sent: Thursday, September 30, 2004 6:03 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: Re: [amibroker] Re: Ehlers.dll
>
> yes,
>
> you can use only indicators.dll and remove ehlers.dll of plugin folder, as
> all the codes of ehlers written by stefan sbondorovith if i remember
> correctly his name is included in indicators.dll for the source code, 
> it is
> written in c++ and it is a translation of EL code of tradestation
>
> for ex  the sinewave is below but you can't use directly in amibroker, but
> only in a compiler via a plugin
>
> stephane
>
> AmiVar sbSine( int NumArgs, AmiVar *ArgsTable ) {
>     int i, j,count;
>     int nSize = gSite.GetArraySize();
>
>     AmiVar SineWave = gSite.AllocArrayResult();
>     AmiVar LeadSine = gSite.AllocArrayResult();
>     AmiVar DCPhase = gSite.AllocArrayResult();
>
>     double Qmult = 0.338;
>     double Imult = 0.635;
>   
>     double* InPhase = new double[nSize];
>     double* Phase = new double[nSize];
>     double* DeltaPhase = new double[nSize];
>     double* InstPeriod = new double[nSize];
>     double* Period = new double[nSize];
>     double* Quadrature = new double[nSize];
>     double* Value3 = new double[nSize];
>     double* Value5 = new double[nSize];
>
>     float *Price = ArgsTable[ 0 ].array;
>     j = SkipEmptyValues( nSize, Price, SineWave.array );
>
>     for(i = j; i < 50; i++)
>     {
>         InPhase[i] = 0.0;
>         Phase[i] = 0.0;
>         DeltaPhase[i] = 0.0;
>         InstPeriod[i] = 0.0;
>         Period[i] = 0;
>         Quadrature[i] = 0.0;
>         Value3[i] = 0.0;
>         Value5[i] = 0.0;
>         SineWave.array[i] = LeadSine.array[i]= EMPTY_VAL;
>     }
>
>     for( i =  j + 6; i < nSize; i++ )
>     {
>
>             // Detrend Price
>         Value3[i] = Price[i] - Price[i-7];
>
>         // Compute Inphase and Quadrature
>         InPhase[i] = 1.25 * (Value3[i-4] - Imult * Value3[i-2]) + Imult
> * InPhase[i-3];
>         Quadrature[i] = Value3[i-2] - Qmult * Value3[i] + Qmult *
> Quadrature[i-2];
>
>
>         //Use ArcTangent to compute the current phase
>         if( dabs(InPhase[i] +InPhase[i-1]) > 0)
>             Phase[i] = ArcTangent( dabs((Quadrature[i]+Quadrature[i-1])
> / (InPhase[i]+InPhase[i-1])) );
>
>
>         //Resolve the ArcTangent ambiguity
>         if( (InPhase[i] < 0 ) && (Quadrature[i] > 0))
>             Phase[i] = 180 - Phase[i];
>         if( (InPhase[i] < 0) && (Quadrature[i] < 0))
>             Phase[i] = 180 + Phase[i];
>         if( (InPhase[i] > 0) && (Quadrature[i] < 0))
>             Phase[i] = 360 - Phase[i];
>
>         //Compute a differential phase, resolve phase wraparound, and
> limit delta phase errors
>         DeltaPhase[i] = Phase[i-1] - Phase[i];
>         if( (Phase[i-1] < 90) && (Phase[i] > 270))
>             DeltaPhase[i] = 360 + Phase[i-1] - Phase[i];
>         if( (DeltaPhase[i] < 1))
>             DeltaPhase[i] = 1;
>         if( DeltaPhase[i] > 60)
>             DeltaPhase[i] = 60;
>     }
>
>     for( i =  j + 50; i < nSize; i++ )
>     {
>
>         //Sum DeltaPhases to reach 360 degrees. The sum is the
> instantaneous period.
>         double Value4 = 0.0;
>         InstPeriod[i] = 0.0;
>         for( count = 0; count < 50; count++)
>         {
>             Value4 = Value4 + DeltaPhase[i-count];
>             if( (Value4 > 360.0) && (InstPeriod[i] == 0.0))
>                 InstPeriod[i] = (double)count;
>         }
>
>         //Resolve Instantaneous Period errors and smooth}
>         if( InstPeriod[i] == 0.0)
>             InstPeriod[i] = InstPeriod[i-1];
>         Value5[i] = 0.25 * InstPeriod[i] + 0.75 * Period[i-1];
>
>         //Compute Dominant Cycle Phase, Sine of the Phase Angle and
> Leadsine}
>         Period[i] = floor(Value5[i]);
>         double RealPart = 0.0;
>         double ImagPart = 0.0;
>
>         for( count = 0; count < Period[i]; count++) {
>             RealPart = RealPart + Sine( 360 * count / Period[i] ) *
> Price[i-count];
>             ImagPart = ImagPart + Cosine( 360 * count / Period[i]) *
> Price[i-count];
>         }
>   
>         if( dabs(ImagPart) > 0.001)
>             DCPhase.array[i] = (float)ArcTangent( RealPart / ImagPart );
>           
>         if( dabs(ImagPart) <= 0.001)
>         {
>             int Sign;
>             if( RealPart < 0)
>                 Sign = -1;
>             else
>                 Sign = 1;
>             DCPhase.array[i] = (float) (90 * Sign);
>         }
>       
>         DCPhase.array[i] = DCPhase.array[i] + 90;
>         if( ImagPart < 0 )
>             DCPhase.array[i] = DCPhase.array[i] + 180;
>         if( DCPhase.array[i] > 315)
>             DCPhase.array[i] = DCPhase.array[i] - 360;
>
>
>         SineWave.array[ i ] = (float)(Sine( DCPhase.array[i] ));
>         LeadSine.array[i] = (float)(Sine( DCPhase.array[i] + 45 ));
>
>     }
>     delete [] InPhase;
>     delete [] Phase;
>     delete [] DeltaPhase;
>     delete [] InstPeriod;
>     delete [] Period;
>     delete [] Quadrature;
>     delete [] Value3;
>     delete [] Value5;
>
>     gSite.SetVariable( "sbDCPhase", DCPhase );
>     gSite.SetVariable( "sbLeadSine", LeadSine );
>     return SineWave;
> }
> for ex
>
> > Stephane,
> >
> > Thanks much for you reply, especially since the author is no longer
> > here.  I will make sure that my code contains the SetbarsRequired
> > line and test.
> >
> > So can i assume that I can get rid of Ehlers.dll and utilize your
> > Indicators.dll instead?
> >
> > In addition, would you be willing to share the source code?  Want to
> > get tips on translating easylanguage to afl.
> >
> > Chris
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "s.carrasset" <s.carrasset@xxxx>
> > wrote:
> > > the man who has written the dll is not still active , but he gave
> > me its
> > > sorce code and I have included it in indicators dll.
> > > I am remembering I have modified some code because of crash.
> > > so you must load indicators.dll and perhaps add
> > > SetBarsRequired(10000,10000); at the begin of  the code like
> > > SetBarsRequired(10000,10000);
> > >
> > > Plot(sbDC(scMp()),"CGO",colorRed,1);
> > >
> > > stephane
> > >
> > >
> > >
> > > Christoper wrote:
> > >
> > > > Hi,
> > > >
> > > > Is the author for Ehlers.dll still around?  I'm having some
> > trouble
> > > > with it, Amibroker is crashing every once in a while when I'm
> > running
> > > > a scan.
> > > >
> > > > Can I get the formula for "Dominant Cycle"?
> > > >
> > > > Thanks,
> > > > Chris
> > > >
> > > >
> > > >
> > > > 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
> > > > click here
> > > >
> > <http://us.ard.yahoo.com/SIG=129rdjo41/M=295196.4901138.6071305.300117
> > 6/D=groups/S=1705632198:HM/EXP=1096427260/A=2128215/R=0/SIG=10se96mf6/
> > *http://companion.yahoo.com>
> > > >
> > > >
> > > >
> > > > ------------------------------------------------------------------
> > ------
> > > > *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
> > > >       <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?
> > subject=Unsubscribe>
> > > >      
> > > >     * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> > > >       Service <http://docs.yahoo.com/info/terms/>.
> > > >
> > > >
> > > >
> > > >
> > > > __________ NOD32 1.879 (20040927) Information __________
> > > >
> > > > This message was checked by NOD32 antivirus system.
> > > > http://www.nod32.com
> > >
> > >
> > >
> > >
> > > [Non-text portions of this message have been removed]
> >
> >
> >
> > 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
> > click here
> >
> <http://us.ard.yahoo.com/SIG=129sqeemp/M=298184.5285298.6392945.3001176/D=gr
> oups/S=1705632198:HM/EXP=1096572661/A=2319498/R=0/SIG=11thfntfp/*http://www.
> netflix.com/Default?mqso=60185352&partid=5285298>
> >
> >
> >
> > ------------------------------------------------------------------------
> > *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
> >       <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
> >       
> >     * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> >       Service <http://docs.yahoo.com/info/terms/>.
> >
> >
> >
> >
> > __________ NOD32 1.880 (20040928) Information __________
> >
> > This message was checked by NOD32 antivirus system.
> > http://www.nod32.com
>
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
>
> 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
>
>
>
>
>
>
>
>
>
> 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
> click here 
> <http://us.ard.yahoo.com/SIG=12927n16a/M=294855.5468653.6549235.3001176/D=groups/S=1705632198:HM/EXP=1097208848/A=2376776/R=0/SIG=11ldm1jvc/*http://promotions.yahoo.com/ydomains2004/index.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
>       <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
>        
>     * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>       Service <http://docs.yahoo.com/info/terms/>.
>
>
>
>
> __________ NOD32 1.881 (20040930) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.nod32.com




[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/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/