Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exposing Indicator Values during Backtesting

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

    Exposing Indicator Values during Backtesting

    Hi,

    I'm wondering if there is a better way to do this. During strategy development and backtesting, I'll want to see what 1 or more indicator values are at the time of trade entry. The only way I know how to capture this value is to send the value to text and use it as the trade entry name. Then when backtesting, I can export all the trades to excel. But this is cumbersome. Is there a better way?

    Thanks,

    Rich

    #2
    Hello Rich,
    Thanks for writing in and I am happy to assist you.

    To expose an indicator value which is not a plot/dataseries, please refer to this reference sample code http://ninjatrader.com/support/forum...ead.php?t=4991

    You can also use a static to store the values but these are more C# concepts and beyond what we could support. http://msdn.microsoft.com/en-us/libr...(v=vs.71).aspx

    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Ummm...I'm not sure you understood my question, or I didn't understand your answer. It appears that you gave me references on how to expose strategies or indicators to other strategies. I'm talking about being able to look at trade data and having the indicator value at the time of entry as a field in the trade record. Since there is no default way to add fields to trade records, I was wondering if there was a way to add these fields inside the script, so that it would be added to the backtesting trade record.

      Rich

      Comment


        #4
        Hello Rich,
        You can use a static to store the value of the trades and can call it as and when required instead of writing the values in an excel file.

        For example

        Code:
        partial class Strategy //look for the UserDefinedMethod.cs file
        {
        	public static List<IOrder> MyData = new List<IOrder>(); 
        }

        you can assign the value to MyData from your strategy.

        Code:
        if (condition)
        {
            IOrder ord = EnterLong();
            NinjaTrader.Strategy.Strategy.MyData.Add(ord);
        }

        You can access the data, simply by calling
        Code:
        if (NinjaTrader.Strategy.Strategy.MyData.Count > 0)
        {
          //do something
        }


        It is more of a C# concept and unfortunately we could support very little of it.

        Please let me know if I can assist you any further.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          My purpose for doing this is not to call these indicator values in the future by the strategy, but instead to analyze them myself in excel. I would then make code changes based on my analysis. It sounds like this is not possible.

          Comment


            #6
            Hello Rich,
            Unfortunately it is not possible. You have to custom code it and write the values of the indicators to the excel file.

            Please let me know if I can assist you any further.
            JoydeepNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            647 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            369 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            108 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            572 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            573 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X