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 value on Price Chart

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

    Indicator value on Price Chart

    I am trying to have an indicator provide its current value on the price chart as well as half that value. I tried a code snippet I found on the forum but haven't been able to get past the debug stage. Can anyone help me out? I am looking for the the full, half, and quarter output of this particular indicator to be shown in the price chart.

    This is what I tried but must have not put it in the correct location in the code.
    {
    DrawTextFixed(
    "Indicator Value", "Indicator Value " + DominantCycle(1)[0].ToString("N1"), TextPosition.BottomRight, Color.Black, new Font("Arial", 10), Color.Empty, Color.Empty, 0);
    }
    Attached Files

    #2
    Taggart, do you see any compile issues with this snippet used? Or would you see a runtime error from your script reported when it's added to the chart? Those could be found in the Control Center log tab.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Bertrand,

      Thanks for your reply. Yes, I'm having problems compiling.

      Comment


        #4
        Thanks, that snippet should compile fine. Are you sure the error mentioned is from the script you're currently editing?
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Yes, when I delete that snippet of code the compile errors disappear. Where is the best place to put that bit of code in the script? The compile error is "Namespace member declaration expected"

          Comment


            #6
            You would want to have it added in the OnBarUpdate() portion of your indicator, so it's called and updated on each bar as the chart gets populated with price / bar data.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              I got it to compile, but when I loaded it, Ninja crashed.

              Comment


                #8
                Would you mind contacting me via Help > Mail to Support with the cs attached so I could check into?
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  Ok, but now I can't even open Ninja. It crashes every time on start up. Is there another way to contact you directly?

                  Comment


                    #10
                    This would be happening as NT tries to restore the workspace containing the chart that calls your indicator with the issue. You can go to Documents > NinjaTrader 7 > Workspaces and remove the _Workspaces.xml file and restart NT - this should then not open any workspace at startup.
                    BertrandNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by wzgy0920, 04-20-2024, 06:09 PM
                    2 responses
                    26 views
                    0 likes
                    Last Post wzgy0920  
                    Started by wzgy0920, 02-22-2024, 01:11 AM
                    5 responses
                    32 views
                    0 likes
                    Last Post wzgy0920  
                    Started by wzgy0920, Yesterday, 09:53 PM
                    2 responses
                    49 views
                    0 likes
                    Last Post wzgy0920  
                    Started by Kensonprib, 04-28-2021, 10:11 AM
                    5 responses
                    191 views
                    0 likes
                    Last Post Hasadafa  
                    Started by GussJ, 03-04-2020, 03:11 PM
                    11 responses
                    3,230 views
                    0 likes
                    Last Post xiinteractive  
                    Working...
                    X