Screener to check condition only between specified times?

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #111156 quote
    robdav
    Participant
    Veteran

    I’m trying to write a screener that checks DOpen(0) against another indicator but I only want it to evaluate the condition between a specified time, say the first 10 mins of the market open. At the moment it doesn’t seem to work.

    Start = 060000
    End = 103000
    
    IF TIME >= Start AND TIME =< End THEN
        Conditions...
    ENDIF

    I have tried the above but it returns no results.

    Is what I’m trying to do possible please?

    Thanks

    Rob

    #111157 quote
    GraHal
    Participant
    Master

    A suggestion … test using conditions that you know will definitely return a value between those times then you can check out that the Screener worked between those times only?

    #111158 quote
    Nicolas
    Keymaster
    Master

    In which timeframe please?

    #111164 quote
    robdav
    Participant
    Veteran

    Hi Nicolas

    Daily timeframe which I guess is my problem?

    I’m trying to compare today’s open to an indicator value from two periods ago [2]

    Thanks

    Rob

    #111167 quote
    Nicolas
    Keymaster
    Master

    Yes that’s the problem, because you check TIME that are not read in daily bar. You should split your conditions into different timeframe by using the TIMEFRAME instruction of ProScreener.

    robdav thanked this post
    #111170 quote
    robdav
    Participant
    Veteran

    I think I’m with you 🙂

    So I check the daily indicator value on the daily timeframe and DOpen(0) on a lesser timeframe, like an hour?

    #111171 quote
    Nicolas
    Keymaster
    Master

    Forget what I said in my last post, Dopen(0) is a value that can test in any timeframe. So just use the same code that you did but on a timeframe that read the TIME you set on its bar close.

    e.g. 103000 is a time read only starting at timeframe 30 minutes (and below obviously).

    #111200 quote
    robdav
    Participant
    Veteran

    Hi Nicolas

    I’m struggling and would appreciate some help please.

    I have coded a dummy ProOrder system with GRAPH statements similar to what is in the SCREENER. I can verify the conditions being met/correct but I cannot get the SCREENER to return any values.

    I am executing both the ProOrder system and the screener on a 1 minute chart.

    What am I doing wrong please?

    Thanks
    Rob

    DEFPARAM CUMULATEORDERS = False
    
    //EMA[2] from dailt chart
    timeframe(daily)
    EMA2 = ExponentialAverage[2]
    
    //Daily SMA
    smad20 = average[21]
    
    timeframe(default)
    
    //dummy order condition
    IF smad20=-100 THEN
    BUY AT MARKET
    ENDIF
    
    GRAPH DOpen(0) as "Daily Open(0)"
    GRAPH EMA2 as "Daily EMA 2"
    GRAPH Close as "Close"
    // Time to check the condition
    CheckTime = 090000
    
    // Flag setup
    Flag = 0
    
    // EMA[2] from Daily chart
    timeframe(daily)
    EMA1 = ExponentialAverage[2]
    
    timeframe(default)
    
    // Daily open value
    DaOpen = DOpen(0)
    
    // To go short
    IF (TIME = CheckTime) THEN
    IF DaOpen >= EMA1 THEN
    Flag = 2
    ENDIF
    ENDIF
    
    // To go long
    IF (TIME = CheckTime) THEN
    IF DaOpen <= EMA1 THEN
    Flag = 1
    ENDIF
    ENDIF
    
    SCREENER[Flag](Flag AS "1=Buy  2=Sell")
    SCREENER-Check.itf GRAPH-check.itf
    #111204 quote
    Nicolas
    Keymaster
    Master

    I get plenty of results by using the screener on a 1-hour timeframe.

    At the time I write this post, there is 337 elapsed 1-minute bars since 9 o’clock this morning, with a limitation of 254 bars in ProScreener, there is no way for your code to return something..

    robdav thanked this post
    #111211 quote
    robdav
    Participant
    Veteran

    Of course, I forgot about that limit!

    Thanks again.

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

Screener to check condition only between specified times?


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
robdav @robdav Participant
Summary

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

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 10/25/2019
Status: Active
Attachments: 2 files
Logo Logo
Loading...