Exploration to find stocks

Dear all,

I would like to make an exploration to find all stocks for the following conditions.

Condition 1: 20 MA above 60 MA for at least 45 bars (around 2 months).

Condition 2: 10 MA Cross 20 MA.

Do anyone help me to correct it?

_SECTION_BEGIN("U_Exploration for mid buy");

MA10=MA(C,10);

MA20=MA(C,20);

MA60=MA(C,60);

up= ROC(MA(C,20)>MA(C,60))>45 // 45 days = 2 months

And

CROSS(MA(C,10),MA(C,20));

Filter= up;

AddColumn(C,"Close");

_SECTION_BEGIN("U_Exploration for mid buy");
MA10=MA(C,10);
MA20=MA(C,20);
MA60=MA(C,60);

bars = BarsSince(Cross(MA20, MA60));

up = bars > 45 // 45 days = 2 months
		AND MA20>MA60
		AND	CROSS(MA10, MA20);

Filter= up;

AddColumn(C,"Close");
AddColumn(bars,"Bars", 1);
_SECTION_END();

You have to post code within code tags.
You have been member of forum for long time already.
So you should know that.
Please don't be lazy.

1 Like

Dear fxshrat,
Thank you for your useful help.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.