Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Custom High and Low in indicator panel. How to fill in?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Custom High and Low in indicator panel. How to fill in?

    Hi,

    Hopefully I can get some assistance with the following.

    I have a custom indicator in real time plotting a line for the high and a low for each bar, the problem I'm having is how do I fill the space in between the high and low? I just can't seem to find how to do this. If I use a Bar instead of a Line then every bar starts at zero.

    Appreciate your help.
    suprsnipes.

    #2
    Hello suprsnipes,


    You could use DrawRegion() to accomplish this.
    Here is the DrawRegion() Help Guide to assist you further.
    I have included below an example of how to use DrawRegion().
    Code:
    [FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] [/SIZE][FONT=Courier New][SIZE=2][COLOR=#0000ff]protected[/SIZE][/FONT][FONT=Courier New][SIZE=2] [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]override[/COLOR][/SIZE][/FONT] [FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/FONT] [FONT=Courier New][SIZE=2]Initialize()[/SIZE][/FONT][/SIZE][/FONT][LEFT][FONT=Courier New][SIZE=2]        {[/SIZE][/FONT]
    [FONT=Courier New][SIZE=2]            Add([/SIZE][/FONT] [FONT=Courier New][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000]"Hi"[/COLOR][/SIZE][/FONT] [FONT=Courier New][SIZE=2]));[/SIZE][/FONT]
    [FONT=Courier New][SIZE=2]            Add([/SIZE][/FONT] [FONT=Courier New][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000]"Lo"[/COLOR][/SIZE][/FONT] [FONT=Courier New][SIZE=2]));[/SIZE][/FONT]
    [FONT=Courier New][SIZE=2]            Overlay                       = [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] ;[/SIZE][/FONT]
    [FONT=Courier New][SIZE=2]        }[/SIZE][/FONT]
    [FONT=Courier New][SIZE=2]            [/SIZE][/FONT]
    [FONT=Courier New][SIZE=2]        [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]protected[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]override[/COLOR][/SIZE][/FONT] [FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/FONT] [FONT=Courier New][SIZE=2]OnBarUpdate()[/SIZE][/FONT]
    [FONT=Courier New][SIZE=2]        {[/SIZE][/FONT]
    [FONT=Courier New][SIZE=2]            Hi.Set(High[[/SIZE][/FONT] [FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]]);[/SIZE][/FONT]
    [FONT=Courier New][SIZE=2]            Lo.Set(Low[[/SIZE][/FONT] [FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]]);[/SIZE][/FONT]
    [FONT=Courier New][SIZE=2]                  [/SIZE][/FONT]
    [FONT=Courier New][SIZE=2]                  DrawRegion([/SIZE][/FONT] [FONT=Courier New][SIZE=2][COLOR=#800000]"tag1"[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] , CurrentBar, [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT] [FONT=Courier New][SIZE=2],Hi, Lo, Color.Empty, Color.Purple, [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]2[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] );[/SIZE][/FONT][COLOR=#000000][FONT=Tahoma][LEFT][FONT=Courier New][SIZE=2]        }[/SIZE][/FONT][/LEFT][/FONT][LEFT][/LEFT][/COLOR][LEFT][/LEFT]
    [FONT=Courier New][SIZE=2][/SIZE][/FONT]

    [/LEFT]
    [/FONT][/COLOR]
    Shawn B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by mjairg, 07-20-2023, 11:57 PM
    3 responses
    213 views
    1 like
    Last Post PaulMohn  
    Started by TheWhiteDragon, 01-21-2019, 12:44 PM
    4 responses
    544 views
    0 likes
    Last Post PaulMohn  
    Started by GLFX005, Today, 03:23 AM
    0 responses
    3 views
    0 likes
    Last Post GLFX005
    by GLFX005
     
    Started by XXtrader, Yesterday, 11:30 PM
    2 responses
    12 views
    0 likes
    Last Post XXtrader  
    Started by Waxavi, Today, 02:10 AM
    0 responses
    7 views
    0 likes
    Last Post Waxavi
    by Waxavi
     
    Working...
    X