Thanks Cdkeylstra for your reply

The problem I was having was because I was not defining the BuyPrice.
I found this code on the web in Back Testing Your Trading Ideas which solved 
the problem.

Buy = buyformula;
priceatbuy = 0;

  for ( i = 0; i < BarCount; i++)
   (
     if ( priceatbuy == 0 && Buy[i]
       priceatbuy = BuyPrice[i];
   }


--- In [email protected], "cdkylstra" <cdkyls...@...> wrote:
>
> Hi Austin,
> 
> Don't know if you will ever see this, or have already figured out the 
> solution.
> 
> It is a simple IF test, that you already expressed.
> 
> if( TrailingStop > BuyPrice )  Stop = TrailingStop;  
> else Stop = InitialStop;
> 
>  
> 
> --- In [email protected], "austin.lawrence24" <austin.lawrence24@> 
> wrote:
> >
> > --- In [email protected], "austin.lawrence24" <austin.lawrence24@> 
> > wrote:
> > >
> > > I need help with formula for the following task and will be grateful for 
> > > any guidance.
> > > 
> > > Buy = "buy formula"
> > > Buyprice = open
> > > initial stop = Buyprice - LLV(L,period)
> > > trailing stop = "trailing stop formula"
> > > trailing stop becomes effective when it's value is > Buyprice
> > > 
> > > Thanks to anyone who can help.
> > >
> > In view of the fact no one has responded to my request for help I can only 
> > assume my query was too difficult or too stupid to warrant a response.  I 
> > am new to AmiBroker and Computer programming at this level so I would be 
> > really grateful if anyone could suggest where a novice like myself can get 
> > help with programming issues.  Most problems I have had I have been able to 
> > solve by refering to articles on the website but sometimes the answers are 
> > not that easy to find.
> >
>


Reply via email to