IF IntradayBarIndex

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #40335 quote
    AVT
    Participant
    Senior

    Maybe I have a problem understanding the IntradayBarIndex. This is what I don’t understand:

    1. I create a one-time ranger and all is perfect.
    2. I create a two-time ranger and IntradayBarIndex “does not obey”

    In the picture you see

    • (the boxes just mark the whole time range)
    • the High lines of the Pre market (same time range in both versions).
    • The one-time ranger in bold dashes which does start with the IntradayBarIndex value for highestPrice at zero
    • the two-time ranger as smaller line which does not start with the IntradayBarIndex value zero.

    I thought that setting the IntradayBarIndex once in the beginning would do the job for the whole indicator, means when the first time range (in this case 8:00-9:00) is activated by setting it TRUE we begin calculating with zero.

    Am I making a thinking mistake here?

    Thanks.

    IF IntradayBarIndex = 0 THEN
      highestPrice = 0
      lowestPrice = close * 100
    ENDIF
    
    TimeRange = ( Time > 080000 AND Time < 085959 )
    IF TimeRange THEN
      highestPrice = max(highestPrice,high)
      lowestPrice = min(lowestPrice,low)
    ENDIF
    RETURN highestPrice as "Buytrigger", lowestPrice as "Selltrigger"
    IF IntradayBarIndex = 0 THEN
      highestPrice = 0
      lowestPrice = close * 100
    ENDIF
    // --- extern: PreMarket (bool), NormMaket (bool)
    PrTimeRange = ( time > 080000 AND time < 085959 )
    NoTimeRange = ( time > 090000 AND time < 095959 )
    // --- 1st ranger
    IF PreMarket THEN
      IF PrTimeRange THEN
        highestPrice = max(highestPrice,high)
        lowestPrice = min(lowestPrice,low)
        PrHigh = highestPrice
        PrLow = lowestPrice
      ENDIF
    ENDIF
    // --- 2nd ranger
    IF NormMarket THEN
      IF NoTimeRange THEN
        highestPrice = max(highestPrice,high)
        lowestPrice = min(lowestPrice,low)
        NoHigh = highestPrice
        NoLow = lowestPrice
      ENDIF
    ENDIF
    RETURN PrHigh as "PreMarketRange High", PrLow as "PreMarketRange Low", NoHigh as "MarketRange High", NoLow as "MarketRange Low"
    
    #40534 quote
    Nicolas
    Keymaster
    Master

    You are using 2 times the same variables names (highestprice and lowestprice) and for 2 different time settings, that could cause the difference?

    #40589 quote
    AVT
    Participant
    Senior

    Thanks Nicolas for the idea. But – there is always a but 🙁

    I change the code to use two different starting limits and calculate with them. I just show the PreMarket=true in the picture because NormMarket does the same.

    • thick blue line is High Line starting only at the beginning of the chart with zero
    • dark blue dashes is the Low Line, also starting only at the beginning and not as it should at close*100

    The orignal idea of having only one defintion of highest and lowest in the IntradayBarIndex was: as soon as one Ranger is started, it should look up the IntradayBarIndex values and then do its job. If now the second Ranger is started (this one would start later than the first one, so) there is actually no real need for the IntradayBarIndex values as we know already know highs and lows.

    Here is the modified code that goes with the picture:

    IF IntradayBarIndex = 0 THEN
    PRhighestPrice = 0
    PRlowestPrice = close * 100
    NOhighestPrice = 0
    NOlowestPrice = close * 100
    ENDIF
    // --- extern: PreMarket (bool), NormMarket (bool)
    //PreMarket=1
    //NormMarket=0
    PrTimeRange = ( time > 080000 AND time < 085959 )
    NoTimeRange = ( time > 090000 AND time < 095959 )
    // --- 1st ranger
    IF PreMarket THEN
    IF PrTimeRange THEN
    PRhighestPrice = max(PRhighestPrice,high)
    PRlowestPrice = min(PRlowestPrice,low)
    PrHigh = PRhighestPrice
    PrLow = PRlowestPrice
    ENDIF
    ENDIF
    // --- 2nd ranger
    IF NormMarket THEN
    IF NoTimeRange THEN
    NOhighestPrice = max(NOhighestPrice,high)
    NOlowestPrice = min(NOlowestPrice,low)
    NoHigh = NOhighestPrice
    NoLow = NOlowestPrice
    ENDIF
    ENDIF
    RETURN PrHigh as "PreMarketRange High", PrLow as "PreMarketRange Low", NoHigh as "MarketRange High", NoLow as "MarketRange Low"

     

    Thanks for your attention.

    #40952 quote
    gabri
    Participant
    Master

    I am giving you my two cents on this. You are using a TF 30 mins. If Intradaybarindex=0 goes from 0800 till 0830, you will not have any data available for this intradyabarindex until 0830 (close time of the first intraday bar). This means that only after 0830 you will have a good computation of values. I cannot really see the scale on the bottom. If you want to troubleshoot the problem try to add the return line return intradaybarindex

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

IF IntradayBarIndex


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
AVT @avt Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by gabri
8 years, 6 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 07/11/2017
Status: Active
Attachments: 2 files
Logo Logo
Loading...