Timeframe in screener

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #14039 quote
    jbyrne
    Participant
    Average

    Hi, Ive written some code but i want it to only look at the first 5 min candle of the current day. How can I do this?

    Thanks

    My code:

    //Bear Candle
    BearBody = (open - close)
    BearWick = (close - low) or (high - open)
    BearCandle = BearBody < BearWick
    
    //Bull Candle
    BullBody = (close - open)
    BullWick = (open - low) or (high - close)
    BullCandle = BullBody < BullWick
    
    Screener [BearCandle or BullCandle]
    #14051 quote
    jbyrne
    Participant
    Average

    hi, im sorry if im missing something easy but i’m very new to coding with PRT so any help would be hugely appreciated, all i want to know how I can make the above code run on only the first 5 minutes of the current day 🙂

    #14053 quote
    Nicolas
    Keymaster
    Legend

    On what timeframe do you want to launch your screener?

    #14054 quote
    jbyrne
    Participant
    Average

    on a 5 minute timeframe which ive done, but i only want it to run on the first candle of the day, if i run the code as it is, it just run since earliest date which i dont want.

    #14055 quote
    Nicolas
    Keymaster
    Legend

    You can use intradaybarindex to know the actual candlestick number. With it you can restrain your test to the first intradaybarindex.

    #14064 quote
    jbyrne
    Participant
    Average

    ive added IntradayBarIndex[0] to the start of my code and it doesn’t work, the candle is the first bar of the day and therefore bar 0 if im not mistaken. If you could give me some help with the syntax when using it in a screener instead of just an indicator that would help me out alot 🙂

    #14068 quote
    Nicolas
    Keymaster
    Legend

    Hmmm.. maybe a time condition would meet more the way you are thinking about your screener.

    Add a time condition (adapt it to the open time of the instrument of course):

    tcondition = time>080000 and time<081000

    Your complete code would look like this:

    //Bear Candle
    BearBody = (open - close)
    BearWick = (close - low) or (high - open)
    BearCandle = (BearBody < BearWick) and tcondition
    
    //Bull Candle
    BullBody = (close - open)
    BullWick = (open - low) or (high - close)
    BullCandle = (BullBody < BullWick) and tcondition
    
    Screener [BearCandle or BullCandle]

    Didn’t test it, Sunday evening coding, should work .. 🙂

    #14074 quote
    jbyrne
    Participant
    Average

    thats great thank you very much! i’ll test it tomorrow and update you if it all works 🙂

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Timeframe in screener


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
jbyrne @jbyrne Participant
Summary

This topic contains 7 replies,
has 2 voices, and was last updated by jbyrne
9 years, 11 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 10/01/2016
Status: Active
Attachments: No files
Logo Logo
Loading...