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
Can't set 2 entries in one set
Collapse
X
-
Hello esteban_rojo,
Perhaps. You may be able to set a bool to true when you are short/long 2 contracts. Then if that bool is true, if current position then becomes 1 contract, meaning one contract was sold, set another bool to true. If that bool is true, you could then start checking for your exit logic.
Please let us know if you need further assistance.
-
Thank you AlanP!
It works now.
I have another question.
Is it somehow possible to do the following in NT8 Strategy Builder?
After I bought 2 positions with different signal names I set a hard stop for both positions
Then I want to close one position with a profit target and the second one with an indicator and the "Exit" command.
In principle it is no problem to do that but I want to activate the indicator exit just after the profit target was triggered.
Is this possible? Maybe with a bool variable or something?
Or is there an option to say: do it after there is only one position left?
Thank you in advance!
Leave a comment:
-
Hello esteban_rojo,
Thank you for your note.
With the following two settings you should have no issue with the entry statements of your code.
EntriesPerDirection = 1;
EntryHandling = EntryHandling.UniqueEntries;
Please run the attached script on a 5 second ES chart. Are you seeing two entries?
To Import a NinjaScript into NinjaTrader 8 do the following:
From the Control Center window select Tools -> Import-> NinjaScript...
Find the file location.
I look forward to your reply.Attached Files
Leave a comment:
-
Can't set 2 entries in one set
Hi!
I try to set 2 entries at the same time in NT8 Strategy Builder but I can't manage it.
I have done it like in "Using multiple entry/exit signals simultaneously" and other online tutorials described, but had no success.
EntriesPerDirection=10
EntryHandling tried both settings
Here's the Code from Strategy Builder Set1:
// set 1
if (Times[0][0].TimeOfDay == EntryTime.TimeOfDay)
{
EnterShort(Convert.ToInt32(DefaultQuantity), @"Short1");
EnterShort(Convert.ToInt32(DefaultQuantity), @"Short2");
Is there something wrong?
Thank you!Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by judysamnt7, 03-13-2023, 09:11 AM
|
4 responses
57 views
0 likes
|
Last Post
by DynamicTest
Today, 08:25 PM
|
||
Started by ScottWalsh, Today, 06:52 PM
|
4 responses
36 views
0 likes
|
Last Post
by ScottWalsh
Today, 07:40 PM
|
||
Started by olisav57, Today, 07:39 PM
|
0 responses
7 views
0 likes
|
Last Post
by olisav57
Today, 07:39 PM
|
||
Started by trilliantrader, Today, 03:01 PM
|
2 responses
20 views
0 likes
|
Last Post
by helpwanted
Today, 07:25 PM
|
||
Started by cre8able, Today, 07:24 PM
|
0 responses
9 views
0 likes
|
Last Post
by cre8able
Today, 07:24 PM
|
Leave a comment: