Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using Initialize Function Manually

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

    Using Initialize Function Manually

    Hello Support,

    I am developing a solution as an indicator, that requires me to take several inputs from the user from another application. Now, one of those inputs is the instruments that the indicator needs.

    Now, as you know that we can only add instruments to an indicator (or a strategy for that matter) only in the Initialize method. So, i need to be able to get the inputs from the user (which i have all figured out) and then initialize the indicator using those inputs and adding the required instruments.

    Now, i have been trying out different solutions, one that seems plausible is that i explicitly call the Initialize method once the user is done with entering the inputs. So there would be something like this in my OnBarUpdate method:

    Code:
    protected override void OnBarUpdate()
            {
    			if(DataReceived)
    			{
    				//Set a data structure to hold the input data
    				Initialize();
    			}
            }
    This works as per the initial tests i have done. What i need to confirm from you guys (the NT developer team in specific) is whether this would cause any specific problems? If so then what should i expect?

    I would very much appreciate a quick response on this. Hoping to hear from you soon.

    Thanks
    Umer

    #2
    Update:

    I just tried a very simple test, and it turns out that i can not call the Add method, from inside the call hierarchy of the OnBarMethod.

    Now, my question would be whether there is a way to do what i want to achieve? Any suggestions from you guys?

    Comment


      #3
      Hello Umer,

      Thank you for your post.

      If you are using Add() methods in the Initialize, then when you have OnBarUpdate called you can run into errors saying that you can only call Add() in the initialize. This would be expected and would 'break' your code.

      If you are wanting to add these data series in a 'later' time then you would want to take a look at the Pivots indicator as a good starting point.

      Let me know if I can be of further assistance.
      Cal H.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      597 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      343 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      103 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      556 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      555 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X