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

[amibroker] Re: Heads up with XP SP-2 and Metastock Downloader



PureBytes Links

Trading Reference Links

Herman, the only point I made ... was the lesson I learned ....

That IsEmpty()  works fine with Uninitialized STATIC variables, but it does
not work with "normal" variables that are uninitialized.

Ara

----- Original Message ----- 
From: "Herman van den Bergen" <psytek@xxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Tuesday, August 10, 2004 2:14 AM
Subject: RE: [amibroker] Variables not initialized


> I don't understand...if you want a=1 initialized once only, at AB startup,
> then you should use a Static variable for "a", other variables have no
> memory of past executions so they are initialized at each pass; there is
no
> way around that.
>
> herman
>   -----Original Message-----
>   From: Ara Kaloustian [mailto:ara1@xxxxxxxxxx]
>   Sent: Monday, August 09, 2004 11:01 PM
>   To: amibroker@xxxxxxxxxxxxxxx
>   Subject: Re: [amibroker] Variables not initialized
>
>
>   Herman
>
>   Thanks...
>
>   I went thru your code ... bottom line ... it provides a solution for me
> ...
>   but here are some observations.
>
>   IsEmpty()  works OK with uninitialized STATIC variables, but not with
>   regular AFL variables.
>
>   Ara
>
>
>
>   //This line works OK
>
>   if( IsEmpty(StaticVarGet("IsInitialized7")))
>
>   {
>
>   a=1;
>
>   }
>
>   //This Line generates error "variable NOT initialized"
>
>   if( IsEmpty(IsInitialized3))
>
>   {
>
>   b=1;
>
>   }
>
>   ----- Original Message -----
>   From: "Herman van den Bergen" <psytek@xxxxxxxx>
>   To: <amibroker@xxxxxxxxxxxxxxx>
>   Sent: Monday, August 09, 2004 7:09 PM
>   Subject: RE: [amibroker] Variables not initialized
>
>
>   > Ara, if i understand you correctly then you need to use
StaticVariables.
>   >
>   > I use one called "IsInitialized", like below. Here i initialize
>   > Staticvariables only once at the AB startup or first run of the code.
>   > Instead of Static variables you can initialize standard afl variables
>   > between the curly brackets. Just remember to keep the last one that
sets
>   > IsInitialized to one.
>   >
>   > take care,
>   > herman
>   > GlobalReset = Param("GlobalReset",0,0,1,1);
>   > if( IsEmpty(StaticVarGet("IsInitialized")) OR GlobalReset )
>   >     {
>   >     StaticVarSetText("TickString","");
>   >     StaticVarSet("LastTickPrice",LastValue(C));
>   >     StaticVarSet("LastBarNum",BarCount);
>   >     StaticVarSet("DownTicks",0);
>   >     StaticVarSet("UpTicks", 0);
>   >     StaticVarSet("SecondTimer", GetSecondNum());
>   >     StaticVarSet("NumTicks",0);
>   >     StaticVarSet("IsInitialized",1);
>   >     }
>   >
>   >
>
>
>
> --------------------------------------------------------------------------
>   --
>   > ----
>   >
>   >   -----Original Message-----
>   >   From: Ara Kaloustian [mailto:ara1@xxxxxxxxxx]
>   >   Sent: Monday, August 09, 2004 9:37 PM
>   >   To: amibroker@xxxxxxxxxxxxxxx
>   >   Subject: Re: [amibroker] Variables not initialized
>   >
>   >
>   >   Herman,
>   >
>   >   I also initialize my variable to 0 ..... but I don't want to do it
the
>   >   "normal" way ...
>   >
>   >   if  I initialize to Null, (or anthing else) then AB will initialize
to
>   > Null
>   >   for every time the code executes.
>   >
>   >   Last_BuyState = Null;
>   >
>   >   IsNull(Last_BuyState) ...  the result will always be True.
>   >
>   >   I am trying to have a scheme where I set variables only once when AB
> is
>   >   first turned on
>   >
>   >   if (IsNull(Last_BuyState)
>   >   {
>   >   //initialize variable
>   >   Last_BuyState = Null;
>   >   }
>   >
>   >   ... else no action
>   >
>   >   Any way of working that?
>   >
>   >   Ara
>   >
>   >
>   >   ----- Original Message -----
>   >   From: "Herman van den Bergen" <psytek@xxxxxxxx>
>   >   To: <amibroker@xxxxxxxxxxxxxxx>
>   >   Sent: Monday, August 09, 2004 6:02 PM
>   >   Subject: RE: [amibroker] Variables not initialized
>   >
>   >
>   >   > Before using any variable you can initialize it to NULL, you can
do
>   this
>   >   as
>   >   > the top of your code for all variables that need separate
>   > initialization.
>   >   > then later you can check and know the variable is not initialized
> when
>   > its
>   >   > value is NULL. I always initialize all my variables to either zero
> or
>   >   NULL.
>   >   > Null is nice for signals that will be plotted, as NULL doesn't
plot.
>   You
>   >   can
>   >   > check for NULL in various ways:
>   >   >
>   >   > You have to remember that arrays can be partly initialized... to
see
>   if
>   > an
>   >   > array contains any NULLs you can use:  Cum(Array == NULL) > 0
>   >   >
>   >   > best regards,
>   >   > herman
>   >   >
>   >   >
>   >   >
>   >   >
>   >   >  -----Original Message-----
>   >   > From: Ara Kaloustian [mailto:ara1@xxxxxxxxxx]
>   >   > Sent: Monday, August 09, 2004 8:48 PM
>   >   > To: AB-Main
>   >   > Subject: [amibroker] Variables not initialized
>   >   >
>   >   >
>   >   >   When I use the line below I get an error that "Variable ... is
not
>   >   > initialized" ... which is correct
>   >   >
>   >   >   Null_Test =
>   >
>   >
>   >   >
>   >   >   Looking for a way to do same test for uninitialized variables,
> such
>   as
>   >   >
>   >   >   Init_Test = IsNotInit(Last_BuyState));
>   >   >
>   >   >   "IsNotInit" function does not exist ... is there a workaround
for
>   > this?
>   >   >
>   >   >
>   >   >
>   >   >   Would like to be able to do this:
>   >   >
>   >   >   if (IsNotInit(Last_BuyState))  {Last_BuyState = Null; }  // or
any
>   > other
>   >   > value
>   >   >
>   >   >   This will allow me to initialize variables when first starting
>   program
>   >   > without having to make an assignments that repeats every cycle
thru
>   the
>   >   code
>   >   >
>   >   >
>   >   >
>   >   >   Thanks
>   >   >
>   >   >
>   >   >
>   >   >   Ara
>   >   >
>   >   >
>   >   >
>   >   >
>   >   >
>   >   >
>   >   >   [Non-text portions of this message have been removed]
>   >   >
>   >   >
>   >   >
>   >   >   Check AmiBroker web page at:
>   >   >   http://www.amibroker.com/
>   >   >
>   >   >   Check group FAQ at:
>   >   > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>   >   >
>   >   >
>   >   >         Yahoo! Groups Sponsor
>   >   >               ADVERTISEMENT
>   >   >
>   >   >
>   >   >
>   >   >
>   >   >
>   >
>   >
>   >
>
>
>
> --------------------------------------------------------------------------
>   >   --
>   >   > --
>   >   >   Yahoo! Groups Links
>   >   >
>   >   >     a.. To visit your group on the web, go to:
>   >   >     http://groups.yahoo.com/group/amibroker/
>   >   >
>   >   >     b.. To unsubscribe from this group, send an email to:
>   >   >     amibroker-unsubscribe@xxxxxxxxxxxxxxx
>   >   >
>   >   >     c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms
of
>   >   Service.
>   >   >
>   >   >
>   >   >
>   >   > [Non-text portions of this message have been removed]
>   >   >
>   >   >
>   >   >
>   >   >
>   >   > Check AmiBroker web page at:
>   >   > http://www.amibroker.com/
>   >   >
>   >   > Check group FAQ at:
>   >   http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>   >   > Yahoo! Groups Links
>   >   >
>   >   >
>   >   >
>   >   >
>   >   >
>   >   >
>   >
>   >
>   >
>   >
>   >   Check AmiBroker web page at:
>   >   http://www.amibroker.com/
>   >
>   >   Check group FAQ at:
>   > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>   >
>   >
>   >         Yahoo! Groups Sponsor
>   >               ADVERTISEMENT
>   >
>   >
>   >
>   >
>   >
>
>
>
> --------------------------------------------------------------------------
>   --
>   > --
>   >   Yahoo! Groups Links
>   >
>   >     a.. To visit your group on the web, go to:
>   >     http://groups.yahoo.com/group/amibroker/
>   >
>   >     b.. To unsubscribe from this group, send an email to:
>   >     amibroker-unsubscribe@xxxxxxxxxxxxxxx
>   >
>   >     c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>   Service.
>   >
>   >
>   >
>   > [Non-text portions of this message have been removed]
>   >
>   >
>   >
>   >
>   > Check AmiBroker web page at:
>   > http://www.amibroker.com/
>   >
>   > Check group FAQ at:
>   http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>   > Yahoo! Groups Links
>   >
>   >
>   >
>   >
>   >
>
>
>
>
>   Check AmiBroker web page at:
>   http://www.amibroker.com/
>
>   Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>
>
>         Yahoo! Groups Sponsor
>               ADVERTISEMENT
>
>
>
>
>
> --------------------------------------------------------------------------
--
> --
>   Yahoo! Groups Links
>
>     a.. To visit your group on the web, go to:
>     http://groups.yahoo.com/group/amibroker/
>
>     b.. To unsubscribe from this group, send an email to:
>     amibroker-unsubscribe@xxxxxxxxxxxxxxx
>
>     c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
>
> Check AmiBroker web page at:
> http://www.amibroker.com/
>
> Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> Yahoo! Groups Links
>
>
>
>
>




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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/