That is actually equivalent to:

BuyPrice = IIF( Buy, 1.01, 1 ) * BuyPrice;

Then IIF is not needed as BuyPrice for other points
is not relevant, so one could write
BuyPrice = 1.01 * BuyPrice;

Of course one needs to turn off price checking
SetOption("PriceBoundsChecking", False );


Best regards,
Tomasz Janeczko
amibroker.com
  ----- Original Message ----- 
  From: Howard B 
  To: [email protected] 
  Sent: Wednesday, July 02, 2008 3:16 PM
  Subject: Re: [amibroker] Re: Buyprice and sellprice...


  Hi Louis --

  Perhaps write a simple loop?

  for (i=0; i<BarCount; i++)
  {
    // test to see if there was a Buy on this bar 
    // and if there was, adjust BuyPrice
    if (Buy[i] == 1)
    {
      BuyPrice[i] = 1.01*BuyPrice[i];
    }
  }

  Or am I missing something?

  Thanks,
  Howard

    



  On Tue, Jul 1, 2008 at 9:27 PM, tayamaan <[EMAIL PROTECTED]> wrote:

    Louis, you now assume your slippage to be 1%, which is a guess 
    anyways. It differs per situation what your system considers to be 
    the Buy/Sell Price and what you actually pay or get at the market. 
    These are still two different things. I wouln't know how to calculate 
    the real slippage, all you can do is comparing the difference over a 
    period of time and take some kind of average.

    Adrian 



    --- In [email protected], Graham <[EMAIL PROTECTED]> wrote:
    >
    > turn off the option of PriceBoundChecking in the Analyser settings 
    of in the AFL
    > 
    > SetOption( "PriceBoundChecking", 0 );
    > 
    > -- 
    > Cheers
    > Graham Kav
    > AFL Writing Service
    > http://www.aflwriting.com
    > 
    > 

    > 2008/7/2 Louis Préfontaine <[EMAIL PROTECTED]>:

    > > Hi,
    > >
    > > But is it possible to set the backtester to consider that the 
    buyprice was
    > > let's say 1% higher than the Close on the bar the trade was made?
    > >
    > > That's what I tried to do. If it's complicated, I can live with 
    this (well,
    > > I can at least try, since I believe I am still a beginner in 
    understanding
    > > AFL), but I'd need to know if it is possible, and if yes, what 
    can be a good
    > > start...
    > >
    > > Was I on the right track with
    > >
    > > SetTradeDelays( 1, 1, 1, 1 );
    > > BuyPrice = c*1.01;
    > > SellPrice = c*0.99;
    > >
    > > Cause it does not work at all...
    > >
    > > Thanks again,
    > >
    > > Louis
    > >

    > > 2008/7/1 Graham <[EMAIL PROTECTED]>:

    > >>
    > >> Then you need to set out exactly what you need to do and write 
    the afl to
    > >> match
    > >> It is all logical steps
    > >> I do it by writing down all the restrictions and possibilities 
    and
    > >> what I need at the end and how I think is best way to achieve 
    this
    > >> ......... in detail. There are no short cuts and can be very 
    tedious.
    > >> I also more often than not write out a flow chart to map all
    > >> decisions, inputs, outputs, calculations etc.
    > >>
    > >> --
    > >>
    > >> Cheers
    > >> Graham Kav
    > >> AFL Writing Service
    > >> http://www.aflwriting.com
    > >>

    > >> 2008/7/2 Louis Préfontaine <[EMAIL PROTECTED]>:

    > >> > Hi Adrian,
    > >> >
    > >> > Thanks for your suggestion. But still... How can I do this? I 
    mean: I
    > >> > want to be precise. With the kind of markets I am in and what 
    I am
    > >> > trying
    > >> > to do, precision is very important... I need to be able to set 
    a
    > >> > particular % adjustment for particular situations...
    > >> >
    > >> > Louis
    > >> >

    > >> > 2008/7/1 tayamaan <[EMAIL PROTECTED]>:

    > >> >>
    > >> >> Hi, if you would really like to try to compensate for 
    slippage,
    > >> >> adding this to your commissions as part of your transaction 
    costs is
    > >> >> perhaps an idea.
    > >> >>
    > >> >> Adrian
    > >> >>
    > >> >> > Hi Graham,
    > >> >> >
    > >> >> > How can I put more information so that my buy price is 1% 
    higher
    > >> >> than C and
    > >> >> > sell price 1% lower than C?
    > >> >> >
    > >> >> > Thanks,
    > >> >> >
    > >> >> > Louis
    > >> >> >
    > >> >> > 2008/7/1 Graham <kavemanperth@>:
    > >> >> >
    > >> >> > > Without more information on what you are trying to achieve
    > >> >> > > The price will be for the bar of actual entry C*1.01 or 
    C*0.99
    > >> >> > >
    > >> >> > > Also the prices may be outside than the bar range in 
    which case
    > >> >> the
    > >> >> > > closer of high or low is used if you have the 
    PriceBoundChecking
    > >> >> on
    > >> >> > >
    > >> >> > > --
    > >> >> > > Cheers
    > >> >> > > Graham Kav
    > >> >> > > AFL Writing Service
    > >> >> > > http://www.aflwriting.com
    > >> >> > >
    > >> >> > > 2008/7/1 Louis Préfontaine <rockprog80@ <rockprog80%
    > >> >> 40gmail.com>
    > >> >> > > >:
    > >> >> > >
    > >> >> > > > Hi,
    > >> >> > > >
    > >> >> > > > I have been trying to set a formula for slippage:
    > >> >> > > >
    > >> >> > > > SetTradeDelays( 1, 1, 1, 1 );
    > >> >> > > >
    > >> >> > > > BuyPrice = C*1.01;
    > >> >> > > > SellPrice = C*0.99;
    > >> >> > > >
    > >> >> > > > It doesn't work at all. I tried to write C*50 just for 
    fun, but
    > >> >> it didn't
    > >> >> > > > change the buyprice at all. What can possibly be wrong?
    > >> >> > > >
    > >> >> > > > Thanks,
    > >> >> > > >
    > >> >> > > > Louis
    >



   

Reply via email to