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

How do I add equity curve and pnl of a strategy on a chart?

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

    How do I add equity curve and pnl of a strategy on a chart?

    I want to add equity curve to the chart of a strategy using the strategy builder...also I want to add the pnl of the strategy on the chart

    #2
    Hello rickyblah12,

    What are you defining as the equity curve?

    Are you wanting some custom math and rendering?

    The RealizedPnL can be the string added to a draw text fixed object.

    Attached is a screenshot.
    Attached Files
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      yes....thank you....can you help me understand strings and hows it work and what it could be used for

      Comment


        #4
        Hello rickyblah12,

        A string is a collection of characters. Like a sentence.

        "Hello world" <- this is a string. If the string is printed, the output would be Hello world.

        Strings are used for messages, names, and labels.

        The text from this entire post could be saved as a string.

        Below is a public link to a 3rd party educational site on strings.
        C# - Strings - In C#, you can use strings as array of characters, However, more common practice is to use the string keyword to declare a string variable. The string keyword is an alias for the System.String class.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          ok thank you...do I put that as a set by itself after the strategy is there already?

          Comment


            #6
            Hello rickyblah12,

            I'm not quite sure I am understanding your inquiry.

            Can you further clarify what you are asking?

            Draw.TextFixed() would be called when you want to draw text on the chart such as the RealizedPnL value.
            This could be in OnBarUpdate() or OnPositionChanged() or OnOrderUpdate() / OnExecution()..

            Below is a link to the help guide on Draw.TextFixed().
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Chelsea what I mean is if...set 1 is how you showed me....set 2 is my long strategy and set 3 is my short strategy....would it show n update like that?

              Comment


                #8
                Hello rickyblah12,

                Yes, that would be fine. A heads up, orders take time to fill so any actions that happened like updates to the PnL would show on the next bar update.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  ok Chelsea thank you is there a way I can edit the color of the pnl text?

                  Comment


                    #10
                    Hello rickyblah12,

                    Not with the strategy builder. If you unlock the script you can manually code using the overload that allows for a brush.

                    Draw.TextFixed(NinjaScriptBase owner, string tag, string text, TextPosition textPosition, Brush textBrush, SimpleFont font, Brush outlineBrush, Brush areaBrush, int areaOpacity)

                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      ok thank you...how do I make horizontal line like this that corresponds with the equity curve of a strategy

                      Comment


                        #12
                        Hello rickyblah12,

                        A horizontal line can be drawn with Draw.HorizontalLine(). The y parameter is the price the line will be drawn at.

                        Below is a link to the help guide.
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          ok...how come when I add the realized pnl to show the historical profit and I add the unrelealized profit on the bottom right corner it doesnt show me both at the same time ? either one or the other

                          Comment


                            #14
                            Hello rickyblah12,

                            If you are drawing two objects, these will need to have different unique tag names.

                            What tag names are you using for the drawing objects?

                            Also, you would likely want to draw these in different areas so they are not drawn on top of each other.
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #15
                              i did bottom right and bottom left does that count as 2 different areas?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by suroot, 04-10-2017, 02:18 AM
                              4 responses
                              3,021 views
                              0 likes
                              Last Post truepenny  
                              Started by Stanfillirenfro, Today, 07:23 AM
                              1 response
                              6 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by cmtjoancolmenero, Yesterday, 03:58 PM
                              2 responses
                              22 views
                              0 likes
                              Last Post cmtjoancolmenero  
                              Started by olisav57, Yesterday, 07:39 PM
                              1 response
                              9 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by cocoescala, 10-12-2018, 11:02 PM
                              7 responses
                              944 views
                              0 likes
                              Last Post Jquiroz1975  
                              Working...
                              X