NT7
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Including Indicator's UserDefinedMethods in Strategies
Collapse
X
-
Including Indicator's UserDefinedMethods in Strategies
Right now, I have to replicate the functions in my indicator UserDefinedMethods into Strategy UserDefinedMethods. Is there a way to directly reference Indicator's UserDefinedMethods from strategies? Tnx.
NT7Tags: None
-
It depends how well you know C# programming.
Study bin/Custom/Strategy/@Strategy.cs very carefully.
(Hint: Can you understand the significance of the "LeadIndicator" property?)
Try adding this code to your strategy file,
Then add this "HelloWorld" code to your bin/Custom/Indicator/UserDefinedMethods.cs file,Code:private Indicator.Indicator myfuncs = null; protected override void OnStartUp() { myfuncs = (Indicator.Indicator)LeadIndicator; myfuncs.HelloWorld(); }
Open an OutputWindow and run your strategy.Code:public void HelloWorld() { Print("Hello World"); }
Enjoy!
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
23 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
115 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
68 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
222 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
406 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|

Comment