i basically want to code a button that enters into a position when i click it using the Click even.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
submit orders from a custom class methods
Collapse
X
-
Hello savekad,
Custom classes are something that we cannot support, but with that said you may view the following strategy that creates a Long and Short button button that you may use as a reference.
To Import
1. Download the file to your desktop
2. From the Control Center window select the menu File > Utilities > Import NinjaScript
3. Select the downloaded fileJCNinjaTrader Customer Service
-
Hello savekad,
Unfortunatley we do not have a sample code in these lines however you can try something like below
and you can call the class from your strategy asCode:private class InnerClass { Strategy s; public InnerClass(Strategy s) { this.s = s; } public void GoLong() { s.EnterLong(); } }
Code:InnerClass ic = new InnerClass(this); ic.GoLong();
JoydeepNinjaTrader Customer Service
Comment
-
the thing is that EnterLong() is an unknown method to my custom class...Originally posted by NinjaTrader_Joydeep View PostHello savekad,
Unfortunatley we do not have a sample code in these lines however you can try something like below
and you can call the class from your strategy asCode:private class InnerClass { Strategy s; public InnerClass(Strategy s) { this.s = s; } public void GoLong() { s.EnterLong(); [COLOR=Red][B]// unknown to InnerClass[/B][/COLOR] } }
Code:InnerClass ic = new InnerClass(this); ic.GoLong();
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
650 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
370 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
109 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
574 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
577 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment