Intraday NR 7

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #81528 quote
    TB2
    Participant
    New

    Not sure if I am posting the following question in the correct area, but here goes.

    I have a simple Probuilder Indicator that highlights and paints NR7 bar(s) on Intraday time frames, i.e. 5 minute 10,30, etc. However, my problem comes that by default every opening bar will be NR7 and this causes the bar to print in the NR7 colour chosen say “Pink” but as the bar[0] completes and the range is not going to be a NR7 I am left with a two toned colour bar(s) say pink and green in the event of a higher close to the open . How can I force the indicator to only consider completed bars i.e ignore High – Low [0] bar.

    See code below

    REM Narrow Range Bar Intraday Time Frame(x)
    NR =High-Low
    REM NR7
    NRB = LOWEST[7](NR)
    IF NRB=NR THEN
    DRAWCANDLE(open, high, low, close)  coloured (255,102,255)
    ENDIF
    RETURN

    Any help would be appreciated.

    #81539 quote
    Vonasi
    Moderator
    Master

    Welcome to the forums. Please use the ‘Insert PRT Code’ button when putting code in future posts as it makes it so much easier for others to read. I have tidied up your post for you. 🙂

    #81545 quote
    Nicolas
    Keymaster
    Master

    To refer to a closed bar, you should use offset of your variables:

    REM Narrow Range Bar Intraday Time Frame(x)
    NR =High-Low
    REM NR7
    NRB = LOWEST[7](NR)
    IF NRB[1]=NR[1] THEN
    DRAWCANDLE(open, high, low, close)  coloured (255,102,255)
    ENDIF
    RETURN

    Not tested, but it should only paint Closed bars that met the NR7 pattern.

    #81548 quote
    Lind3berg
    Participant
    Junior

    Im not sure if i understand it right. But try this one. Im far away from  good on this but maybe it wil fix yur problem? 🙂

    REM Narrow Range Bar Intraday Time Frame(x)
    NR =High-Low
    REM NR7
    NRB = LOWEST[7](NR)
    For i= 8 downto 1 do
    IF NRB=NR THEN
    DRAWCANDLE(open, high, low, close)  coloured (255,102,255)
    ENDIF
    next
    RETURN
    Nicolas thanked this post
    #81550 quote
    Nicolas
    Keymaster
    Master

    Good try @Lind3berg! But you forgot to refer to the right candlestick in your loop 🙂

     

    REM Narrow Range Bar Intraday Time Frame(x)
    NR =High-Low
    REM NR7
    NRB = LOWEST[7](NR)
    For i= 8 downto 1 do
    IF NRB[i]=NR[i] THEN
    DRAWCANDLE(open, high, low, close)  coloured (255,102,255)
    ENDIF
    next
    RETURN

    But this code should also not work because DRAWCANDLE can’t plot candle in the past, you could have used an arrow for example:

    REM Narrow Range Bar Intraday Time Frame(x)
    NR =High-Low
    REM NR7
    NRB = LOWEST[7](NR)
    For i= 8 downto 1 do
     IF NRB[i]=NR[i] THEN  
      DRAWARROW(barindex[i],low[i])coloured (255,102,255)
     ENDIF
    next
    RETURN

    BTW, none of these codes posted here have been tested by me, so I don’t know if it fulfilled the initial query of the post ❓

    #81551 quote
    Lind3berg
    Participant
    Junior

    Ok! I Think i understand a little bit more now. Thanks for the lesson @Nicolas 🙂

    #81557 quote
    robertogozzi
    Moderator
    Master

    This can do the trick, just paint the standard colours if not NR7:

    DEFPARAM CalculateOnLastBars = 500
    NR =High-Low
    REM NR7
    NRB = LOWEST[7](NR)
    IF NRB=NR THEN
       DRAWCANDLE(open, high, low, close)  coloured (255,102,255)
    ELSE
       if open > close then
          DRAWCANDLE(open, high, low, close)  coloured (0,0,255)   //BLUE
       else
          DRAWCANDLE(open, high, low, close)  coloured (255,0,0)   //RED
       endif
    ENDIF
    RETURN

    Moreover, why do the math (NR=high-low) when you can let PRT do it with RANGE?

    #81558 quote
    robertogozzi
    Moderator
    Master

    Sorry, just invert colours!

    #81704 quote
    TB2
    Participant
    New

    Thanks for your input Nicolas, unfortunately “IF NRB[1]=NR[1] THEN” seems to highlight both NR7 and non NR7 bars. I tried something similar by including NR =High[1]Low[1] as a sort of look back once Bar [0] started to print before posting my question resulting in the same mixed result. However, using the  “DrawArrowDown” command works without any issues. So for the moment I will keep with this option until I can try out robertogozzi suggestion.

    Thanks again for reaching out.

     

    Regards

    TB2

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

Intraday NR 7


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
TB2 @tb2 Participant
Summary

This topic contains 8 replies,
has 5 voices, and was last updated by TB2
7 years, 4 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 09/28/2018
Status: Active
Attachments: No files
Logo Logo
Loading...