Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

get mfe of open position

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

    get mfe of open position

    Hi,
    Is there a way to script this?
    thanks

    #2
    Hello trader3000a,

    You would have to come up with your own math for that for an open position. MFE is calculated on paired trades and is only part of the trade statistics which require a Trade meaning a entry + exit.




    If there is some math equation that you have found which equates to the MFE of a unpaired trade you could certainly use C#'s math functions to do that.


    Comment


      #3
      Hi,
      Ok, what's the most succinct way of asking for the highest high or lowest low since a trade has been in progress? BarsInProgress...since execution....??
      thanks,
      David

      Comment


        #4
        Hello trader3000a,


        If its a filled entry you can use BarsSinceEntryExecutionto find that number, you would otherwise need to store the bar number when you submit the order so you can later find a BarsAgo buy subtracting that from the CurrentBar.

        https://ninjatrader.com/support/help...hlightsub=bars sinceentry

        ​​​​
        If you know the BarsAgo of the trade submission or execution you can use that as a lookback period for HighestBar or LowestBar





        Comment


          #5
          nice. that'll do it

          Comment


            #6
            is there a way to get an entry execution's bar# from within an indicator?

            Comment


              #7
              Hello trader3000a,

              Indicators are not associated with your strategy for trading so they would have no specific access to any of the strategy related properties. If you needed an indicator to know about that information you would have to make a user input for the indicator and then supply that information to the indicator when you call it in the strategies code.

              Comment


                #8
                Hi Jesse,
                Thanks for your reply. I want an indicator that will display a dollar value in drawdown from a live trade's mfe. I'm not sure that's possible with my user-end tools. Perhaps we can put it in as a request for your dev team?
                thanks,
                David

                Comment


                  #9
                  Hello trader3000a,

                  Your strategy would need to call that indicator in its code and use AddChartIndicator to display the indicator on the chart. If the indicator needs to display a value from the strategy you would need to pass the value to the indicator when you call it from the strategy.

                  Comment


                    #10
                    Hi Jesse,
                    I know i can generate the value in a ninjascript strategy. I'm saying I want to have the indicator as a stand-alone.
                    thanks,
                    David

                    Comment


                      #11
                      Hello trader3000a,

                      A standalone indicator has no reference to your strategy, your strategy needs to use AddChartIndicator if you wanted the indicator to get strategy information passed to it. Manually adding indicators that a strategy is involved with would be bad practice, you should instead use AddChartIndicator any time you need to associate an indicator with a strategy.

                      Comment


                        #12
                        Hi Jesse,
                        I'm no longer talking about a strategy. I'm talking about live discretionary trades. An indicator that tracks mfe against the live trade.
                        thanks,
                        David

                        Comment


                          #13
                          Hello trader3000a,

                          You can use the addon framework to observe manual orders however there is no bar number associated with that information, you are just looking at the raw execution information in that case. You can read about the addon framework in the help guide: https://ninjatrader.com/support/help...ount_class.htm

                          If your questions no longer involve strategies I would suggest to stop posting in this strategy thread and create a separate question in the indicator or general development forums.

                          Comment


                            #14
                            Hi Jesse,
                            Ok, great, thanks for the advice
                            David

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by NullPointStrategies, Today, 05:17 AM
                            0 responses
                            53 views
                            0 likes
                            Last Post NullPointStrategies  
                            Started by argusthome, 03-08-2026, 10:06 AM
                            0 responses
                            130 views
                            0 likes
                            Last Post argusthome  
                            Started by NabilKhattabi, 03-06-2026, 11:18 AM
                            0 responses
                            70 views
                            0 likes
                            Last Post NabilKhattabi  
                            Started by Deep42, 03-06-2026, 12:28 AM
                            0 responses
                            44 views
                            0 likes
                            Last Post Deep42
                            by Deep42
                             
                            Started by TheRealMorford, 03-05-2026, 06:15 PM
                            0 responses
                            49 views
                            0 likes
                            Last Post TheRealMorford  
                            Working...
                            X