LastValue | Trading system toolbox |
SYNTAX | LastValue(ARRAY, lastmode = True ) |
RETURNS | NUMBER |
On 2/24/2016 8:09 PM, 'TA' tagroups@sbcglobal.net [amibroker] wrote:
Alan,
What you are doing is equivalent to using lastvalue(close). Converting to string and converting back number more costly.
From: amibroker@yahoogroups.com [mailto:amibroker@yahoogroups.com]
Sent: Wednesday, February 24, 2016 5:52 PM
To: amibroker@yahoogroups.com
Subject: Re: [amibroker] How to get a number from an array
The horizontal line is a number not an array. StrToNum returns a Number.
On 2/24/2016 7:40 PM, 'TA' tagroups@sbcglobal.net [amibroker] wrote:
I had already done that. I get a horizontal line at the last value of close.
As far as I know in AB there are now arrays of strings.
From: amibroker@yahoogroups.c om [mailto:amibroker@yahoogroups.com]
Sent: Wednesday, February 24, 2016 5:36 PM
To: amibroker@yahoogroups.com
Subject: Re: [amibroker] How to get a number from an array
Try this and see what you get: Plot(StrToNum(NumToStr(close)),"",colorblack);
StrToNum
- convert string to numberString manipulation
(AFL 2.5)
SYNTAX
StrToNum( string )
RETURNS
NUMBER
FUNCTION
Converts string to number.
On 2/24/2016 1:45 PM, 'TA' tagroups@sbcglobal.net [amibroker] wrote:
Alan, I think your wrong.
EntryBar is an array.
NumToStr(EntryBar) converts the last value of the array to a string.
StrToNum(NumToStr(EntryBar)) recreates an array of last value of EntryBar array.
From: amibroker@yahoogroups.com [mailto:amibroker@yahoogroups.com]
Sent: Wednesday, February 24, 2016 11:29 AM
To: amibroker@yahoogroups.com
Subject: Re: [amibroker] How to get a number from an array
This is one way to change an array to a number:
Bar = StrToN um(NumToStr(EntryBar));
On 2/22/2016 11:50 AM, gamacc@aruba.it [amibroker] wrote:
Hello there,
in order to obtain the highest peak value of the bars after the entry bar I've written this code:
Buy = IIf(<entry condition>,True, 0);
EntryBar = IIf(<entry condition>,BarIndex(),0);
for( i = EntryBar; i < BarCount; i++ )
{
PeakValue = HHV(H,(Bar - i);
....
}
This code doesn't work; the AFL reports the error nr. 6 : "Condition in IF, WHILE, FOR statement must numeric or boolean type; you cannot use array here...".
How can I change the variable EntryBar from an array into a number? I've tried "Bar = EntryBar" but it's the sa me thing.
Thanks to anyone have an answer.
Regards
Posted by: Alan <alan@thenorthams.us>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (9) |
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
EmoticonEmoticon