I'm want to develop a simple strategy to help me understand NinjaTrader better. In this strategy I want to do the following check:
1. The trend for a stock goes up for the past 150 days, if not, do nothing;
2. If the curve of Moving Average 20 goes across the curve of Moving Average 50, indicate this event.
My questions are:
1. Is there a practical algorithm to find the going-up trend for a stock? I did something by myself, but I don't feel it is a very good way. In my way, I checked Close[150] and Close[0], if Close[150] < Close[0], then this interval is a candidate for the going-up trend; then I checked for individual days in this interval, if the close price keeps going down for consecutive 15 days, I don't think this 150 days interval has a going-up trend.
Please give me some hint or suggestions. I'm new to the stock business, so please be specific.
2. How can I find the cross point between the MA20 and MA50 curve? Which function should I use for the existing library?
Thank you very much for your time.

Comment