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 fx.practic, 10-15-2013, 12:53 AM
    5 responses
    5,406 views
    0 likes
    Last Post Bidder
    by Bidder
     
    Started by Shai Samuel, 07-02-2022, 02:46 PM
    4 responses
    98 views
    0 likes
    Last Post Bidder
    by Bidder
     
    Started by DJ888, Yesterday, 10:57 PM
    0 responses
    8 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by MacDad, 02-25-2024, 11:48 PM
    7 responses
    160 views
    0 likes
    Last Post loganjarosz123  
    Started by Belfortbucks, Yesterday, 09:29 PM
    0 responses
    9 views
    0 likes
    Last Post Belfortbucks  
    Working...
    X