Barindex Determination in Screeners

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #81463 quote
    jrh_hanjrh_han
    Participant
    New

    I need to determin the BarIndex of the first trading day of january current year within a screener. How do I manage?

    #81466 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    You are lucky because no more than 254 bars have elapsed (max. lookback for ProScreener):

    MyBar = 0
    FOR i = 0 to 253
       IF date[i] < 20180101 THEN
          MyBar  = i - 1
          break
       ENDIF
    NEXT
    SCREENER [MyBar] (MyBar as "MyBar")

    You cannot write “= 20180101” because that day could not be a trading day, so once you have found the first day BEFORE that date, you know the bar AFTER that one is the first trading day of this year, it can be different according to instruments that have, since then, accumulated less trading days.

    Nicolas thanked this post
Viewing 2 posts - 1 through 2 (of 2 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

Barindex Determination in Screeners


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
jrh_han @jrh_han Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzirobertogozzi
8 years ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 09/27/2018
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...