Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Show PnL next to Active Trade markers in Chart Trader

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

    Show PnL next to Active Trade markers in Chart Trader

    I'd like to know if it would be possible to update the Active Trade markers on the Chart Trader to show the PnL that would occur (based on current entry point and position size) at those points.
    I've attached a mockup to show what I mean.

    Here's the functionality I'd be after more specifically (forgive me for not knowing exactly what the different elements are actually called)

    1. On opening a trade with a Stop Loss and Take Profit, the PnL that would be achieved at those levels is represented as a currency amount directly attached to the active trade markers.
    2. If you were to re-position one of those markers by clicking and moving it on the chart, the PnL would update to reflect the new amount based on its new position.
    ----a. If possible, I'd love to have it dynamically update while dragging, just like it currently shows the number of ticks that you're adjusting the price by as you move it.
    3. If new contracts were added to the trade, the markers should update accordingly.

    I've searched the forums for a while and haven't found anything like this yet. Is anyone aware of any such solution that already exists?
    If not, would building an indicator like this, or modifying the current markers be possible?

    #2
    Hello,

    Thank you for your note.

    I suspect this version of our publicly available ATM Strategy identifier script may be of use. I've attached it below. fi you submit an ATM strategy order, when the entry fills the stop loss and profit target will display the current PnL that would be taken at those levels.

    Please let us know if we may be of further assistance to you.
    Attached Files
    Kate W.NinjaTrader Customer Service

    Comment


      #3

      The PnL is correct at each price level:



      Click image for larger version

Name:	Unreadable ATM Strategy identifier_1.jpg
Views:	2625
Size:	25.4 KB
ID:	1201259




      But the PnL is incorrect if moving all orders to the same price:

      Click image for larger version

Name:	Incorrect total ATM Strategy identifier_2.jpg
Views:	2520
Size:	14.5 KB
ID:	1201260

      If I may ask:


      Can the ATMStrategyIdentifire indicator be made to show the correct total PnL for all orders at that price ?


      Many thanks
      Last edited by dj22522; 05-13-2022, 10:24 AM.

      Comment


        #4
        NinjaTrader_Kate thanks for the response! I'll check that out. and dj22522 thanks for adding on the note about that PnL issue on moving the stops!

        Comment


          #5
          Hello NinjaTrader_Kate

          Can the indicator you posted above at #2 be improved on to correctly total orders when they're moved to the same price re: my post #3.

          Many thanks
          Last edited by dj22522; 05-26-2022, 12:53 AM.

          Comment


            #6
            Hello dj22522,

            Thank you for your reply.

            At the current time it's not designed to handle that. While we may make further improvements to the indicator available at some point, I cannot give any kind of ETA on when we may have the bandwidth to accomplish your request. I will note this for future improvements and will work on that as time allows.

            Please let us know if we may be of further assistance to you.
            Kate W.NinjaTrader Customer Service

            Comment


              #7
              @NinjaTrader_Kate

              Greetings! Please how can i add that to my chart trader??​
              Last edited by GBF_PAT; 01-04-2023, 02:01 PM.

              Comment


                #8
                Hello GBF_PAT,

                The script is an indicator. Download, import, then add the indicator to a chart in the Indicators window.

                To import a NinjaScript into NinjaTrader 8 do the following:
                1. Download the script to your desktop, keep it in the compressed .zip file.
                2. From the Control Center window select Tools -> Import -> NinjaScript...
                3. Click the Desktop icon on the left to navigate to the desktop
                4. Select the downloaded .zip file -> then click Open
                5. NinjaTrader will then confirm if the import has been successful.
                Critical *Note that on any files that say "File already exists on your PC" that start with an "@" symbol are the ones that came preloaded inside of NinjaTrader so you would say "No" so that you do not override those files.

                Below is a link to the help guide on importing NinjaScripts.
                https://ninjatrader.com/support/help...-us/import.htm
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Thank you support team!

                  Comment


                    #10
                    How do I change the currency symbol in the indicator? NinjaTrader_ChelseaB

                    Comment


                      #11
                      Hello Dejavu7629,

                      Welcome to the NinjaTrader forums!

                      The string currently uses "C" for currency.

                      atmDictionary.ElementAt(i).Value.Name + " PnL: " + possiblePnL.ToString("C")

                      You would need to change your windows regional settings to use a different currency symbol.
                      How can I change the default currency in Excel? In this tutorial we'll show you how to change the default currency format in Windows 10.


                      Or you could use a different string and just type in the symbol you want.
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        Hi NinjaTrader_ChelseaB,
                        This seems like a very good indicator!

                        Please add my vote to updating it to display the correct stoploss values.
                        Thanks

                        Comment


                          #13
                          Here is the code for stops that calculates for each distinct stop, and appends PnL correctly (even if stacked). You can replicate the same for Targets.
                          entry price is the avg price from the Positions instead of Orders.
                          ticksize is the pointvalue - order.Instrument.MasterInstrument.PointValue;

                          ----------------------------- code -------------------------
                          List<double> stopsList = new List<double>();
                          foreach (Order order in atmDictionary.ElementAt(i).Value.stops){
                          stopsList.AddRange(Enumerable.Repeat(order.StopPri ce, order.Quantity));

                          }

                          stopsList.ForEach(a => {possiblePnL = (a-entryPrice) * ticksize * stopsList.Where(b => b.Equals(a)).Count();

                          SharpDX.DirectWrite.TextLayout textLayout = new SharpDX.DirectWrite.TextLayout(NinjaTrader.Core.Gl obals.DirectWriteFactory,
                          possiblePnL.ToString("C"), textFormat, ChartPanel.X + ChartPanel.W,
                          textFormat.FontSize);
                          float x = (float)(ChartPanel.X + ChartPanel.W - offset);
                          float y = chartScale.GetYByValue(a) + textLayout.Metrics.Height/2;
                          SharpDX.Vector2 textPoint = new SharpDX.Vector2(x, y);
                          RenderTarget.DrawTextLayout(textPoint, textLayout, textBrushDx, SharpDX.Direct2D1.DrawTextOptions.NoSnap);
                          textLayout.Dispose();
                          });​
                          Click image for larger version  Name:	image.png Views:	0 Size:	54.6 KB ID:	1234652​​
                          Last edited by Adnoker; 02-08-2023, 04:01 PM.

                          Comment


                            #14
                            Hello Community,

                            I've made these modifications to show the PnL Sum for all quantities on stacked orders.

                            Uploaded to the User App Share.
                            This indicator serves to provide labels for Atm strategies that are present on your chart. Each new Atm strategy will rotate through the colors defined in your Brush Collection. Simply add to a chart, select the data series you want to have labels added to, choose your font and add all the brushes/colors you want [&#8230;]
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #15
                              NinjaTrader_ChelseaB and Adnoker

                              Thank you both for getting this done.

                              Two requests if I may:

                              1) Can there be an option to remove the ATM name. It interferes with the chart especially when additional ATM's are added.
                              (Or can you provide what script to alter in the code)

                              2) Can the PnL at each profit target and Stop be repositioned to be underneath the trade marker as per Adnokers chart example in post 13.




                              Again many thanks

                              Click image for larger version  Name:	Reposition PnL and delete ATM Name.jpg Views:	0 Size:	104.1 KB ID:	1234857
                              Last edited by dj22522; 02-12-2023, 06:45 PM.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by sidlercom80, 10-28-2023, 08:49 AM
                              172 responses
                              2,279 views
                              0 likes
                              Last Post sidlercom80  
                              Started by Irukandji, Yesterday, 02:53 AM
                              2 responses
                              17 views
                              0 likes
                              Last Post Irukandji  
                              Started by adeelshahzad, Today, 03:54 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post adeelshahzad  
                              Started by Barry Milan, Yesterday, 10:35 PM
                              3 responses
                              13 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by WeyldFalcon, 12-10-2020, 06:48 PM
                              14 responses
                              1,431 views
                              0 likes
                              Last Post Handclap0241  
                              Working...
                              X