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

Indicator with customizable lines

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

    Indicator with customizable lines

    Hello!

    I am trying to build an indicator that will allow the user to set predefined horizontal lines that update when new bars are created.

    I want the user to be able to attach the lines to the various candles from the following time frames:

    1. One minute
    2. Five minute
    3. Fifteen minute
    4. One hour
    5. Two hour
    6. One day
    7. US Open
    8. Weekly

    I'd also like the user to be able to choose from the following points on the candle:

    1. Open
    2. High
    3. Low
    4. Close

    So for instance... it would allow me to do this:

    Put a horizontal line on the open of each new 15 minute candle, a horizontal line on the open of each two hour candle, and a horizontal line on the open of each weekly candle. Then as new candles are created for the chose time frames the old line is removed and the new line is added.

    I've gotten as far as adding the plots and creating an enum for the time frame selection and the candle position selection but I am unsure how to get those options to show up as drop down selections in the UI. I have not yet attached either the time frame selection or the candle position selection to the enum list.

    Am I on the right track or am I way off?

    Any help is greatly appreciated.


    #2
    Hello benjamin$,

    I want the user to be able to attach the lines to the various candles from the following time frames:
    This would generally involve applying the script to one of those timeframes. You would have to make logic that works for those timeframes if the script is to be used with various different timeframes.

    I'd also like the user to be able to choose from the following points on the candle:
    You can use an enum for this type of selection, in your logic you would use the enum value to determine which part of the logic is being used.

    I've gotten as far as adding the plots and creating an enum for the time frame selection and the candle position selection but I am unsure how to get those options to show up as drop down selections in the UI.
    You can see the enum example which shows making a public enum property. If you make an enum it needs to be formatted like the one in the same and used in the same way: https://ninjatrader.com/support/help...ned_parame.htm
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you for the response Jesse. I will work to understand the information you shared. Is it possible to build this indicator so that it shows lines from other timeframes on the current chart. So for example if I apply it to the 1 minute chart it will show the lines that are based on the 15 and 2 hour bars?

      Comment


        #4
        Hello benjamin$,

        You could use AddDataSeries to add those other timeframes to the script and then use logic in OnBarUpdate to draw based on those events.

        The BarsInProgress index dictates which series called OnBarUpdate so you can form conditions that happen for each of those series or also use their data. The drawing will be specifically relevant to the primary series so if you use values that are not within the visible range for the primary then they will not appear if AutoScale is false. The BarsAgo are also relevant to the primary series so if you draw from a secondary series you would need to keep that in mind or use Times instead of BarsAgo to place them on specific places relevant to the secondary series.

        There is a very simple example of drawing a secondary series price using a drawing object here: https://ninjatrader.com/support/foru...58#post1188958



        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by AveryFlynn, Today, 04:57 AM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by Max238, Today, 01:28 AM
        4 responses
        37 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by r68cervera, Today, 05:29 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by geddyisodin, Today, 05:20 AM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by timko, Today, 06:45 AM
        2 responses
        14 views
        0 likes
        Last Post NinjaTrader_ChristopherJ  
        Working...
        X