can some one help me with the screening code.
How do i alter my code if a cross over heppened in last “n” number of days
It is easy to get crossover happened before “n” number of days through the build in option.
i would like to scan the below scenarios:
- MACD Cross over happened in last 5 days
- EMA 125 > EMA 63 in last 5 days
- EMA 10 crosser over EMA20 heppened in last 5 days.
your help is appreciated.
Hi
you may use your variable if supposed to be MACD as per below for 5 days ago:
MACD[5]
If you don’t need all of them to have occurred at the same time you may write:
c1 = summation[5](macd[12,26,9] crosses over 0)
c2 = summation[5](average[125,1] crosses over average[63,1]) //shouldn't it be the other way round?!
c3 = summation[5](average[10,1] crosses over average[20,1])
IF c1 AND c2 AND c3 THEN...
If, instead, you need all of them to have occurred at the same time you should write:
c1 = macd[12,26,9] crosses over 0
c2 = average[125,1] crosses over average[63,1] //shouldn't it be the other way round?!
c3 = average[10,1] crosses over average[20,1]
IF summation[5](c1 AND c2 AND c3) THEN...
Hi
you may use your variable if supposed to be MACD as per below for 5 days ago:
MACD[5]
This will only check whether it happened the 5th last bar, not within the last 5 bars.
Hi Robert,
thank you very much. this is exactly what i am looking for.
c1 = macd[12,26,9] crosses over 0
c2 = average[63,1] crosses over average[125,1]
c3 = average[10,1] crosses over average[20,1]
IF summation[5](c1 AND c2 AND c3) THEN...
can i use something like below:
IF summation[5](c1 AND c2 AND c3)
THEN C4
screener ...c4
You certainly can!
There is no limit to what you can do provided the syntax is correct (but this is easy, since PRT takes care of it) and, most of all, the logic is correct (which PRT cannot check).
Yes, your example is correct.
Hello kumar_AK and welcome to the forums! Please can you use the ‘Insert PRT Code’ button when you put code in your future posts as it makes it so much more readable for others. I have tidied up you post for you. 🙂