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

[amibroker] Re: cant get to set a simple boolean variable..



PureBytes Links

Trading Reference Links



I wish you are correct; here i am posting a more complete example of a simplified version of the problem i am seeing. Try copy pasting and plot the indicator. When close is less than the MA200 you would expect intrade to be set to 1 and 0 otherwise. But what i get is extremely weird; somewhere along the way intrade seems to have been initialized to 1 and stays at 1 regardless where price (C) is in relation to MA200;

MA200 = MA(C, 200);
intrade =
0;

for(i=1; i<BarCount; i++)
{
      if( C[i] < MA200[i] )
     {
           intrade =
1;
     }
    
else 
  
{
          
intrade = 0;
  
}
}

Plot(Close, "Price", colorBlack, styleCandle);
Plot(MA(C,200), " intrade: " + intrade + " MA(200): " , colorBlue);
GraphXSpace =
5;


--- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@xxx> wrote:
>
> "my condition" is never evaluating to a non zero value.
>
> Mike
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Chaitanya" kcityg@ wrote:
> >
> >
> >
> >
> >
> >
> > New problem:
> >
> > I cant seem to get a simple boolean variable working; here is sniplet of code..
> >
> > intrade = 0; //intrade = false;
> > for(i=1; i < barcount; i++)
> > {
> > if(my condition)
> > {
> > intrade = 1;
> > }
> > etc etc..
> >
> > }
> >
> > The intrade = 1 in the above program seems to be never executing even though the program is traversing into the loop; and the bool always stays false (0); what am i doing wrong?
> >
> >
> >
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "Chaitanya" <kcityg@> wrote:
> > >
> > > never mind; got it using appending strings to any existing study on the chart. like..
> > >
> > > Plot( MA(200), "RSI value " + r + "myBool Value " + boolVar1, colorblue );
> > >
> > >
> > >
> > > --- In amibroker@xxxxxxxxxxxxxxx, "Chaitanya" <kcityg@> wrote:
> > > >
> > > > i have found it useful to write any indicator values or variable values directly on amibroker UI rather than using a separate debug window (for one it makes tracking bar per bar easier) but i forgot how i did that in the past.
> > > >
> > > > Can someone point me to an example..
> > > >
> > > > Example: I have a boolean (true/false) variable and an array variable say BuySignal array. i want to print the values of these two variables as i progress from bar to bar on the chart pane itself.
> > > >
> > > >
> > > > thanks!
> > > > -gariki
> > > >
> > >
> >
>



__._,_.___


**** 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/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___