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

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



PureBytes Links

Trading Reference Links


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:
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,Grahamhttp://groups.msn.com/ASXShareTradinghttp://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.http://www.c1tracking.com/l.asp?cid=5511http://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:http://groups.yahoo.com/group/amibroker/files/groupfaq.html Your use of Yahoo! Groups is subject to 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: 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. 
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard






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.