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

Re: [amibroker] Re: Oscillator Within Linear Reg Lines Ken Close



PureBytes Links

Trading Reference Links

Ken:
 
Thanks for the excellent and thorough explanation. I haven't tried it yet but looks like I should be able to follow it. 
Joe 
  ----- Original Message ----- 
  From: Ken Close 
  To: amibroker@xxxxxxxxxxxxxxx 
  Sent: Friday, September 24, 2004 6:06 AM
  Subject: RE: [amibroker] Re: Oscillator Within Linear Reg Lines (DT?)


  Joe:



  I am trying to work on a collection of indicators which give me some
  idea of when to add more hedge or relieve (take off) some hedge based on
  shorter to intermediate term moves on the small cap market.



  Most indicators I have tried seem to work at times and not at other
  times, yielding a neutral result if backtested over a long period.



  My idea was to manually drag regression channels over various periods
  and look at the percent indicator as a sign of OB or OS conditions.  By
  isolating periods (by dragging) I could (the theory goes), better
  accommodate different market periods or conditions.



  Initial experimentation is not glowing with promise, is one way of
  putting it.



  RU and RL are the study names automatically given to the Upper and Lower
  lines drawn when you drag a regression line indicator across portions of
  the chart.  The original code DT wrote found and automatically drew a
  support line and a corresponding parallel upper line, using different
  study names.  I simply substituted the RL and RU names into his code and
  added a few lines.



  I draw the regression channel in the standard price chart and then plot
  the indicator in another pane.



  Ken



  -----Original Message-----
  From: Joe Landry [mailto:jelandry@xxxxxxxxxxxxx] 
  Sent: Thursday, September 23, 2004 11:44 PM
  To: amibroker@xxxxxxxxxxxxxxx
  Subject: Re: [amibroker] Re: Oscillator Within Linear Reg Lines (DT?)



  Ken - Could you explain how you would use this? both in getting it to
  work and how you use that information in trading or monitoring your
  positions. 
  I'm able to fire up the routine that DT wrote but when I add the
  studies(RU, RL) it doesn't work for me. Of course there's a lot I don't
  know about how to use these hand drawn trend lines/channels.  For
  example how does the specific indicator window associate/connect with
  the hand drawn studies.  I never have understood where main chart was
  versus any of the other panes

  Thanks in advance
  JOE 
    ------ Original Message ----- 
    From: Ken Close 
    To: amibroker@xxxxxxxxxxxxxxx 
    Sent: Thursday, September 23, 2004 9:29 AM
    Subject: RE: [amibroker] Re: Oscillator Within Linear Reg Lines (DT?)


    DT:

    Many many thanks.  This (with modifications-see below) was just want I
    wanted and needed.

    I prefer the hand drawn (dragged) regression channel but will
  experiment
    with the auto support line you have provided.

    Ken

    As modified for Regression channel (RU = upper line, RL = lower line)

    x=Cum(1);
    SU=Study("RL");
    X1=ValueWhen(Cum(IsTrue(SU))==1,X);
    Y1=ValueWhen(X==X1,SU);
    X2=LastValue(X);
    Y2=LastValue(SU);
    SLOPE=(Y2-Y1)/(X2-X1);
    YP=LastValue(Highest(IsTrue(SU)*H));
    XP=LastValue(ValueWhen(H==YP,X));
    RE=Study("RU");
    ratio=(C-SU)/(RE-SU);
    Title=Name()+", Ratio="+WriteVal(RATIO);
    GraphXSpace=5;
    Plot(ratio,"",6,1);
    Plot(1,"",9,1);
    Plot(0,"",9,1);

    -----Original Message-----
    From: DIMITRIS TSOKAKIS [mailto:TSOKAKIS@xxxxxxxxx] 
    Sent: Thursday, September 23, 2004 8:35 AM
    To: amibroker@xxxxxxxxxxxxxxx
    Subject: [amibroker] Re: Oscillator Within Linear Reg Lines (DT?)

    Ken,
    There are numerous variations already posted here, but a fresh one is 
    always better...
    In the following code SU is the [automatic] support for per=5, RE is 
    the parallel to SU from the highest H [as long as SU exists].
    The Ratio will be equal to 0 when C=SU, negative when C<SU, from 0 to 
    1 as soon as RE>C>SU and greater than 1 when C>RE.
    I think it is a representative scaling.

    per = 5;//calibrate the sensitivity
    x = Cum(1);
    s1=L;s11=H;
    pS = TroughBars( s1, per, 1 ) == 0;
    endt= LastValue(ValueWhen( pS, x, 1 ));
    startt=LastValue(ValueWhen( pS, x, 2 ));
    dtS =endt-startt;
    endS = LastValue(ValueWhen( pS, s1, 1 ) );
    startS = LastValue( ValueWhen( pS, s1, 2  ));
    aS = (endS-startS)/dtS;bS = endS;
    trendlineS = aS * ( x  -endt ) + bS; 
    SU = IIf(x>startt-1,trendlineS,-1e10);
    Plot(SU,"\nSU",colorYellow,styleThick);
    X1=ValueWhen(Cum(IsTrue(SU))==1,X);
    Y1=ValueWhen(X==X1,SU);
    X2=LastValue(X);Y2=LastValue(SU);
    SLOPE=(Y2-Y1)/(X2-X1);
    YP=LastValue(Highest(IsTrue(SU)*H));
    XP=LastValue(ValueWhen(H==YP,X));
    RE=YP+SLOPE*(X-XP);
    Plot((SU/SU)*RE,"\nRE",colorYellow,styleThick);
    Plot(C,"\nC",1,64);
    GraphXSpace=2;
    ratio=(C-SU)/(RE-SU);
    Title=Name()+", Ratio="+WriteVal(RATIO);

    Note also that SU may be replaced by another line of your preference, 
    code or manually drawn.
    Dimitris 
    --- In amibroker@xxxxxxxxxxxxxxx, "Ken Close" <closeks@xxxx> wrote:
    > DT (or others):  
    > 
    > Can you (or anyone) point me to any previous messages or any 
    previous
    > work which has been done which would accomplish the following.  It 
    seems
    > like you would know given all of your mathematical creations 
    (oblique
    > fib lines, parabolic trendlines, etc).
    > 
    > I would like to manually draw a regression channel from date A to 
    date
    > B.
    > I would then like a plot to show the position, in percent, of the 
    price
    > between the two outer regression lines. Alternatively, this code 
    would
    > also work within any two manually drawn and named trend lines that 
    are
    > roughly parallel as long as they start and stop on the same bar.
    > 
    > Ideally, the code would show greater than 100% (when price goes 
    outside
    > the upper regression line) or less than zero % (when price goes 
    below
    > the lower bar).  It seems it should link to regression lines that
    > automatically extend.
    > 
    > Can you or anyone point to a message or to any code that could
    > accomplish this?
    > 
    > Many thanks for any help.
    > 
    > Ken
    > 
    > ---
    > Outgoing mail is certified Virus Free.
    > Checked by AVG anti-virus system (HYPERLINK
  "http://www.grisoft.com)."http://www.grisoft.com).
    > Version: 6.0.754 / Virus Database: 504 - Release Date: 9/6/2004



    Check AmiBroker web page at:
    HYPERLINK "http://www.amibroker.com/"http://www.amibroker.com/

    Check group FAQ at:
    HYPERLINK
  "http://groups.yahoo.com/group/amibroker/files/groupfaq.html"http://grou
  ps.yahoo.com/group/amibroker/files/groupfaq.html 



    Yahoo! Groups Sponsor
    ADVERTISEMENT





    Yahoo! Groups Links
    . To visit your group on the web, go to:
    HYPERLINK
  "http://groups.yahoo.com/group/amibroker/"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 the Yahoo! Terms of Service.


    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (HYPERLINK
  "http://www.grisoft.com)."http://www.grisoft.com).
    Version: 6.0.768 / Virus Database: 515 - Release Date: 9/22/2004




    Check AmiBroker web page at:
    HYPERLINK "http://www.amibroker.com/"http://www.amibroker.com/

    Check group FAQ at: HYPERLINK
  "http://groups.yahoo.com/group/amibroker/files/groupfaq.html"http://grou
  ps.yahoo.com/group/amibroker/files/groupfaq.html 


          Yahoo! Groups Sponsor 
                ADVERTISEMENT
               
         
         


  ------------------------------------------------------------------------
  ------
    Yahoo! Groups Links

      a.. To visit your group on the web, go to:
      HYPERLINK
  "http://groups.yahoo.com/group/amibroker/"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]



  Check AmiBroker web page at:
  HYPERLINK "http://www.amibroker.com/"http://www.amibroker.com/

  Check group FAQ at: HYPERLINK
  "http://groups.yahoo.com/group/amibroker/files/groupfaq.html"http://grou
  ps.yahoo.com/group/amibroker/files/groupfaq.html 






  Yahoo! Groups Sponsor



  ADVERTISEMENT
  HYPERLINK
  "http://us.ard.yahoo.com/SIG=129p2pio8/M=295196.4901138.6071305.3001176/
  D=groups/S=1705632198:HM/EXP=1096083829/A=2128215/R=0/SIG=10se96mf6/*htt
  p:/companion.yahoo.com"click here


  HYPERLINK
  "http://us.adserver.yahoo.com/l?M=295196.4901138.6071305.3001176/D=group
  s/S=:HM/A=2128215/rand=627494759"



     _____  

  Yahoo! Groups Links

  *      To visit your group on the web, go to:
  HYPERLINK
  "http://groups.yahoo.com/group/amibroker/"http://groups.yahoo.com/group/
  amibroker/
    
  *      To unsubscribe from this group, send an email to:
  HYPERLINK
  "mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe"amibro
  ker-unsubscribe@xxxxxxxxxxxxxxx
    
  *      Your use of Yahoo! Groups is subject to the HYPERLINK
  "http://docs.yahoo.com/info/terms/"Yahoo! Terms of Service. 


  ---
  Incoming mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.768 / Virus Database: 515 - Release Date: 9/22/2004



  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.768 / Virus Database: 515 - Release Date: 9/22/2004



  [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
             
       
       


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