Alex,

 

I think this covers all your conditions (assuming 'price is above' means the
bar closes above the MA and your chart is daily bars):

 

PDIxUp = Cross(PDI(),MDI());

PDIxDn = Cross(MDI(),PDI());

 

Buy = C > MA(C,10) AND BarsSince(PDIxUP) <= 5 AND BarsSince(PDIxDn) >
BarsSince(PDIxUp);

 

Regards,

 

David

 

  _____  

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of dralexchambers
Sent: 03/11/2007 7:18 PM
To: [email protected]
Subject: [amibroker] Help with a DMI system

 

Hi,

Can anyone help me with the code for this: My Buy signal is when the 
+DI crosses the -DI, and the price crosses the 10day MA.

1. If the price is above the 10d MA on the DMI cross day, this is a 
valid entry today

2. If the price is below the 10d MA on the DMI cross day, I wait up 
to a maximum of 5 days, and:

a) If the price crosses the MA within these 5 days AND the DMI have 
not crossed again (ie. +DI is still above -DI), the entry day is this 
day - ie. the day the price crosses the MA

b) If the DMI cross to the negative within these 5 days, the trade 
is not taken.

Thanks - ALex

 

Reply via email to