PureBytes Links
Trading Reference Links
|
Thanks for the quick response Graham, but alas it doesn't do what I had
hoped..
I'm not quite sure how to proceed from here, as I am sure there is an easy
way to do it..
Regards
Bruce
Perth, Australia
----- Original Message -----
From: "Graham" <gkavanag@xxxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Monday, February 17, 2003 1:53 PM
Subject: RE: [amibroker] Need help with code/logic
> Try this and see if it works
>
> BC = VBArray( AFL ("BC" ) ).toArray();
> BD = new Array();
>
> //first element
> j=0;
> BD[j] = BC[0];
>
> for (var i=1;i<BD.length;i++)
> {
> if(BC[i]>BC[i-1])
> {
> BD[j]=BC[i];
> j++
> }
> else
> {
> BD[j] = BD[i-1];
> j++
> }
> }
> delta = BC.length - j -1;
>
> AFL.Var("delta") = delta;
> AFL.Var("bot") = BD;
> %>
> Bot = ref(bot,-delta);
>
>
> Cheers,
> Graham
>
>
> -----Original Message-----
> From: Bruce H [mailto:bwh@xxxxxxxxxxxx]
> Sent: Monday, 17 February 2003 1:41 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Need help with code/logic
>
> Hi all..
>
> I'm trying to write a routine/function that will do the following on an
> array passed to it..
>
> When the array is going down (ie Arr[i] < Arr[i-1]) then array remains
> at
> the last point that Arr[i] >= Array[i-1]
>
> But when the trend changes, and Arr[i]>Arr[i-1] then reset the stop loss
> back to Arr[i-1]
>
> I've tried this code fragment, but it doesn't work as expected..
>
> EnableScript ( "JScript" );
> <%
> BC = VBArray( AFL ("BC" ) ).toArray();
> BD = new Array();
> BD = BC;
> for (var i=0;i<BD.length;i++)
> {
> if(BC[i]>BC[i-1])
> BD[i]=BC[i];
> else
> BD[i] = BD[i-1];
> }
> }
> AFL.Var("bot") = BD;
> %>
>
> Plot(Bot,"Bot - Sell if below",colorRed,styleLine);
>
> Can anyone help..
>
> Bruce
> Perth, Australia
>
>
>
> 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/
>
>
>
>
> 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/
>
>
>
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/
|