Re: [amibroker] How to inizialize a variable only once

 

This code will solve the error you have, although I still do not understand what you are doing:

if (Nz( StaticVarGet("InitializationDone") == 0))
{
   StaticVarSet("InitializationDone", 1);
    LMin = 999999;
}
else
{
   LMin = 0;
}


LMin = IIf(L < Ref(L,-1),L,LMin);
Here LMin is an ARRAY.

LMin = 999999;
Is this a number or ARRAY?


Don;t you need to use the LLV() function?


On Sat, Apr 16, 2016 at 10:11 PM, gamacc@aruba.it [amibroker] <amibroker@yahoogroups.com> wrote:
 

Thank You Tomasz.

Lmin = 0; was the first solution I've tried but the variable was reinitialized every time.
This is my goal: I would detect the lowest value of the bars between a Short and a Cover (and viceversa for long trades):

LMin = IIf(L < Ref(L,-1),L,LMin);

When the expression is True LMin is equal to L but when AFL analyses the subsequent bar and the expression is false LMin is already returned to 0 (initial value).
How can I detect the lowest or the highest value between entry and exit from the market?

Thanks a lot for your patience.

Gabriele

__._,_.___

Posted by: "B. Pitatzidis" <bobptz@gmail.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)
**** IMPORTANT PLEASE READ ****
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/


.

__,_._,___

Related Posts


EmoticonEmoticon

:)
:(
=(
^_^
:D
=D
=)D
|o|
@@,
;)
:-bd
:-d
:p
:ng
:lv