Barindex Determination in Screeners

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #81463 quote
    jrh_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
    robertogozzi
    Moderator
    Master

    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.

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 robertogozzi
7 years, 5 months ago.

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