Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

rename a plot

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

    rename a plot

    I am currently reading in data from a spreadsheet into an array that includes a property value and a plot name.

    I can read in the data from the excel file, but can't figure out how to use it to name the plots. I'm creating and naming the plots in State.SetDefaults

    I read in the data in State.Configure, which is too late to use the imported array of names.

    Is there a sequence I can use to read in the data from excel and then either use this name in AddPlot or rename the Plot after I import the data?

    #2
    Hello cre8able,

    Thank you for the inquiry.

    You can move the AddPlot to State.Configure to do that. There is a sample of using AddPlot dynamically in the following link: https://ninjatrader.com/support/help...ghtsub=addplot



    I look forward to being of further assistance.

    Comment


      #3
      thanks Jesse but I got my states wrong.

      I have a method called GetFilterValues() that reads in my values from text file

      I'm now doing AddPlot in State.Configure. that also works fine
      I'm running GetFilterValues() in State.DataLoaded. It works fine there. But AddPlot is already complete

      But if I try GetFilterValues() in Configure, it doesn't read the file.
      If I try to AddPlot in DataLoaded it doesn't run.

      Sorry, I am new to NinjaScript and C# so not sure what each state is meant to do.

      is there a state or state sequence where I can run GetFilterValues() before I do AddPlot?

      I can do all my AddPlots for any values I might read in from GetFilterValues() and update them later, but my plots vary depending on what values I read in. And I'd like to leave the blank ones off the Data Box

      any suggestions?

      Comment


        #4
        Hello cre8able,

        You would need to move what you are doing to State.Configure so it could be used to delegate the plots. What problem were you having when trying to read the file from Configure?

        An alternative could be to set the plots name directly however I am not certain if there are any reasons which may override that:

        Code:
        Plots[0].Name = "Test";
        [0] being the first plot at index 0.

        I look forward to being of further assistance.

        Comment


          #5
          hey Jesse

          I tried moving my method (called GetFilterValues()) to Configure. When it is there, it doesn't read the file.

          When it's in DataLoaded, it read s the file correctly. Below is the output window. I put print statements in each State so I could see where the program was executing.

          Im the top half, you can see GetFilterValues() is in DataLoaded and gets the info correctly
          Bottom half its in Configure and can't get the values.

          If I need to rename the plots after DataLoaded I can. But I'd like to avoid that because I don't know how many values will get read in until I run GetFilterValues(). It can vary from 12-18 so I would have to have 18 plots available and If I didn't use them all they would still show up in the Data Box.



          here is the output:

          SetDefaults
          Configure
          DataLoaded
          GetFilterValues
          index: 0: 3 2 1 OBV
          index: 1: 3 2 1 CMF
          index: 2: 3 2 1 OVB2Signal
          index: 3: 3 2 1 MOM
          index: 4: 3 2 1 Dad
          index: 5: 3 2 1 K
          index: 6: 3 2 1 D
          index: 7: 3 2 1 SF
          index: 8: 3 2 1 DCycleHL
          index: 9: 3 2 1 KCycleHL
          index: 10: 3 2 1 InsideLRC
          index: 11: 3 2 1 HA
          index: 12: 3 2 1 HAOpposing
          index: 13: 3 2 1 TREND
          Terminated

          SetDefaults
          Configure
          GetFilterValues
          index: 0: 0 0 0
          index: 1: 0 0 0
          index: 2: 0 0 0
          index: 3: 0 0 0
          index: 4: 0 0 0
          index: 5: 0 0 0
          index: 6: 0 0 0
          index: 7: 0 0 0
          index: 8: 0 0 0
          index: 9: 0 0 0
          index: 10: 0 0 0
          index: 11: 0 0 0
          index: 12: 0 0 0
          index: 13: 0 0 0
          DataLoaded

          Comment


            #6
            Hello cre8able,

            I tried moving my method (called GetFilterValues()) to Configure. When it is there, it doesn't read the file.
            Are you getting an error or why does it not read the file? Is some part of the logic not ready to read the file like is the path correct at that point or what specifically is happening?

            Without seeing what you coded it would be difficult to say why changing the state is causing it to not read the file.

            I look forward to being of further assistance.

            Comment


              #7
              Finally found it.

              In the separate indicator where I read the excel file (ExcelINTAdapter) I wasn't reading the excel file until DataLoaded. So even though I was calling ExcelINTAdapter in Configure, it didn't run until DataLoaded. So there were no errors. But when it executed all it brought back from ExcelINTAdapter was zero or blank

              thanks for pointing me in the right direction

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              594 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
              554 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X