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 SalmaTrader, 07-07-2026, 10:26 PM
|
0 responses
50 views
0 likes
|
Last Post
by SalmaTrader
07-07-2026, 10:26 PM
|
||
|
Started by CarlTrading, 07-05-2026, 01:16 PM
|
0 responses
22 views
0 likes
|
Last Post
by CarlTrading
07-05-2026, 01:16 PM
|
||
|
Started by CaptainJack, 06-17-2026, 10:32 AM
|
0 responses
16 views
0 likes
|
Last Post
by CaptainJack
06-17-2026, 10:32 AM
|
||
|
Started by kinfxhk, 06-17-2026, 04:15 AM
|
0 responses
22 views
0 likes
|
Last Post
by kinfxhk
06-17-2026, 04:15 AM
|
||
|
Started by kinfxhk, 06-17-2026, 04:06 AM
|
0 responses
23 views
0 likes
|
Last Post
by kinfxhk
06-17-2026, 04:06 AM
|

Comment