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
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
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
-
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 kempotrader, Today, 08:56 AM
|
0 responses
4 views
0 likes
|
Last Post
by kempotrader
Today, 08:56 AM
|
||
Started by kempotrader, Today, 08:54 AM
|
0 responses
3 views
0 likes
|
Last Post
by kempotrader
Today, 08:54 AM
|
||
Started by mmenigma, Today, 08:54 AM
|
0 responses
1 view
0 likes
|
Last Post
by mmenigma
Today, 08:54 AM
|
||
Started by halgo_boulder, Today, 08:44 AM
|
0 responses
1 view
0 likes
|
Last Post Today, 08:44 AM | ||
Started by drewski1980, Today, 08:24 AM
|
0 responses
3 views
0 likes
|
Last Post
by drewski1980
Today, 08:24 AM
|
Comment