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

[amibroker] Re: Is there a way to pass value from an array as input to a function that uses



PureBytes Links

Trading Reference Links

No, myvalue is an array returning a value at each bar. If you want
only the most-recent value, use:

myvalue = LastValue(ValueWhen(rulepass, High, 1));

Regards,
GP


--- In amibroker@xxxxxxxxxxxxxxx, "Padhu" <ccie8340@xxx> wrote:
>
> Hi GP:
> 
> Thanks for the reply.
> 
> But if I have
> myvalue=valuewhen(rulepass,High,1);  
> 
> Is that not picking only 1 value(most recent one)  when that
condition had passed.
> 
> Thanks,Padhu
> 
>   ----- Original Message ----- 
>   From: gp_sydney 
>   To: amibroker@xxxxxxxxxxxxxxx 
>   Sent: Monday, November 19, 2007 11:49 PM
>   Subject: [amibroker] Re: Is there a way to pass value from an
array as input to a function that uses
> 
> 
>   > since valuewhen returns only a SINGLE value from the array
> 
>   No, ValueWhen returns a whole array. If you only want the most-recent
>   value, use the LastValue function. Otherwise you need to decide which
>   value (ie. from which bar) you want to pass to the function, which
>   will depend on what the function is doing.
> 
>   Regards,
>   GP
> 
>   --- In amibroker@xxxxxxxxxxxxxxx, "Padhu" <ccie8340@> wrote:
>   >
>   > folks:
>   > 
>   > my programming knowledge is very limited. I am having a hard time
>   with this problem. Hope someone can explain this to help me understand
>   this.
>   > 
>   > I am trying to use a function which uses for loops. The input to the
>   function is a value derived from an array.
>   > 
>   > Say myvalue=valuewhen(rulepass,High,1);
>   > 
>   > But the for loop does not allow array values to be used in it. Is
>   there a way I can pass the array value(just a single number) to the
>   function input. I tried valuewhen and it doesn't like that as well.
>   > 
>   > Been reading the http://amibroker.com/guide/a_mistakes.html , but
>   not sure if I can convert an array value to numeric.
>   > 
>   > for example:
>   > 
>   > input=10;
>   > result=function(input); //this works
>   > 
>   > whereas
>   > 
>   > myvalue=valuewhen(rulepass,High,1);
>   > input=myvalue;
>   > result=function(input); //this DOES NOT work eventhough output in
>   interpretation window shows myvalue=10
>   > 
>   > when the result of myvalue is numeric 10, why is that for loop
>   detects it as an array.(since valuewhen returns only a SINGLE value
>   from the array).
>   > 
>   > Any suggestions?.
>   > 
>   > Thanks,Padhu
>   >
>




Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/