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

[amibroker] Active Trader Magazine March 2003 Range Roving Script



PureBytes Links

Trading Reference Links

I am new to AFL and I think I picked the wrong system and indicator
to try as my first script. It is from p. 58 on this month's Active
Trader magazine. Some problems I am having: I need to pass in the the 
current bar# to the VBScript function and I do not know how to do 
that; the article gets confusing about what exactly n means in their 
pseudo-code. They have the formula:
Hrng(n) = [(h-l[n])/n^ALPHA]/ATR(n)
where [n] is the value of the bar n bars back.

Then you are supposed to find the MaxHrng for 
bars m to n. Is that h and l the high and low for
the bar at bar - n? Is the nth bar raised to the alpha
constant the actual bar number or the number 25 wich they hard
coded in their script? ATR(n) in AFL is an array and yet 
I think they want a single variable of the value of ATR at n?
Sorry, this script is not even close to working! They were also
using IntraDay data and I am changing it to close of day since
that is all I have. Could someone with a little more 
experience and of course the magazine article 
help me out. Thank you. Marc

// RANGE ROVING SAMPLE 
// From Active Trader Magazine March 2003
// by Dennis Meyers


EnableScript("vbscript");
m = 6; // THIS CAN BE OPTIMIZED
n = 25; // THIS WAS KEPT FIXED IN ARTICLE
REFN = Ref(Close,-n);
ATRN =  ATR(n);
Alpha = .75; // THIS CAN BE OPTIMIZED
xoH = .5; // THIS CAN BE OPTIMIZED
xoL = 1.05; // THIS CAN BE OPTIMIZED


<%
LowArray = AFL("low")
HighArray = AFL("high")
CloseArray = AFL("close")
Alpha = AFL("Alpha")
m = AFL.Var("m")
n = AFL.Var("n")
ATRN = AFL.Var("ATRN")
Lrng = 0
Hrng = 0
MaxLrng = 0
MaxHrng = 0
for i = m to n // NEED TO BE BAR -n to bar -m I think
Hrng = (((HighArray(i) - LowArray(i)) * Closearray(i))/i^Alpha)/ATRN
(i)
if Hrng > MaxHrng then MaxHrng = Hrng
Lrng = (((LowArray(i) - HighArray(i)) * Closearray(i))/i^Alpha)/ATRN
(i)
if Lrng > MaxLrng then MaxLrng = Lrng
next
AFL.var("MaxLrng") = MaxLrng
AFL.var("MaxHrng") = MaxHrng
%>
Buy = MaxHrng > xoH AND MaxLrng < xoL;
Sell = MaxLrng > xoL AND MaxHrng  xoH;




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 http://docs.yahoo.com/info/terms/