Proscreener – cross over happened in last “n” number of days

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #68073 quote
    kumar_AK
    Participant
    Junior

    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:

    1. MACD Cross over happened in last 5 days
    2. EMA 125 > EMA 63 in last 5 days
    3. EMA 10 crosser over EMA20 heppened in last 5 days.

    your help is appreciated.

    #68789 quote
    PEDRAM.JOKAR
    Participant
    Average

    Hi

    you may use your variable if supposed to be MACD as per below for 5 days ago:

    MACD[5]

    #68811 quote
    robertogozzi
    Moderator
    Master

    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...
    Nicolas, kumar_AK and Andyswede thanked this post
    #68812 quote
    robertogozzi
    Moderator
    Master

    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.

    kumar_AK thanked this post
    #70320 quote
    kumar_AK
    Participant
    Junior

    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

     

    #70331 quote
    robertogozzi
    Moderator
    Master

    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.

    kumar_AK thanked this post
    #71688 quote
    Vonasi
    Moderator
    Master

    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. 🙂

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Proscreener – cross over happened in last “n” number of days


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
kumar_AK @kumar_ak Participant
Summary

This topic contains 6 replies,
has 4 voices, and was last updated by Vonasi
7 years, 9 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 04/12/2018
Status: Active
Attachments: No files
Logo Logo
Loading...