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
time based order entry
Collapse
X
-
time based order entry
Hello. I'm currently working in Unmanaged framework. Based on various signals, the strategy generates buys or sells, and each order effectively has a stop and profit target associated with it. However, I would like to add a condition such that if after a given amount of time the stop or profit target hasn't been hit, then I close that particular trade. For example,suppose I buy one unit. If after 24 periods the stop or profit target hasn't been reached, then I would like to sell that unit. Does anyone have any examples of this?Tags: None
-
Hello stewarco,
Thank you for your note.
What you could do is save the current bar plus 24 to a variable when you enter a position, then later in the script check if the current bar is greater than that variable, and if so exit the position.
I’ve put together a snippet of how you could do this in the managed approach, to do this in the unmanaged approach you’d just swap the managed order methods with the unmanaged order methods.
Please let us know if you need further assistance.Alan P.NinjaTrader Customer Service
-
Originally posted by stewarco View PostHello. I'm currently working in Unmanaged framework. Based on various signals, the strategy generates buys or sells, and each order effectively has a stop and profit target associated with it. However, I would like to add a condition such that if after a given amount of time the stop or profit target hasn't been hit, then I close that particular trade. For example,suppose I buy one unit. If after 24 periods the stop or profit target hasn't been reached, then I would like to sell that unit. Does anyone have any examples of this?
ref: https://ninjatrader.com/support/help...yexecution.htm
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by pmachiraju, 11-01-2023, 04:46 AM
|
8 responses
147 views
0 likes
|
Last Post
by rehmans
Today, 06:44 PM
|
||
Started by mattbsea, Today, 05:44 PM
|
0 responses
5 views
0 likes
|
Last Post
by mattbsea
Today, 05:44 PM
|
||
Started by RideMe, 04-07-2024, 04:54 PM
|
6 responses
33 views
0 likes
|
Last Post
by RideMe
Today, 05:31 PM
|
||
Started by tkaboris, Today, 05:13 PM
|
0 responses
5 views
0 likes
|
Last Post
by tkaboris
Today, 05:13 PM
|
||
Started by GussJ, 03-04-2020, 03:11 PM
|
16 responses
3,282 views
0 likes
|
Last Post
by Leafcutter
Today, 04:14 PM
|
Comment