Number of Crossover in a certain period
Author: tradercn
Creation Date: 8/25/2011 1:05 PM
profile picture

tradercn

#1
Hi Eugene,

I want to make a function which is measures the number of Cross up or down of any two dataseries in a certain period. For example, in the last 30 bars, SMA(5) crossed up SMA(30) three times. This function NumberOfCO(SMA(5), SMA(30), 30, up) returns 3. The other scenario could be counting the number of MACDEX crossed over MACD signal twice in the last 7 days. This function NumberOfCO(MACDEX(12,26,9), MACDSignal(12,26,9), 7, up) returns 2. Or, MACD cross up zero twice in the last 7 days. This function NumberOfCO(MACD(12, 26, 9), 0, 7, up) returns 2.
I worked on this function, but it is not great so far. Do you have any example for this kind of function?
Many thanks?
profile picture

Eugene

#2
profile picture

tradercn

#3
Thanks so much. Your help's never been late. :)
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).