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

Programming ETD

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

    Programming ETD

    Hello - ETD is a good calculation to view on trade results, Im curious if that data is kept on a trade by trade basis and can the stat be used in programming an exit on a strategy.

    Example if on close ETD exceeds 4% exit position

    Please advise, thank you

    #2
    Yes, you could access the strategy statistics in the Performance class for example - http://www.ninjatrader-support.com/H...luesClass.html
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Perfect thank you

      Comment


        #4
        In working with your link, it appears ETD is only an average value calculated on all trades. Is there any way to use ETD on a trade by trade basis?

        Thank you

        Comment


          #5
          Correct, it would give you access to the statistics of the complete strategy performance. You could apply custom code to record the change in the ETD on a trade by trade basis.
          BertrandNinjaTrader Customer Service

          Comment


            #6
            Understood - but can you work with ETD on a backtested basis bar by bar (or tick by tick) or would you have to measure ETD once the trade is closed?

            Comment


              #7
              The trade performance class only provides information related to completed trades.

              You should be able to manually calculate any values for the trade in progress. You can track:
              MAX(High, BarsSinceEntry())[0] compared to exit price, for example.
              Last edited by NinjaTrader_RyanM1; 12-02-2010, 10:53 AM.
              Ryan M.NinjaTrader Customer Service

              Comment


                #8
                Thanks Ryan - I attempted to use the sample code you provided

                MAX(High, BarsSinceEntry())

                but Ninja doesnt seem to like the arrangment of the arguments. (exact error code reads The best overloaded method match for 'NinjaTrader.Strategy.Strategy.MAX(NinjaTrader.Dat a.IDataSeries.int)'has some invalid arguments)

                Any additional samples or educational material on C# you could point me to on building this logic would be helpful. Thank you

                Comment


                  #9
                  Thanks for the follow up, titleistbb22.

                  Here is an accurate example:
                  double highSinceEntry = MAX(High, BarsSinceEntry())[0];

                  Using the condition builder is a good way to get syntax for these functions. You're not able to specify this exact condition but is useful for getting the order of parentheses and brackets.
                  Ryan M.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by samish18, Today, 10:13 AM
                  0 responses
                  2 views
                  0 likes
                  Last Post samish18  
                  Started by kenz987, Yesterday, 10:20 AM
                  2 responses
                  12 views
                  0 likes
                  Last Post kenz987
                  by kenz987
                   
                  Started by nicthe, 08-23-2023, 07:53 AM
                  7 responses
                  196 views
                  0 likes
                  Last Post nicthe
                  by nicthe
                   
                  Started by nicthe, Today, 09:24 AM
                  0 responses
                  5 views
                  0 likes
                  Last Post nicthe
                  by nicthe
                   
                  Started by stalt, 12-28-2015, 01:36 PM
                  6 responses
                  1,536 views
                  0 likes
                  Last Post giulyko00  
                  Working...
                  X