Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adding Lines to indicator?

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

    Adding Lines to indicator?

    Greetings,

    2 Question on adding lines to an existing indicator.

    For example, an existing Stochastic indicator:

    I want to add multiple lines with the option to change the color, style, value and width?

    I want to add a specific range within the Stochastic indicator and have that range in a color. I would like the option change the opacity, color, style, value and width?

    What code would do this, and where would it be inserted?

    Thank you.

    Joseph

    #2
    Hello Joseph,

    You can start by creating a new indicator with the original code from another indicator. To do this go the Control Center -> Tools -> Edit NinjaScript -> Indicators. Then double left click on the indicator that you want to have the original code from for example the "Stochastics". It will then open up the source code for the indicator. Right click inside the window and select Save As. Type in a name of your choosing then press "Save". Press the "OK" button. Now you have a new indicator based off the system indicator code that you can modify to add more lines.

    Here is a link to our Help Guide that goes over the DrawLine() method inside of NinjaScript where you can cutomize the color, style, value, and width of a line.


    You may view the following thread for a reference sample on how to draw objects.


    You can create condition(s) to change the color, style, value, and width of your line, but opacity the DrawLine() method does not have.

    Let us know if we can be of further assistance.
    JCNinjaTrader Customer Service

    Comment


      #3
      Thank you!!

      Great stuff JC!!
      Thank you!!

      Originally posted by NinjaTrader_JC View Post
      Hello Joseph,

      You can start by creating a new indicator with the original code from another indicator. To do this go the Control Center -> Tools -> Edit NinjaScript -> Indicators. Then double left click on the indicator that you want to have the original code from for example the "Stochastics". It will then open up the source code for the indicator. Right click inside the window and select Save As. Type in a name of your choosing then press "Save". Press the "OK" button. Now you have a new indicator based off the system indicator code that you can modify to add more lines.

      Here is a link to our Help Guide that goes over the DrawLine() method inside of NinjaScript where you can cutomize the color, style, value, and width of a line.


      You may view the following thread for a reference sample on how to draw objects.


      You can create condition(s) to change the color, style, value, and width of your line, but opacity the DrawLine() method does not have.

      Let us know if we can be of further assistance.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      597 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      343 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      103 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      556 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      555 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X