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

horizontal line indicator

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

    horizontal line indicator

    Hi,
    I am developing an indicator that needs to have a number (about 10) of horizontal lines redrawn every time a calculation is done, however only the last line I draw seems to show up. Can you point me to an example that would do something like this (i think I saw a Fibinochi indicator once that worked like this but cant seem to find it)
    thx!

    #2
    Hello nightriderx,

    You need to have an unique tag for each line.

    Example with three horizontal lines:
    DrawHorizontalLine("tag1", 1001, Color.Black);
    DrawHorizontalLine("tag2", 1002, Color.Black);
    DrawHorizontalLine("tag3", 1003, Color.Black);
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      so if these lines are generated in a loop - how could I do that? (other than breaking up the name "tag1" to "tag" + converting the loop counter to text, etc...? -would really try to stay away from doing this)

      Comment


        #4
        also, I would like to get the values of the lines to display in the data box. I have the "display in databox = true in the initialize field but the data box still does not display the values... do I actually need to turn the values into a data set or is there a way just to display the plotted lines?

        thx!

        Comment


          #5
          You may consider appending the loop counter variable to the tag. I'm not aware of a different way to make them unique within a loop. Maybe our members with C# experience know of another way.

          for (int x = 0; x < 9; x++)
          {
          DrawHorizontalLine("tag1" + x, 1000, Color.Black);
          }

          The data box displays plot values only, so to view these lines in a data box would need to convert to plots.
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            o wow, that +1 actually worked. thats fine. I assumed that I had to break up the text and convert it. but this is good.

            as for getting the values in the data box - im plotting the lines using a "DrawLine" command in the on bar update section with a "add(new plot..." in the initialized section.... everything plotting but not showing up in the databox

            thx again!

            Comment


              #7
              Great that it works for you.

              DrawLine() won't produce values you can see in a data box. Data box is plots only, like:

              Plot0.Set(myLineValue);
              Ryan M.NinjaTrader Customer Service

              Comment


                #8
                ok so the "draw" command works in a loop but does not display values in the data box...
                The plot command displays in the data box but how would you suggest getting the new plot name (ie. Plot0.Set, Plot1.Set) in a loop?

                Comment


                  #9
                  Unfortunately not aware of a way to set plots in a loop. There may be a creative programming solution available here, but it's beyond our scope of support. Would be neat to see if our community members can come up with something.

                  Copy-pasting the .Set commands and making small changes to each line is likely the easiest way to go.
                  Ryan M.NinjaTrader Customer Service

                  Comment


                    #10
                    If you just need a visualization of the line values you can use the same loop and add the text in the right margin with DrawText().

                    Dan
                    eDanny
                    NinjaTrader Ecosystem Vendor - Integrity Traders

                    Comment


                      #11
                      ok, the other thing that I am trying to do is pass an array from an indicator to a strategy...is this supported in nt? if so can you please point me in the right direction? The array seems to work fine in the indicator but cant seem to access it in the strategy, all im getting is 0's
                      thx

                      Comment


                        #12
                        nevermind, found a way to do it

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by helpwanted, Today, 03:06 AM
                        1 response
                        12 views
                        0 likes
                        Last Post sarafuenonly123  
                        Started by Brevo, Today, 01:45 AM
                        0 responses
                        9 views
                        0 likes
                        Last Post Brevo
                        by Brevo
                         
                        Started by aussugardefender, Today, 01:07 AM
                        0 responses
                        5 views
                        0 likes
                        Last Post aussugardefender  
                        Started by pvincent, 06-23-2022, 12:53 PM
                        14 responses
                        242 views
                        0 likes
                        Last Post Nyman
                        by Nyman
                         
                        Started by TraderG23, 12-08-2023, 07:56 AM
                        9 responses
                        387 views
                        1 like
                        Last Post Gavini
                        by Gavini
                         
                        Working...
                        X