http://www.amibroker.com/guide/afl/applystop.html (plus comments)
  ----- Original Message ----- 
  From: gariki 
  To: [email protected] 
  Sent: May 11, 2010 11:30 AM
  Subject: [amibroker] Re: BarsSince(Buy) >= 300 NOT resulting in a Boolean?




  Trying again..

  How do i get the exits generated by ApplyStop to be reflected into the 
Sell/Short arrays so that i can print the exits on the chart?


  thanks
  -gariki

  --- In [email protected], "gariki" <chetan.abm...@...> wrote:
  >
  > I see; the problem was BarsSince was returning an array; not a scalar as
  > i thought.
  > 
  > Ok, let me put another question out:
  > 
  > I am using a 300 bar time stop using the following two lines at the top
  > of my program:
  > nBarStopValue = 300;
  > ApplyStop( stopTypeNBar, stopModeBars, nBarStopValue );
  > In a for loop i am then defining my Buy,Sell,Short,Cover rules. And
  > finally i am plotting arrows onto the graphs using
  > PlotShapes(Buy * shapeUpArrow + Sell * shapeDownArrow , IIf( Buy,
  > colorGreen, colorRed), 0, IIf(Buy, Low, High) );
  > PlotShapes( Short*shapeHollowDownArrow + Cover*shapeHollowUpArrow,
  > IIf(Short, colorRed, colorGreen), 0, IIf(Short, High+6, Low-6 ) );
  > Since the time based stops are not part of the regular Buy/Sell rules,
  > they are not being printed out on the chart when i am printing those
  > arrays. So i tried changing the Sell/Cover arrays using
  > 
  > Sell = Sell OR ( BarsSince(Buy) == 300) ;
  > But this doesnt seem to be getting those signals in; my time based exits
  > are still not being printed.
  > 
  > 
  > ps:
  > a. The backtester is picking up the stops as i expect them to; just that
  > i am not able to plot them onto the chart.
  > b. since the array version is not working; i tried to use a simple
  > counter variable named myBarsSinceBuy and tried to count the bars myself
  > after i got an entry signal; but in the couple of hours i had to play
  > with it i couldnt get it to work yet; but thats another story.
  > 
  > 
  > thanks again!
  > -gariki
  > 
  > --- In [email protected], Tomasz Janeczko groups@ wrote:
  > >
  > > Hello,
  > >
  > > Please read the manual :
  > > http://www.amibroker.com/guide/a_mistakes.html
  > >
  > >
  > > Best regards,
  > > Tomasz Janeczko
  > > amibroker.com
  > >
  > > On 2010-05-09 10:20, gariki wrote:
  > > >
  > > >
  > > > I am trying to put in this line of code
  > > >
  > > > if( LongEntryPrice > 0 AND (BarsSince(Buy) >= 300 ) )
  > > >
  > > >
  > > > and its giving me a compile time error saying:
  > > > Error .
  > > > Condition in IF, WHILE, FOR statements has to be a Numeric or
  > Boolean
  > > > type.. for the BarsSince function.
  > > >
  > > > BarsSince(Buy) should return a numeric value and comparing it with a
  > > > number should return a boolean value.
  > > >
  > > > Does anyone know why it is showing up as error?
  > > >
  > > > Thanks
  > > > -gariki
  > > >
  > > >
  > > >
  > > >
  > > >
  > > >
  > > >
  > > >
  > > >
  > > >
  > > >
  > >
  >



  

Reply via email to