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

Help with an Efficiency Indicator

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

    #16
    Hello Kaiviti57,

    To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
    1. Click Tools -> Export -> NinjaScript...
    2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
    3. Click the 'Export' button
    4. Enter a unique name for the file in the value for 'File name:'
    5. Choose a save location -> click Save
    6. Click OK to clear the export location message
    (Do not check the 'Export as compiled assembly' as this will export a dll that hides the code.)

    By default your exported file will be in the following location:
    • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
    Below is a link to the help guide on Exporting NinjaScripts.
    http://ninjatrader.com/support/helpG...-us/export.htm


    To draw text under a candle use the DrawText() method.



    The script you have provided appears to be plotting values. What is the issue you are having?

    Attached Files
    Chelsea B.NinjaTrader Customer Service

    Comment


      #17
      Hi Chelsea. Not sure what happened to my last post. It seems to have disappeared. I have also been away for a few days. I will respond to you later tomorrow my time - which is a fair bit different to you, I think.

      Comment


        #18
        I am trying to plot a message on the chart to show how efficient the currently forming candle is compared to the previous candle. It needs to show the result as a ratio and it needs to be updated every time there is new data. The indicator I sent to you doesn't seem to be calculating correctly and it is plotting the results as a graph. This graph also does not update with the current candle. Maybe you could point me in the direction of a tutorial that shows how to plot a value on the chart or, a bit of help in writing the script.

        Comment


          #19
          Hello Kaiviti57,

          Use CalculateOnBarClose as false for an indicator to update when the price changes or on each received tick instead of waiting for the bar to close.
          https://www.youtube.com/watch?v=FmBi...youtu.be&t=370

          Your script is adding a plot as a line.
          Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "Plot0"));

          Do you want this in a text box instead?
          Do you want this as a bar plot?
          What do you want to see?
          Chelsea B.NinjaTrader Customer Service

          Comment


            #20
            Hi Chelsea. I want to plot the result on the price chart, in the middle and in the bottom area. I want the result to be the ratio of the currently forming bar to the last closed bar. The words of the result should look something like this "Efficiency = 4.3". This would mean that the current candle is 4.3 times more efficient than the previous candle.

            Comment


              #21
              Hello Kaiviti57,

              So you want words, which means text.

              (edited for NT7 links)

              Text can be drawn in a fixed place on the chart with Draw.TextFixed().


              Or text can be drawn in relation to a bar with Draw.Text().


              You can use whatever calculation you would like. The string text will be where the value usually set to the plot series will be supplied.
              Last edited by NinjaTrader_ChelseaB; 08-30-2020, 10:52 PM.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #22
                Hi Chelsea, I think a bit of additional clarification is required. I am using NinjaTrader 7. Your references are to version 8. They may be the same but I am not sure yet.

                And yes, I want text but, it also going to have a double (the calculated result). I can have the result in several places and I understand that there are several methods to achieve this. I need the result to be obvious to the user and thinking about this, the bottom center as I mentioned before, is not the best place. Below the currently forming bar would be the next best but, other chart objects can obscure this. I now think the best place would be in the white space to the right of the price plots.

                Comment


                  #23
                  Hello Kaiviti57,

                  Apologies, I overlooked the section of the forums. I've modified my post with NinjaTrader 7 help guide links.

                  You can use your double .ToString() to add the value to the text.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #24
                    Hi Chelsea,
                    I have made great progress with my indicator and I have learned a lot of stuff - still a great deal more to learn though. My indicator now plots a chart. I initially have problems in placing the text in a suitable place but then I found out about using /n to add lines. So, I can now place the results in a clear area. This is the code I used:

                    DrawTextFixed("eff","\n\n\nEfficiency = "+ratio.ToString(),TextPosition.TopRight,Color .Blu e, new Font("Arial", 14f), Color.Empty, Color.Empty, 10);

                    I am still searching for a way to plot the results in another area, such as the top middle of the chart and a few lines down; or, the bottom middle; or somewhere in the right side margin. Can you please point me in the right direction to do this?

                    I have a very serious problem that I cannot resolve. The indicator works well if I am using live data but nothing shows if I am using Historical date older than a few days. It also completely disappears from the selected list of indicators. I have to reload it again. Can you please explain why this indicator will not work properly in Market Replay and why it repeatedly disappears from my selected indicators list?

                    My current indicator is attached.
                    Attached Files

                    Comment


                      #25
                      Hello Kaiviti57,

                      Unforunately, TopMiddle, BottomMiddle are not options for the TextPosition.

                      TextPosition.Center would be the closest available.

                      In NinjaTrader 8 it would be possible to custom render text anywhere on the chart including the top middle or bottom middle.


                      With the script not appearing in the list, are you seeing error messages on the Log tab of the Control Center? If so, what do these say?

                      Are you expecting multiple objects? Use unique tag names for multiple objects.
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #26
                        Hi Chelsea,

                        I am using version 7. Is there a way to programmatically place the text at defined positions on the chart?

                        I never looked at the log when I was encountering the problem with the indicator not showing. Now I am trying to duplicate the error so that I can check the log However, it is working OK. I will keep an eye on it report back when I next come across the problem.

                        Comment


                          #27
                          Hello Kaiviti57,

                          With NinjaTrader 7 and DrawTextFixed() the options are TextPosition.BottomLeft, TextPosition.BottomRight, TextPosition.Center, TextPosition.TopLeft, and TextPosition.TopRight as written in the help guide I have previously linked.

                          Chelsea B.NinjaTrader Customer Service

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Brevo, Today, 01:45 AM
                          0 responses
                          2 views
                          0 likes
                          Last Post Brevo
                          by Brevo
                           
                          Started by aussugardefender, Today, 01:07 AM
                          0 responses
                          3 views
                          0 likes
                          Last Post aussugardefender  
                          Started by pvincent, 06-23-2022, 12:53 PM
                          14 responses
                          238 views
                          0 likes
                          Last Post Nyman
                          by Nyman
                           
                          Started by TraderG23, 12-08-2023, 07:56 AM
                          9 responses
                          384 views
                          1 like
                          Last Post Gavini
                          by Gavini
                           
                          Started by oviejo, Today, 12:28 AM
                          0 responses
                          4 views
                          0 likes
                          Last Post oviejo
                          by oviejo
                           
                          Working...
                          X