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

Re: [AmiBroker] Re: Search Routine for Crossover Point -- EMA Version



PureBytes Links

Trading Reference Links




<FONT face=Arial 
color=#0000ff size=2>Ron - the code has been mangled by Yahoo.  

<FONT face=Arial 
color=#0000ff size=2> 
<FONT face=Arial 
color=#0000ff size=2>That's what's causing your problems if you just copied and 
pasted it without trying to straigthen out the line wraps.
<FONT face=Arial 
color=#0000ff size=2> 
<FONT face=Arial 
color=#0000ff size=2>Its not an easy thing to do since Fred used such long "*' 
lines.
<FONT face=Arial 
color=#0000ff size=2> 
<FONT face=Arial 
color=#0000ff size=2>d


From: Ron Morton 
[mailto:mortonr003@xxxxxxxxxxxxx] Sent: Saturday, January 31, 2004 
2:07 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re: 
[amibroker] Re: Search Routine for Crossover Point -- EMA 
Version

All I did was copy the code from the messages here 
and put it into amibroker.  No changes were made to the code, as soon as I 
hit apply I would get the syntax error message.  I highlighted in red on 
the code on this page where there errors occurred.
ron
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Jayson 
  
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Saturday, January 31, 2004 8:52 
  AM
  Subject: RE: [amibroker] Re: Search 
  Routine for Crossover Point -- EMA Version
  
  <FONT face=Arial color=#0000ff 
  size=2>Impossible to say with out seeing the code..... sounds like you are 
  calling calc and goal prior to defining them..
   
  Regards, 
  Jayson 
  <FONT face=Tahoma 
  size=2>-----Original Message-----From: Ron Morton 
  [mailto:mortonr003@xxxxxxxxxxxxx]Sent: Saturday, January 31, 2004 
  1:41 PMTo: <A 
  href="">amibroker@xxxxxxxxxxxxxxxSubject: 
  Re: [amibroker] Re: Search Routine for Crossover Point -- EMA 
  Version
  I tried running the code here as it looks like 
  something that I've been searching for for a while.  When I tried to run 
  it I keep getting syntax error 23 whenever the words calc or goal come 
  up.  Could someone explain to me how to go about fixing this?  The 
  specific areas where this occurs are Calc=P1; and <FONT face="Courier New" 
  size=3>Goal = LastValue(BBandBot(P1, 14, 2)); 
  Thank you,
  Ron
  <BLOCKQUOTE 
  >
    ----- Original Message ----- 
    <DIV 
    >From: 
    dingo 

    To: <A title=amibroker@xxxxxxxxxxxxxxx 
    href="">amibroker@xxxxxxxxxxxxxxx 
    Sent: Saturday, January 31, 2004 5:41 
    AM
    Subject: RE: [amibroker] Re: Search 
    Routine for Crossover Point -- EMA Version
    
    <FONT face=Arial 
    color=#0000ff size=2>Take a closer look at what Fred did.  He shifted 
    the array back by 1 bar so that it would plot into the 
    future by one bar. It just doesn't use the space that is non-addressable in 
    the chart area.  Its the only solution right now and it can be adapted 
    to  what you want by shifting the array by as many bars as you 
    need.
    <FONT face=Arial 
    color=#0000ff size=2> 
    <FONT face=Arial 
    color=#0000ff size=2>d
    
    
    From: pcwinch 
    [mailto:pcwinch@xxxxxxxxxxxxxxx] Sent: Saturday, January 31, 2004 
    9:51 AMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re: 
    [amibroker] Re: Search Routine for Crossover Point -- EMA 
    Version
    
    Gentlemen,
     
    This is starting to get interesting especially 
    of someone can figure out how we can extend this into the whitespace area 
    beyond the latest data.
     
    For example, use your favourite indicator(s) 
    and apply projected regression channel to the prices.  
     
    Qu: A.what happens to your indicator when 
    prices are at the mid and extremes of the next bar..and the next bar, then 
    
     
    B. use the formula below to see what happens 
    when the indicator is 1. extrapolated , 2. the same or 3. (2*same - 
    extrapolated)
     
    What would be interesting is what happens to 
    all the indicators and the prices in the channel when this is applied to one 
    indicator, and how the indicators look in different time frames.  
    What does it mean to the setting of stops and exits philosophy is also 
    an interesting outcome.
     
    Any comments?
     
    Peter
     
    ----- Original Message ----- 
    <BLOCKQUOTE 
    >
      <DIV 
      >From: 
      <A title=ftonetti@xxxxxxxxxxxxx 
      href="">Fred 
      To: <A 
      title=amibroker@xxxxxxxxxxxxxxx 
      href="">amibroker@xxxxxxxxxxxxxxx 
      
      Sent: Saturday, January 31, 2004 3:41 
      AM
      Subject: [amibroker] Re: Search 
      Routine for Crossover Point -- EMA Version
      Is there any reason to limit this to an xMA when this 
      can easily be done for any built in AB indicator or any custom AFL 
      "indicator" that one cares to write 
      ?//      
      *********************************************** 
      ////      An all purpose routine to find 
      the price //      
            necessary to move an indicator to a 
      GOAL.////      This should work for 
      virtually any indicator,//      
            built in or otherwise.  It's 
      demonstrated //      
            here using RSI & BBand's 
      ...////      
      Note:      It will appear to use future 
      quotes//            
                  because of 
      the down shifting of the//      
                  
            price array, but obviously it 
      can't//            
                  "know" 
      tomorrows price.  There's //      
                  
            probably a way to rectify this but 
      //            
                  I was more 
      concerned with the rest //      
                  
            of the 
      process.////      The maximum iterations 
      have arbitrarily been //      
            set to 200 which is undoubtedly overkill 
      //            as 
      I've yet to see anything take 200 even//      
            when tolerance was set to 0 on datastreams 
      //            with 
      very high prices.////      For real usage 
      the saving of i in j and the//      
            accuracy calculation can be tossed as they 
      //            were 
      only put in for demonstration purposes 
      ////      
      ***********************************************////      
      This Routine requires the following 
      things////      
      P0            = A price 
      array or synthetic////      
      Goal      = The goal value of the 
      indicator////      
      Acc            = An 
      accuracy level for the 
      calculations////      
                    Set 
      this to the order of magnitude //      
                    that 
      you want.  For example if you want 
      //            
              accuracy in calculated price to 
      within //            
              0.01 then set it 0.01.  It can 
      even //            
              be set to 0 which will force AB to 
      //            
              calculate until it can't find any 
      //            
              further improvements (Usually 
      between//            
              150-170 iterations) but this is 
      semi//            
              useless as improvements relative to 
      //            
              price granularity have long since 
      //            
              been gone 
      by.////      
                    The 
      lower you set it the longer it //      
                    will 
      take but it's pretty quick //      
                    
      (Usually between 15-30 iterations) //      
                    
      unless you set it at 0.//      
                  
                  
      //      
      ***********************************************////      
      Note:      Some goals are virtually unattainable 
      on//            
            the next bar, especially on the 
      downside//      
                  as they 
      would require a negative price//      
                  which is 
      what this routine will show if//      
                  that is what 
      is required.////      
      ***********************************************P0   = 
      C;Acc  = 0.0001;LVBI = LastValue(BarIndex());Mult 
      = 1;//      
      ***********************************************//      
      Shift Price up by n orders of magnitude to make 
      //            it 
      >= 1.  This is useful to increase 
      //            
      accuracy on very low priced datastreams 
      //            such 
      as the JY.//      
      ***********************************************for (i = 0; i < 10; 
      i++){       if (P0[LVBI] >= 1) 
                  i = 99; 
            else       
            Mult = Mult * 10; } // 
      ***********************************************P1   = 
      Ref(P0, 1) * Mult;UpDn = 100 * P1[LVBI];for (i = 0; i < 
      200; i++){//      An example for 
      finding price associated with the next bars 
      BBandTop////      
      *****************************************************************************//      
      Put whatever indicator you want to goal seek here based on 
      P1//      
      *****************************************************************************      
      Calc = P1;    Syntax error 
      here//      
      *****************************************************************************//      
      Put whatever you want for the goal here 
      ...////      The reason for putting it in 
      the loop is because sometimes the goal is price 
      //            
      oriented and will need to be recalculated on each 
      iteration.//      
      *****************************************************************************      
      Goal = LastValue(BBandBot(P1, 14, 
      2));//      
      *****************************************************************************//      
      An example for finding price associated with the next bars RSI value 
      of 65////      
      *****************************************************************************//      
      Put whatever indicator you want to goal seek here based on 
      P1//      
      *****************************************************************************//      
      Calc = RSIa(P1, 14);    Syntax error 
      here//      
      *****************************************************************************//      
      Put whatever you want for the goal here 
      ...////      The reason for putting it in 
      the loop is because sometimes the goal is price 
      //            
      oriented and will need to be recalculated on each 
      iteration.//      
      *****************************************************************************//      
      Goal = 65;//      
      *****************************************************************************      
      if (Calc[LVBI] < Goal)      
            P1[LVBI] = P1[LVBI] + 
      UpDn;      
      else            
      P1[LVBI] = P1[LVBI] - UpDn;      UpDn = UpDn 
      / 2;      if (UpDn <= 
      Acc)      {      
            j = i;      
            i = 
      99999;      }}Accuracy = 100 * 
      (abs(Goal - Calc) / Goal);Filter = BarIndex() == 
      LVBI;AddColumn(Mult,      
                  
                  
            "Multiplier",   
      1.0);AddColumn(Calc[LVBI - 1] / Mult,      
      "Curr Ind Val", 1.9);AddColumn(Goal / 
      Mult,            
                  "Goal Ind 
      Val", 1.9);AddColumn(Calc[LVBI] / Mult,      
            "Calc Ind Val", 
      1.9);AddColumn(j,      
                  
                  
                  
      "Iterations",   1.0);AddColumn(Accuracy,   
                  
                  "Accuray 
      (%)",  1.9);AddColumn(Ref(P1, -1) / 
      Mult,            "Todays 
      Price", 1.9);AddColumn(P1 / Mult,      
                  
                  "Goal 
      Price",   1.9);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@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.