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

RE: [amibroker] Backtester buy and buyprice



PureBytes Links

Trading Reference Links

Hello Alex,

 

i have modified your code but haven?t tested it.  I have also modified the
buyprice to get the correct price in case of a gap.

 

Longsetup = {setup code here};
StopBuy = 1.005 * valuewhen(LongSetup,H); 
Buy = barssince(Longsetup)<=5 AND H>StopBuy;
BuyPrice = max(open,StopBuy);

 

Thomas

www.patternexplorer.com

 

 

Von: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] Im Auftrag
von dralexchambers
Gesendet: Mittwoch, 31. Jänner 2007 11:02
An: amibroker@xxxxxxxxxxxxxxx
Betreff: [amibroker] Backtester buy and buyprice

 

Hi,

In my backtester code I am trying to achieve the following:

1. Wait for a longsetup condition, then
2. Set a buy order for the next bar: buyprice is the High of setup 
day + (0.5% of the high price)
3. Cancel the buy order if it is not fulfilled in 5 days from setup 
day

The code I have is the following:

Longsetup = {setup code here};
StopBuy = 1.005 * H; 
Buy = Longsetup AND H>StopBuy;
BuyPrice = StopBuy;

But this doesn't seem to work.

Can anyone suggest - thanks.

 


Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.15/659 - Release Date: 1/30/2007 9:31 AM