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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
67 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
36 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
60 views
1 like
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
62 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
53 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment