Many thanks
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
Split order
Collapse
X
-
Split order
I would like to split an enter long order on 10 contracts into 10 enter long order on 1 contracts. Is there an easy way to do that in strategies?
Many thanks -
Hello paul.cabot,
So I can best answer your question, would you be able to provide more information?
Instead of submitting a buy order for 10 contracts you wish to submit 10 orders for 1 contract each when your buy condition becomes true?
I look forward to your reply.Alan P.NinjaTrader Customer Service
-
yes, exactly, I want to submit 10 orders for 1 contract each when your buy condition becomes true
This is to break the 10 contracts order into 10 smaller orders
Thanks
Comment
-
Hello paul.cabot,
To do this I sent EnteryHandling to Unique Entries and uniquely named 10 different EnterLong calls.
Please see EntryHandling section of our helpguide and import the attached sample.
Please let us know if you need further assistance.
.
To Import a NinjaScript into NinjaTrader 8 do the following:
From the Control Center window select Tools -> Import-> NinjaScript...
Find the file location.Attached FilesAlan P.NinjaTrader Customer Service
Comment
-
Yes, use a loop. The 'order object' is no different than before.
To submit an order with a random quantity Y between 1 and 4 until X contracts
have been submitted, you first need a way to get a random number,
Code:private static Random MyRand = new Random(DateTime.Now.Millisecond);
Code:private void EnterOrder(int Direction, int totalQuantity) { int orderNum = 1; while (totalQuantity > 0) { int quantity = Math.Min(MyRand.Next(1, 4), totalQuantity); if (Direction > 0) EnterLong(quantity, "L"+orderNum); else if (Direction < 0) EnterShort(quantity, "S"+orderNum); totalQuantity = totalQuantity - quantity; ++orderNum; } }
Code:private const int SHORT = -1; private const int NONE = 0; private const int LONG = 1;
Code:EnterOrder(LONG, 10);
- Likes 1
Comment
-
-
Hello elliot5,
The above information was specifically for the Managed approach and does not specify any targets. In this specific case the Signal Name of each entry could be used for the targets because that is how the managed appraoch associates Entries with Targets.
For unmanaged you would instead submit the targets yourself. There is a sample of an unmanaged strategy which submits targets as OCO in the following link, that would be the suggested approach at unmanaged targets. https://ninjatrader.com/support/foru...elp#post770579
Please let me know if I may be of additional assistance.JesseNinjaTrader Customer Service
- Likes 1
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by ninza33, Today, 09:10 AM
|
1 response
10 views
0 likes
|
Last Post Today, 09:46 AM | ||
Started by goodknight777, Today, 08:43 AM
|
1 response
5 views
0 likes
|
Last Post Today, 09:25 AM | ||
Started by kramnor2001, Yesterday, 02:30 PM
|
3 responses
21 views
0 likes
|
Last Post
by kramnor2001
Today, 09:20 AM
|
||
Started by Padan, Today, 02:02 AM
|
3 responses
11 views
0 likes
|
Last Post Today, 08:54 AM | ||
Started by Tim-c, Today, 08:36 AM
|
1 response
3 views
0 likes
|
Last Post Today, 08:45 AM |
Comment