Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawHorizontalLine+CurrentBar(0)

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

    DrawHorizontalLine+CurrentBar(0)

    trying to make an indicator that will draw a horizontal line at the current price.

    the attached indicator works but does not allow me to choose any colors for the line...currently it's set for "Yellow" directly in the code.

    i am looking for the option to choose any color when opening the indicator window
    Attached Files

    #2
    enum

    I think you will have to add code for a enum. I think there is an example of that in the code examples.

    Here is a link to the page

    Last edited by clfield; 03-26-2009, 06:04 PM. Reason: add link

    Comment


      #3
      Hi duck_CA, you can check this link to add a user defined color input to the indicator - http://www.ninjatrader-support2.com/...ead.php?t=4977

      Comment


        #4
        DrawHorizontalLine("Current_price",Close[0],LineColor,DashStyle.Dot,1);

        Thank Josh for the link...

        I'm trying to create a name...which is currently "LineColor".

        I noticed that you used "BorderColor" and "FillColor" for drawing the Rectangle in your SampleColorInput Indicator.

        Is there a certain name that is needed for my case?
        Code:
        [FONT=Courier New][SIZE=2][COLOR=#0000ff]#region[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] Variables[/SIZE][/FONT]
        [FONT=Courier New][SIZE=2][COLOR=#008000]// Wizard generated variables[/COLOR][/SIZE][/FONT]
        [FONT=Courier New][SIZE=2][COLOR=#0000ff]private[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] Color LineColor = Color.Cyan;[/SIZE][/FONT]
        Code:
        [SIZE=2][FONT=Courier New]DrawHorizontalLine([/FONT][/SIZE][FONT=Courier New][SIZE=2][COLOR=#800000]"Current_price"[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2],Close[[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]],[SIZE=4][COLOR=blue]LineColor[/COLOR][/SIZE],DashStyle.Dot,[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]);[/SIZE][/FONT]
        Code:
        [FONT=Courier New][SIZE=2][COLOR=#0000ff]#region[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] Properties[/SIZE][/FONT]
         
        [SIZE=2][FONT=Courier New][XmlIgnore()][/FONT][/SIZE]
        [SIZE=2][FONT=Courier New][Description([/FONT][/SIZE][FONT=Courier New][SIZE=2][COLOR=#800000]"PriceLine Color"[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2])][/SIZE][/FONT]
        [SIZE=2][FONT=Courier New][Category([/FONT][/SIZE][FONT=Courier New][SIZE=2][COLOR=#800000]"Parameters"[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2])][/SIZE][/FONT]
        [FONT=Courier New][SIZE=2][COLOR=#0000ff]public[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] Color Price_Line_Color[/SIZE][/FONT]
        [SIZE=2][FONT=Courier New]{[/FONT][/SIZE]
        [FONT=Courier New][SIZE=2][COLOR=#0000ff]get[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] { [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] lineColor; }[/SIZE][/FONT]
        [FONT=Courier New][SIZE=2][COLOR=#0000ff]set[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] { lineColor = value; }[/SIZE][/FONT]
        [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]
         
        [FONT=Courier New][SIZE=2][COLOR=#008000]// Serialize our Color object[/COLOR][/SIZE][/FONT]
        [FONT=Courier New][SIZE=2][Browsable([/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]false[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2])][/SIZE][/FONT]
        [FONT=Courier New][SIZE=2][COLOR=#0000ff]public[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]string[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] priceColorSerialize[/SIZE][/FONT]
        [SIZE=2][FONT=Courier New]{[/FONT][/SIZE]
        [FONT=Courier New][SIZE=2][COLOR=#0000ff]get[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] { [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] NinjaTrader.Gui.Design.SerializableColor.ToString(lineColor); }[/SIZE][/FONT]
        [FONT=Courier New][SIZE=2][COLOR=#0000ff]set[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] { lineColor = NinjaTrader.Gui.Design.SerializableColor.FromString(value); }[/SIZE][/FONT]
        [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]

        Comment


          #5
          You need to use lower case L for your variable in the Variables section to match your variable in the Properties section.
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Current PriceLine Indicator with Color Options

            Thanks Josh,

            Here is a cool indicator that draws a horizontal line at the current market price level. This can help to see where S/R levels are in comparsion to current price.

            The really cool feature is the ability to change the line color to any color desired via the indicator window.

            Attached is the Indicator and a vid showing how to change colors.
            World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.


            Glad I can contribute to my fellow Ninja Users.
            Attached Files

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            580 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            335 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            102 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            554 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            552 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X