The project is to create in VBA an Excel user defined function returning the Demark TD Sequential stage.
TD Sequential is defined as explained below (given a price series, already loaded):
A. Set Up Criteria
1. For a Buy signal. Nine consecutive daily price closes which are lower than the close four days earlier.
For a Sell signal. Nine consecutive daily price closes which are higher than the closes four days earlier.
2. An Absolute Prerequisite
The day prior to the first day of a nine consecutive set up sequence must:
for a buy signal have a close higher than or equal to the close four days earlier,
for a sell signal have a close lower than or equal to the close four days earlier.
B. Count Down
For a buy signal, following the successful completion of the count down we wait for thirteen closes which are lower than the close two days earlier (not consecutive, in fact extremely unlikely to be so).
For a sell signal, after successful set up, wait for thirteen closes which are higher than the close two days earlier.
\the user defined excel function would be
i) either the stage in the set up ("SETUP-x"
ii) the stage in the countdown (Cf. BUYCOUNTDOWN-x (Cf. 1, 2,....13)
Cf. file attached for details.
P.S: the time series will only be 'closing prices' so all discussions about high / low / close should be ignored
What I need is the VBA code to create a user defined excel function
The structure of the function will be
TDSequential(initial cell chosen, "H" or "V" if the function works horizontally or vertically)
The output would be
i) Setup "x"
ii) BUY-x or SELL-x
(see description of TD Sequential).