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

Re: [amibroker] Re: Changing histogram bar color



PureBytes Links

Trading Reference Links

Some caution / suggestions... that I got from Tomasz in solving problems

When using logic for controlling program action be careful when using if()
statements.

I had a situation where both sections of the if ... else ... structure were
being executed ... because I had print statement printing to the
interpretation window ... which cause AB to execute a second pass and foul
up my control logic.

Closing the interpretation window or enclosing the code in an if
(status("action")==1) condition will eliminate the second pass by AB and
compute only during processing the indicator code.

These structures will allow global variables and be very useful in various
applications.

My immediate application is to reduce the CPU workload from computing
SUpport / Resistance lines continuously to only once....

This can be quite meaningful in real time ...

Ara




----- Original Message ----- 
From: "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, July 10, 2004 2:46 AM
Subject: [amibroker] Re: Global Parameter??


> Ned, Ara,
> We can use now the new StaticVarSet() function.
> As we read in the 4.58 ReadMe
> ** Static variable - the variable has static duration (it is
> allocated when the program begins and deallocated when the program
> ends)
> and initializes it to Null unless another value is specified. Static
> variables allow to share values between various formulas.
> Only NUMBER and STRING static variables are supported now (not
> ARRAYS).**
> We may also use Param() in a "master" code
>
> //Master
> StaticVarSet("per",Param("per",10,10,50,10));
> Plot(MA(C,StaticVarGet("per")),"st",1,1);
>
> and use it in any "slave" IB window
>
> //Slave1
> Plot(MA(C,StaticVarGet("per")),"st",1,1);
>
> or
>
> //Slave2
> Plot(EMA(C,StaticVarGet("per")),"st",1,1);
>
> Dimitris Tsokakis
> --- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx>
> wrote:
> > Ara,
> > This would not give a "global" action [in the sense Ned probably
> > wants].
> > Suppose you save in your Ti3 folder the
> > A=Param("A",10,10,50,10);
> > Y=LinRegSlope(C,A);
> > as LINREG.afl.
> > Now paste in 2 empty IB windows the same
> >
> >  #include "C:\Ti3\LINREG.afl";
> > Plot(Y,"Y",1,1);
> >
> > If you set A=40 in the first graph, it does not affect the 2nd.
> > You should set A value in every single indicator.
> > As far as I understand, Ned would like to set A once and see this
> > setting in ANY indicator using A.
> > I do not see how this could be done.
> > Dimitris Tsokakis
> > --- In amibroker@xxxxxxxxxxxxxxx, "Ara Kaloustian" <ara1@xxxx>
> wrote:
> > > Try using the parameter code in a separate file and bring that
> file
> > in each
> > > indicator as an #include file.
> > >
> > > ----- Original Message ----- 
> > > From: "recce101" <ned@xxxx>
> > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > Sent: Wednesday, June 30, 2004 10:20 PM
> > > Subject: [amibroker] Global Parameter??
> > >
> > >
> > > > I have a considerable number of right-click user-defined
> > parameters
> > > > in my custom indicators, and frequently two or three indicators
> > > > displayed together have similar parameters which need to be
> > adjusted
> > > > at the same time. For example,
> > > >
> > > > LinearRegressionPeriod=Param("LR period",10,5,40,1);
> > > >
> > > > might be used for custom indicators in three separate AFL files.
> > > > Currently I must right-click each indicator separately and
> adjust
> > its
> > > > linear regression parameter to the value desired. I'm looking
> for
> > a
> > > > way to define a "global" parameter which would be recognized by
> > all
> > > > three indicators, so one right-click adjustment would suffice
> for
> > all
> > > > three. This would be similar to how the setting in a Preferences
> > > > window affects all indicators linked to that setting, except
> that
> > > > these would be user-defined parameters not found in the set of
> > built-
> > > > in Preferences. My search through the help files
> using "parameter"
> > > > and "global" did not answer my question, though I must confess
> > that I
> > > > did not fully understand a good portion of what I read.
> > > >
> > > > There must be a way to do this, and it's probably very simple,
> so
> > I
> > > > would appreciate being pointed in the right direction.
> > > >
> > > > Ned
> > > >
> > > >
> > > >
> > > >
> > > > 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 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/