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

Re: [amibroker] Re: Finding points between points



PureBytes Links

Trading Reference Links




Hi Graham,
 
In case you might find it helpful, in the 
AmiBroker-AFL files section is the Auto-Opt Tools DLL I wrote which 
automatically returns optimal Zig for each individual stock (about 30 other 
indicators also). Comes with ready to run AFL code for AA and IB. You can select 
lookback period, min, max and step %, etc for the optimization 
routine. It was written before Tomasz added looping to AFL but it still works 
good!
 
Steve
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  <A title=gkavanagh@xxxxxxxxxxxxx 
  href="">Graham 
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Friday, December 19, 2003 1:34 
  AM
  Subject: RE: [amibroker] Re: Finding 
  points between points
  
  Thanks Jayson, 
  unfortunately zig was an early attempt I did use. Its problem is selecting the 
  appropriate % move whiich varies greatly with the 
  between stock.
  What I guess I need is 
  how to insert a loop within the existing loop that determines if I have 2 
  consecutive peaks or troughs and then find the lowest/highest price between 
  them.
   
  Cheers,Graham<A 
  href="">http://groups.msn.com/asxsharetrading<A 
  href="">http://groups.msn.com/fmsaustralia 
  
  
    
    <FONT 
    face=Tahoma size=2>-----Original Message-----From: Jayson 
    [mailto:jcasavant@xxxxxxxxxxx] Sent: Friday, 19 December 2003 
    2:22 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE: 
    [amibroker] Re: Finding points between points
    <FONT face=Arial color=#0000ff 
    size=2>Graham,
    <FONT face=Arial color=#0000ff 
    size=2> 
    <FONT face=Arial color=#0000ff 
    size=2>Would the use of zig rather than HHV/LLV make sense? Finding the 
    pivots is easy and highestsince()/lowestsince() provides the values. Click 
    any spot on the chart to see the associated values.....
     
    Regards, 
    Jayson 
     <FONT 
    color=#282828 size=2>
    pds=<FONT 
    color=#0000ff>Param(" % 
    thresh hold",5<FONT 
    size=2>,1,<FONT 
    size=2>50,<FONT 
    size=2>1<FONT face=Arial 
    color=#0000ff>);<FONT face=Arial color=#282828 
    size=2>
    x=<FONT 
    color=#0000ff>Zig(<FONT 
    size=2>C<FONT face=Arial 
    color=#0000ff>,pds);
    HP=<FONT 
    color=#0000ff>Ref(x,-<FONT 
    size=2>2)<Ref<FONT 
    size=2>(x,-1) <FONT 
    size=2>AND<FONT 
    color=#0000ff> x<Ref<FONT 
    size=2>(x,-1<FONT color=#282828 
    size=2>);
    L<FONT 
    color=#0000ff>P=Ref<FONT 
    size=2>(x,-2)<FONT 
    size=2>>Ref(x,-<FONT 
    size=2>1) <FONT 
    size=2>AND<FONT 
    color=#0000ff> x><FONT 
    size=2>Ref(x,-<FONT 
    size=2>1<FONT face=Arial 
    color=#0000ff>);
    Plot(<FONT 
    face=Arial size=2>C<FONT face=Arial color=#282828 
    size=2>,"<FONT 
    color=#ff00ff size=2>c<FONT face=Arial color=#ff00ff 
    size=2>",<FONT 
    face=Arial color=#ff00ff size=2>1<FONT face=Arial color=#282828 
    size=2>,64<FONT face=Arial 
    color=#282828 size=2>);
    GraphXSpace<FONT 
    face=Arial>=<FONT 
    size=2>10<FONT face=Arial 
    color=#0000ff>;
    Plot<FONT color=#282828 
    size=2>(Hp<FONT color=#282828 
    size=2>,"H<FONT color=#ff00ff 
    size=2>p"<FONT color=#282828 
    size=2>,5<FONT color=#282828 
    size=2>,2<FONT color=#282828 
    size=2>|styleOwnScale<FONT 
    color=#282828 size=2>);<FONT face=Arial 
    color=#0000ff size=2>
    Plot(<FONT 
    color=#282828 size=2>L<FONT face=Arial color=#282828 
    size=2>p,"<FONT 
    color=#ff00ff size=2>L<FONT face=Arial color=#ff00ff 
    size=2>p",<FONT 
    color=#ff00ff size=2>4<FONT face=Arial color=#282828 
    size=2>,2<FONT 
    face=Arial color=#282828 size=2>|<FONT face=Arial 
    size=2>styleOwnScale<FONT face=Arial color=#282828 
    size=2>);
    Title<FONT 
    face=Arial>="Lowest low 
    "+LowestSince<FONT 
    size=2>(Hp,L)+ 
    " Highest High " +<FONT 
    size=2>HighestSince(Lp,H<FONT 
    size=2>);
    <FONT color=#282828 
    size=2> 
    <FONT 
    color=#0000ff> 
    <FONT face=Tahoma 
    size=2>-----Original Message-----From: Graham 
    [mailto:gkavanagh@xxxxxxxxxxxxx]Sent: Friday, December 19, 2003 
    12:32 AMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE: 
    [amibroker] Re: Finding points between pointsAce, I 
    want information processed from these points, finding the points isjust 
    a first step.I think I have that boolean bit already in the loop, 
    and finding simplelow-high-low is easy enough and would halve the code I 
    sent, but it excludesany second significant point that comes along. In 
    the chart I sent thesecond high would be lost which is a significant 
    moveI have done it in straight AFL but it becomes cumbersome and 
    limited in itsuse further down my track with it. What I have shown is 
    just the first part,I go onto medium and minor price moves as well that 
    require the same type offormula. I was hoping for a shorter solution 
    than using base AFL.Cheers,Graham<A 
    href="">http://groups.msn.com/asxsharetrading<A 
    href="">http://groups.msn.com/fmsaustralia 
    -----Original Message-----From: acesheet 
    [mailto:acesheet@xxxxxxxxx] Sent: Friday, 19 December 2003 1:20 
    PMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] Re: Finding 
    points between pointsGraham,Could you try something like 
    a simple boolean variable that changes from 1 to 0 (not an array) to let 
    you know if what you found is the next low or the next high you are 
    looking for? You could then add it as a status condition in your 
    searching routines. In other words when searching for a low after a high 
    has been found and then another high is found keep storing the latest 
    high until a low comes along and switches the boolean to 0 (assuming it 
    was 1 when a high was found).That may 
    help.-ace--- In amibroker@xxxxxxxxxxxxxxx, "Graham" 
    <gkavanagh@xxxx> wrote:> I am pulling whats left of my hair on 
    this one> I want to find the turning points for major price moves and 
    makecertain> that each point is alternating between high then 
    low. If a newhigh is found> before a low TP and is higher than 
    the previous high, it becomesthe new> high TP. (similar for the 
    lows). BUT I then want to insert a low(or high)> between the 
    concurrent highs but cannot seem to get it. (thealternative> 
    would be to remove the first TP and keep the next one)> In words just 
    using the highs as example, find the Highest highfor a period> of 
    time, then search for the next lowest low, but if higher highis 
    found> before the next lowest low, then it is kept (lower highs 
    arerejected before> a low is found).> > Can someone 
    please help, here is the code I have so far forplotting. The> 
    answer is probably so easy, but I feel like a first time novicenot 
    seeing> the forest for the trees.> > > //BASE 
    CALCULATION OF TURN POINTS Plot(C,"",colorBlack,styleBar);> > 
    //Assign H & L for zero volume Bars as = Last Bar with H not= L H = 
    > IIf( V==0 AND GroupID()!= 1, ValueWhen( V > 0, H ), H ); L = 
    IIf( V==0 > AND GroupID()!= 1, ValueWhen( V > 0, L ), L );> 
    > //MAJOR TRENDS> > //Set the intitial values for 
    looping> MajorTop = Null;> MajorBottom = Null;> 
    LastMajorTop = 0;> MajorResLevel = Null;> MajorSupLevel = 
    Null;> MajorBotBar = Null;> MajorBotBar = Null;> //look 
    backward & forward bars for trends> MajorM = 
    Param("M",10,5,20,1);> MajorN = Param("N",50,30,80,5);> 
    > //DEFINE THE BACKWARD & FORWARD REQUIREMENTS> MajorHigh 
    => H == Ref( HHV( H, ( 2 * MajorM ) + 1 ), MajorM ) AND> H 
    > Ref( HHV( H, MajorN ), -MajorM-1 ) AND> H > Ref( HHV( H, 
    MajorN ), MajorM + MajorN );> > MajorLow => L == Ref( 
    LLV( L, ( 2 * MajorM ) + 1 ), MajorM ) AND> L < Ref( LLV( L, 
    MajorN ), - MajorM-1 ) AND> L < Ref( LLV( L, MajorN ), MajorM + 
    MajorN );> > //Loop to find MajorTops and MajorBottoms, plus 
    price values ofMajorTops &> MajorBottoms> for( i=1; 
    i<BarCount-1; i++ )> {>  if( MajorHigh[i] && 
    LastMajorTop[i-1]==0 )>  {>   MajorTop[i] = 
    1;>   MajorResLevel[i] = H[i];>   
    LastMajorTop[i] = 1;>   MajorTopBar[i] = 
    i;>   MajorSupLevel[i] = MajorSupLevel[i-1];>  
    }>  else>  {>   if( MajorHigh[i] 
    && LastMajorTop[i-1]==1 && H[i]>MajorResLevel[i-1] 
    )>   {>    MajorTop[i] = 
    1;>    MajorResLevel[i] = 
    H[i];>    LastMajorTop[i] = 
    1;>    MajorTopBar[i] = i;>    
    MajorSupLevel[i] = MajorSupLevel[i-1];>   
    }>   else>   {>    
    if( MajorLow[i] && LastMajorTop[i-1]==1 )>    
    {>     MajorBottom[i] = 
    1;>     MajorSupLevel[i] = 
    L[i];>     LastMajorTop[i] = 
    0;>     MajorBotBar[i] = 
    i;>     MajorResLevel[i] = 
    MajorResLevel[i-1];>    }>    
    else>    {>     if( 
    MajorLow[i] && LastMajorTop[i-1]==0  && 
    L[i]<MajorSupLevel[i-1] )>     
    {>      MajorBottom[i] = 
    1;>      MajorSupLevel[i] = 
    L[i];>      LastMajorTop[i] = 
    0;>      MajorBotBar[i] = 
    i;>      MajorResLevel[i] = 
    MajorResLevel[i-1];>     
    }>     else>     
    {>      MajorSupLevel[i] = 
    MajorSupLevel[i-1];>      MajorResLevel[i] = 
    MajorResLevel[i-1];>      LastMajorTop[i] = 
    LastMajorTop[i-1];>     
    }>    }>   }>  }> 
    }> GraphXSpace = 5;> > PlotShapes( MajorBottom * 
    shapeStar, colorGreen, 0, L, 0 ); > PlotShapes( MajorTop * shapeStar, 
    colorSeaGreen, 0, H, 0 );> > Plot( MajorSupLevel, "MajorSupTP 
    Level", colorSeaGreen,> styleNoLine|styleDots );> Plot( 
    MajorResLevel, "MajorResTP Level", 
    colorBrown,styleNoLine|styleDots> );> > > 
    Cheers,> Graham> <A 
    href="">http://groups.msn.com/asxsharetrading> 
    <A 
    href="">http://groups.msn.com/fmsaustraliaSend 
    BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
    suggest@xxxxxxxxxxxxx-----------------------------------------Post 
    AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: 
    <A 
    href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
    group FAQ at:<A 
    href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
    Yahoo! Groups LinksTo visit your group on the web, go 
    to:<A 
    href="">http://groups.yahoo.com/group/amibroker/To 
    unsubscribe from this group, send an email 
    to:amibroker-unsubscribe@xxxxxxxxxxxxxxxYour use of Yahoo! 
    Groups is subject to:  <A 
    href="">http://docs.yahoo.com/info/terms/ 
    Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend 
    SUGGESTIONS to 
    suggest@xxxxxxxxxxxxx-----------------------------------------Post 
    AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: 
    <A 
    href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
    group FAQ at: <A 
    href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
    
    
    Yahoo! Groups Links
    
      To visit your group on the web, go to:<A 
      href="">http://groups.yahoo.com/group/amibroker/  

      To unsubscribe from this group, send an email to:<A 
      href="">amibroker-unsubscribe@xxxxxxxxxxxxxxx  

      Your use of Yahoo! Groups is subject to the <A 
      href="">Yahoo! Terms of Service. 
    Send BUG REPORTS to 
    bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
    suggest@xxxxxxxxxxxxx-----------------------------------------Post 
    AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: 
    <A 
    href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
    group FAQ at: <A 
    href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
    
    
    Yahoo! Groups Links
    
      To visit your group on the web, go to:<A 
      href="">http://groups.yahoo.com/group/amibroker/  

      To unsubscribe from this group, send an email to:<A 
      href="">amibroker-unsubscribe@xxxxxxxxxxxxxxx  

      Your use of Yahoo! Groups is subject to the <A 
      href="">Yahoo! Terms of Service. 
    Send BUG REPORTS to 
  bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  
  
  Yahoo! Groups Links
  
    To visit your group on the web, go to:<A 
    href="">http://groups.yahoo.com/group/amibroker/  

    To unsubscribe from this group, send an email to:<A 
    href="">amibroker-unsubscribe@xxxxxxxxxxxxxxx  

    Your use of Yahoo! Groups is subject to the <A 
    href="">Yahoo! Terms of Service. 
  


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 the Yahoo! Terms of Service.