Say I want to buy every pip decrease for the next 20 pips. What's the best way to handle this programmatically? Create a new name for the order at each level or is there a way to dynamically update the number of trades allowed in the same direction?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Multiple entries
Collapse
X
-
Multiple entries
I'm about to code a forex strategy that has a potentially unlimited number of orders. I'm wondering about the best way to organize and manage the trades.
Say I want to buy every pip decrease for the next 20 pips. What's the best way to handle this programmatically? Create a new name for the order at each level or is there a way to dynamically update the number of trades allowed in the same direction?Tags: None
-
Hello texasnomad,
EntriesPerDirection is not meant to be dynamic. You should set once in Initialize.
For this type of strategy, you can consider a couple different approaches.- Create a separate entry rule for each potential entry. EntryHandling would be set to unique entries and you would have a uniquely named rule for every entry you want. EntriesPerDirection is set to 1.
- Use one entry name, but change entry handling to all entries. You then control the number of entries allowed in a direction with EntriesPerDirection property.
Ryan M.NinjaTrader Customer Service
-
Ok. So I can set EntriesPerDirection to a really high value that I'll never use (e.g., 200) and then use my counter to loop through the open tickets. Will a value that high cause any problems if I start opening 100+ tickets?Originally posted by NinjaTrader_RyanM View PostHello texasnomad,
EntriesPerDirection is not meant to be dynamic. You should set once in Initialize.
For this type of strategy, you can consider a couple different approaches.- Create a separate entry rule for each potential entry. EntryHandling would be set to unique entries and you would have a uniquely named rule for every entry you want. EntriesPerDirection is set to 1.
- Use one entry name, but change entry handling to all entries. You then control the number of entries allowed in a direction with EntriesPerDirection property.
In both cases if you want to dynamically control the number of entries, then this should be handled with your own code. You can increase a counter at some point and run checks against this before executing the entry statements.
What type of object will I loop through? I don't see anything in the docs that lets me return a collection with each of my trade tickets for a given instrument.
Comment
-
Yes, that's one way to do it. You're then effectively managing this property on your own.
We can't really advise a specific implementation for you. You can work with various events related to orders through the IOrders interface. You could increase your counter when orders are filled, for example.
One of our members shared an order management system for unmanaged orders, and you may be able to get ideas there. This is posted here:
Ryan M.NinjaTrader Customer Service
Comment
-
Thanks for the link. I'll look that over in a few minutes.
I'll try making my own collection of iOrder objects and looping through those.
I appreciate the suggestions - very helpful.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
574 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
332 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 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
553 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment