You already have the prices defined, not sure what you are wanting. We
need more description.

I am making an educated guess that you want the price to be %
different to the value of Close on the signal bar, ie previous bar to
actual trade
buyprice = ref(c,-1)*1.01;

Now if the next bar after the signal does not actually have this price
in its range then you need to add conditions to your signals and maybe
more options to the price definition. This now comes to how you
actually trade, how you enter orders to your broker and how these are
actually carried out. There are many different methods depending on
the market you trade, your broker and how orders are done etc.

As an example when you get a signal you send a conditional order to
your broker to enter buy next day at 1.01*Close
Now does this get carried out if the prices traded the next day are
above the order price, or only if there is trade at that price, or
other?
If the trade is only acted if the next bar range covers the price then
you need to add condition (for backtesting) that the next bar range is
around the order price. eg
buy = Other Conditions and ref( L<=buyprice and h>=buyprice, 1);

If your order gets done if the next bar price just has to trade higher then
buy = Other Conditions and ref( h>=buyprice, 1);
buyprice = max(open,ref(c,-1)*1.01);

This is only one single simple possibility
Do not worry that in your backtest the afl is looking to the future,
because your actual trades taken should reflect real life situation.

Maybe I am adding more than you are asking, or have missed the point.
Can only answer based on level of detail provided.

-- 
Cheers
Graham Kav
AFL Writing Service
http://www.aflwriting.com


2008/7/2 Louis Préfontaine <[EMAIL PROTECTED]>:
> 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 <[EMAIL PROTECTED]>:
>>
>> 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 <[EMAIL PROTECTED]>:
>>
>> > 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