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

RE: [amibroker] Re: DATA GAPS gaps are NOT SHOWN in chart ??!!



PureBytes Links

Trading Reference Links

Hello,

I just started reading Ehler's Cybernetic Analysis For Stocks And 
Futures.  On page 24 he presents an indicator, ITrend, in 
EasyLanguage script as follows:

    Inputs:     Price((H+L)/2),
                Alpha(.07);
               
    Vars:       Smooth(0),
                ITrend(0),
                Trigger(0);
               
    ITrend = (alpha - alpha*alpha/4)*Price
             + .5*alpha*alpha*Price[1] - (alpha
             - .75*alpha*alpha)*Price[2] + 2
             *(1 - alpha)*ITrend[1] - (1 - alpha)
             *(1- alpha)*ITrend[2];
    If currentbar < 7 then ITrend = (Price + 2*Price[1]
             + Price[2])/4;
    Trigger = 2*ITrend - ITrend[2];
    
    Plot1(ITrend, "ITrend");
    Plot2(Trigger, "Trig");
    
I am not knowledgeable on EasyLanguage script.  Anxious to see his 
code in operation I attempted a literal translation of the above 
into afl script as follows:

    price = (H+L)/2;
    alpha = .07;
    iTrend = 0;

    iTrend = IIf(BarIndex()<7,(price + 2*Ref(price,-1) + 
                 Ref(price,-2))/4, ((alpha - alpha*alpha/4) * 
                 price + .5*alpha*alpha*Ref(price,-1) -
                 (alpha - .75*alpha*alpha)*Ref(price,-2) + 
                 2*(1 -alpha)*Ref(iTrend,-1) -
                 (1 - alpha)*(1 - alpha)*Ref(iTrend,-2)));

    trigger = 2*iTrend - Ref(iTrend,-2);

    Plot(iTrend,"iTrend",colorGreen,styleLine);
    Plot(trigger,"Trigger", colorRed,styleLine);
    
Upon placing the above in IB and plotting the results I got a set of 
bizarre looking traces.  I expected a set of traces similar to, say, 
moving averages.

If anyone out there knowledgeable on EasyLanguage could look at my 
implementation of Ehler's script and point out any errors that I 
might have made I would be grateful.

Mike



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