Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Selling A Percentage Of Current Size
Collapse
X
-
Selling A Percentage Of Current Size
Is there a way to scale out of your position based on a percentage of your current lot size? For example if I have 10 contracts and I want to sell 50% or 25% of my current size, I would want to program it to a couple hotkeys. Same applies for trading equities, maybe hotkeys to sell on the ask (get the best price possible) and also sell on the bid (pretty much flatten your position).Tags: None
-
Hello paravie,
Orders submitted through NinjaScript do allow the quantity to be set and you can find the current account position size.
This is posted in the addon section of the forums so I would assume this is an addon in it's own window and not an indicator or strategy applied to a chart.
The Account position size can be found with the found <Account>.Positions collection.
Order would be submitted with <Account>.CreateOrder() and .Submit().
Below is a link to an example addon that submits an order.
Setting up a hotkey would involve capturing keypresses on the window or the tab UIElement.
I am not aware of an example of an addon using PreviewKeyDown I can share, but I can provide an indicator that uses PreviewKeyDown meant for a chart.
Chelsea B.NinjaTrader Customer Service
-
Hello paravie,
This would be considered advanced. I would recommend starting by learning how to program.
Below is a link to a forum post with helpful information about learning C# programming.
The links I have provided are to examples. These are working scripts.
Unfortunately, in the support department at NinjaTrader it is against our policy to create, debug, or modify, code or logic for our clients. Further, we do not provide C# programming education services or one on one educational support over the phone in our NinjaScript Support department. This is so that we can maintain a high level of service for all of our clients as well as our partners.
That said, through email we are happy to answer any questions you may have about NinjaScript if you decide to code this yourself. We are also happy to assist with finding resources in our help guide as well as simple examples, and we are happy to assist with guiding you through the debugging process to assist you with understanding unexpected behavior.
You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our NinjaTrader Ecosystem team follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
627 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
359 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
105 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
562 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
568 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

. I am new to ninjatrader and am not sure how to script (0 clue), could you by any chance help write a basic template to edit how exactly the logic will work?
Comment