PureBytes Links
Trading Reference Links
|
Hello,
If prev is part of the condition and in any other case you can use loop:
setup = 0;
for( i = 1; i < BarCount; i++ )
{
setup[ i ] = IIF ( C[ i ] > setup[ i - 1 ], C[ i ], setup[ i - 1 ] );
}
But actually if you think it over this statement
If(C > PREV, C,PREV);
in fact just gives HIGHEST value.
And it can be replaced by BUILT-IN function highest:
setup = Highest( C );
This is another example when one second of thinking gives not only
more readable but also quicker solution than PREV thingy.
Thinking does not hurt.
Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "jswe2000" <jswe2000@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Tuesday, August 02, 2005 11:26 PM
Subject: [amibroker] Re: Metastock PREV
> Hello Dave
>
> I have the same problem.
>
> Could you show the AFL code that you change from "setup:=If(C > PREV,
> C,PREV);" in MS code?
>
> For me,the "Valuewhen" can use only when the "Prev" is NOT in the
> condition but if the "Prev" is in the condition, the "Valuewhen" can't
> be used to replace the "Prev" .I think that loop wil help but I can't
> code it.
>
> Tomasz ,could you help us?
>
> Best Regards
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx>
> wrote:
>> Hello,
>>
>> Initial delay when posting is caused by the fact that new members'
> posts
>> are moderated. This is needed because every day we have at least 5
> spammers
>> joining and trying to spam the list. This procedure allows to keep
> list spam-free.
>>
>> Best regards,
>> Tomasz Janeczko
>> amibroker.com
>> ----- Original Message -----
>> From: "dpweir" <dpweir@xxxx>
>> To: <amibroker@xxxxxxxxxxxxxxx>
>> Sent: Tuesday, August 02, 2005 3:29 PM
>> Subject: RE: [amibroker] Metastock PREV
>>
>>
>> > Thanks Tomasz
>> >
>> > Yes, it was only an example, so was very simple. Wow, I sent that
> email 24
>> > hours ago, and it only just appeared back in my inbox ?
>> >
>> > In the last 24 hours I have been able to convert all my metatsock
> formulas
>> > (thanks to finding some excellent posts in the archives through
> google ...
>> > had trouble with searching for PREV using
>> > http://www.purebytes.com/cgi-local/swish/swish-cgi.pl
>> >
>> > Anyhow this being so easy to convert, once you grasp the basic
> structure (I
>> > am not a programmer), certainly does credit to Amibroker ...
> excellent
>> > program.
>> >
>> > Best regards
>> >
>> > Dave
>> >
>> > -----Original Message-----
>> > From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]
> On Behalf
>> > Of Tomasz Janeczko
>> > Sent: Tuesday, 2 August 2005 10:33 PM
>> > To: amibroker@xxxxxxxxxxxxxxx
>> > Subject: Re: [amibroker] Metastock PREV
>> >
>> > Hello,
>> >
>> > This one is an example how presence of PREV thingy makes people to
> write
>> > inefficient codes (PREV is extremely slow).
>> >
>> > Statement like this even in Metastock could be written without
> PREV.
>> >
>> > MS:
>> > setup = if( condition, variable, PREV )
>> >
>> > can be written even if Metastock as
>> >
>> > setup = ValueWhen( 1, condition, variable );
>> >
>> > which executes way faster.
>> >
>> > AmiBroker's syntax for it is:
>> >
>> > setup = ValueWhen( condition, variable );
>> >
>> >
>> > Best regards,
>> > Tomasz Janeczko
>> > amibroker.com
>> > ----- Original Message -----
>> > From: "dpweir" <dpweir@xxxx>
>> > To: <amibroker@xxxxxxxxxxxxxxx>
>> > Sent: Monday, August 01, 2005 1:49 PM
>> > Subject: [amibroker] Metastock PREV
>> >
>> >
>> >> Hello
>> >>
>> >> I am sorry if this is often asked question, but I was wondering
> what was
>> > the
>> >> Amibroker equivalent to the metastock PREV statement, as I would
> like to
>> >> convert some basic metastock formulas, as an example
>> >>
>> >> setup:=If(C > PREV,C,PREV);
>> >>
>> >> or better yet descriptively, another example,
>> >>
>> >> setup:=if(condition,variable,PREV);
>> >>
>> >> Thanks in advance
>> >>
>> >> David Weir
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> 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 other support material please check also:
>> >> http://www.amibroker.com/support.html
>> >>
>> >>
>> >> Yahoo! Groups Links
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >
>> >
>> >
>> >
>> > 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 other support material please check also:
>> > http://www.amibroker.com/support.html
>> >
>> >
>> > Yahoo! Groups Links
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > 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 other support material please check also:
>> > http://www.amibroker.com/support.html
>> >
>> >
>> > Yahoo! Groups Links
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>
>
>
>
>
>
>
> 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 other support material please check also:
> http://www.amibroker.com/support.html
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
<font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12hqblk1n/M=362343.6886682.7839641.1493532/D=groups/S=1705632198:TM/Y=YAHOO/EXP=1123075512/A=2894352/R=0/SIG=11fdoufgv/*http://www.globalgiving.com/cb/cidi/tsun.html">Help tsunami villages rebuild at GlobalGiving. The real work starts now</a>.</font>
--------------------------------------------------------------------~->
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 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/
<*> 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/
|