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

RE: LITTLE HELP PLEASE RE: [amibroker] Slight problem with this script - I'm Stumped



PureBytes Links

Trading Reference Links




I think that because it 
displaces to the right to look into the future it sees the values past the last 
bar as being null. Because both sides of the = are null they are therefor equal 
causing the pk to be true.
 
 
Cheers,Graham<A 
href="">http://groups.msn.com/ASXShareTrading<A 
href="">http://groups.msn.com/FMSAustralia 


  
  <FONT 
  face=Tahoma size=2>-----Original Message-----From: Gary A. 
  Serkhoshian [mailto:serkhoshian777@xxxxxxxxx] Sent: Sunday, 16 
  November 2003 7:18 AMTo: 
  amibroker@xxxxxxxxxxxxxxxSubject: LITTLE HELP PLEASE RE: 
  [amibroker] Slight problem with this script - I'm Stumped
  Hi all,
   
  Can anyone explain what is going on in the array below that would cause 
  it to = 1 for the last four bars on AMD where the Ref(L,-3) is the trough low 
  when n=3.  The error only occurs when the tr or pk arrays = 1 and are 
  within n bars or so from the peak or trough, and I assume it has 
  something to do with looking in the future with the outer REF.
   
  I just want to understand the error in coding so I don't make the same 
  mistake.  The full code is at the bottom of the e-mail.  Thanks, 
  Gary
   
   
  <FONT 
  face="Courier New">pk=Ref(HHV(H,2*n+1)==Ref(H,-n),n);tr=Ref(LLV(L,2*n+1)==Ref(L,-n),n);
   
   
  
  In Ace's code, what is going on in AB that causes the array 
   
  HHV(H,2*n+1)==Ref(H,-n) to = 1 when forecasted 3 
  bars in the future when those bars don't yet exist.  In other words, why 
  the green colored bars on AMD with n=3 for the last 4 bars?  

   
  Your solution was a good one, but I just wanted to bring closure to what 
  was happening in Ace's original code related to the Ref looking n bars in 
  future of array above.
   
   
  "Gary A. Serkhoshian" <serkhoshian777@xxxxxxxxx> 
  wrote:
  <BLOCKQUOTE class=replbq 
  >
    Graham,
     
    In Ace's code, what is going on in AB that causes the array 
     
    HHV(H,2*n+1)==Ref(H,-n) to = 1 when forecasted 
    3 bars in the future when those bars don't yet exist.  In other words, 
    why the green colored bars on AMD with n=3 for the last 4 bars?  
    
     
    Your solution was a good one, but I just wanted to bring closure to 
    what was happening in Ace's original code related to the Ref looking n bars 
    in future of array above.
     
    Thanks,
    Gary
    Graham <gkavanagh@xxxxxxxxxxxxx> 
    wrote:
    <BLOCKQUOTE class=replbq 
    >AceAdd 
      this to your plot and you will see why. These are your conditions for 
      the pk. 
      Plot(Ref(HHV(H,2*n+1),n),"",colorRed,styleLine);Plot(Ref(Ref(H,-n),n),"",colorBlue,styleLine);You 
      could also centre the sh and sl plots around the bars that for the pk 
      &tr bars. Plot( Ref(sh,2*n+1), "SH", colorPink, styleLine); 
      Plot( Ref(sl,2*n+1), "SL", colorLightBlue, styleLine); GraphXSpace=5; 
      Cheers,Graham<A 
      href="">http://groups.msn.com/ASXShareTrading<A 
      href="">http://groups.msn.com/FMSAustralia 
      -----Original Message-----From: acesheet 
      [mailto:acesheet@xxxxxxxxx] Sent: Saturday, 15 November 2003 12:25 
      PMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] Slight problem 
      with this script - I'm StumpedHi all,I plan on using 
      this script to test breakout trading systems and it just about works 
      the way I want it to. But....What I'm trying to do is determine 
      swing highs and lows of "nth" degree. Which means that if I select a 
      n=2 degree Swing High/Low setup the swing high (SH), for instance, 
      must have two lower (or equal) highs both on the left and on the right 
      of it. So I don't know until two days after the SH occured that it 
      actually was an SH.In this script I've colored the bars green and 
      dark red. The greens represent the SL's and the dark red's the SH's. I 
      also plotted an envelope (pink and light blue) of the latest SH's and 
      SL's that are known at the time of each bar.My problem is that 
      for certain selections of 'n' and certain stocks several bars near the 
      last set of bars get colored when the script shouldn't even know if 
      they are SH's or SL's. To see what I mean try plotting AMD with 
      n=3.Can anyone tell me why these colors are occuring? Better yet, 
      can you offer a solution? Thanks.-ace// 
      --------------------------------------------------// ---------------- 
      Start AFL Script ----------------// 
      --------------------------------------------------// Plotting Swing 
      Highs and Lows// 
      --------------------------------------------------// Degree of SH/SL 
      setn=3;// --------------------------------------------------// 
      Peak and Trough points (SH's and SL's) 
      pk=Ref(HHV(H,2*n+1)==Ref(H,-n),n);tr=Ref(LLV(L,2*n+1)==Ref(L,-n),n);// 
      --------------------------------------------------// SH and SL 
      envelope 
      valuessh1=IIf(pk,H,Null);sh=Ref(HighestSince(pk,sh1,1),-n-1);sl1=IIf(tr,L,Null);sl=Ref(HighestSince(tr,sl1,1),-n-1);// 
      --------------------------------------------------// PlottingPlot( 
      Close, "OHLC", IIf(pk,colorDarkRed,IIf 
      (tr,colorGreen,colorBlack)),132); Plot( sh, "SH", colorPink, 
      styleLine); Plot( sl, "SL", colorLightBlue,styleLine); 
      GraphXSpace=5;------------------------ Yahoo! Groups 
      Sponsor ---------------------~--> BuyInk Cartridges or Refill Kits 
      for your HP, Epson, Canon or Lexmark Printerat MyInks.com. Free s/h on 
      orders $50 or more to the US & Canada.<A 
      href="">http://www.c1tracking.com/l.asp?cid=5511<A 
      href="">http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM---------------------------------------------------------------------~->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 
      Your 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 
      Your use of Yahoo! Groups is subject to the <A 
      href="">Yahoo! Terms of Service. 
      
    
    
    Do you Yahoo!?Protect 
    your identity with Yahoo! Mail AddressGuard
  
  
  Do you Yahoo!?Protect 
  your identity with Yahoo! Mail AddressGuard 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 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor


  ADVERTISEMENT











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



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.