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
Mutiple entries not working in strategy develpment
Collapse
X
-
Hello Chelsea,
Find below the strategy code as an attachment.
The idea behind having two entries is to have a profit target for one and let the other run - hence the ATRTarget1 variable..
Of course I have not been able to implement the idea as only one entry was executed.
Rgrds
Ioannis
-
Hello Ioannis,
With UniqueEntries I would expect both orders (also this only prevents a new order after the position is taken).
May I test the script?
To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:- Click Tools -> Export -> NinjaScript...
- Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
- Click the 'Export' button
- Enter a unique name for the file in the value for 'File name:'
- Choose a save location -> click Save
- Click OK to clear the export location message
- (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
Once exported, please attach the file as an attachment to your reply.
Leave a comment:
-
Mutiple entries not working in strategy develpment
Hi all,
I am trying to create a strategy using the ATR Trailing indicator found here https://ninjatraderecosystem.com/use...d/atrtrailing/
my code is as follows
---------------------
protected override void OnBarUpdate()
{
if (CurrentBar < ATRPeriod) return;
if (( IsFlat || IsLong ) && ( Low[0] > _atrTrail.Lower[0] ) && _atrTrail.Upper[0] != 0)
{
this.EnterShortStopMarket(lots, _atrTrail.Upper[0], "Short 1");
this.EnterShortStopMarket(lots, _atrTrail.Upper[0], "Short 2");
}
if ( (IsFlat || IsShort) && (High[0] < _atrTrail.Lower[0] ) && _atrTrail.Lower[0] != 0 )
{
EnterLongStopMarket(lots, _atrTrail.Lower[0], "Long 1");
EnterLongStopMarket(lots, _atrTrail.Lower[0], "Long 2");
}
}
------------------------
For some reason the 2nd order is only submitted in short direction and only once
All orders thereafter are only Long 1 and Short 1
I have
EntriesPerDirection = 1;
EntryHandling = EntryHandling.UniqueEntries;
The idea is to use some form of profit target for one order and use a protective trailing stop for the 2nd one
Any help is greatly appreciated.
Ioannis
1 PhotoTags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by MGHORBEL, Today, 02:28 AM
|
0 responses
1 view
0 likes
|
Last Post
by MGHORBEL
Today, 02:28 AM
|
||
Started by dcriador, Today, 01:43 AM
|
1 response
5 views
0 likes
|
Last Post
by dcriador
Today, 01:46 AM
|
||
Started by louiseruch, Today, 01:11 AM
|
0 responses
1 view
0 likes
|
Last Post
by louiseruch
Today, 01:11 AM
|
||
Started by kujista, Today, 12:39 AM
|
0 responses
6 views
0 likes
|
Last Post
by kujista
Today, 12:39 AM
|
||
Started by tonynt, 05-21-2019, 06:27 AM
|
11 responses
536 views
1 like
|
Last Post Today, 12:37 AM |
Leave a comment: