Thanks in advance.
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
Exit and entry in the same bar
Collapse
X
-
Exit and entry in the same bar
I have a strategy that can exit from de actual position and send a new order in the same bar for a new trader (or close a position and send a entry order in de the same bar). For example, there is a long position openned and it's necesary to close this position and then to send a StopOrder for a new posibility. I know the property "Entries per direction" but it is only for entries and I need to close a position and to send a order for new trade in the same bar. How can I do it?
Thanks in advance.Tags: None
-
Originally posted by soyjesus View PostI have a strategy that can exit from de actual position and send a new order in the same bar for a new trader (or close a position and send a entry order in de the same bar). For example, there is a long position openned and it's necesary to close this position and then to send a StopOrder for a new posibility. I know the property "Entries per direction" but it is only for entries and I need to close a position and to send a order for new trade in the same bar. How can I do it?
Thanks in advance.
There are a few ways.- Use OnBarUpdate() to set flags for what your entry condtion should be, then use OnMarketData() to place the orders, depending on the value of the flags. That means, of course, that you cannot backtest or optimize, unless you do it manually using Market Replay.
- Use COBC = false.
- Use a multi-timeframe setup, and make orders using the barSeries with finer granularity.
-
Koganam,
thank you very much for your help!
But as you write the first 2 methods are more cpu-intensive, therefore I use the COBC=true.
With the multidataseries I know I have 5 add(...) I would understand but this is not how I have to do it.
Do you know how one can do in the script so that the "flat-condition" is in OnExecution but this work "together" with OnBarUpdate-conditions? Maybe to put all conditions to OnExecution? Or how to refer from one to other? "Conditions in onbarupdate and flat in onexecution, then do...."
Thank you
Tony
Originally posted by koganam View PostThere are a few ways.- Use OnBarUpdate() to set flags for what your entry condtion should be, then use OnMarketData() to place the orders, depending on the value of the flags. That means, of course, that you cannot backtest or optimize, unless you do it manually using Market Replay.
- Use COBC = false.
- Use a multi-timeframe setup, and make orders using the barSeries with finer granularity.
Just remember that the first 2 methods will be pretty processor-intensive, as they are going to be processing every tick that comes in, instead of just once per bar.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by bortz, 11-06-2023, 08:04 AM
|
47 responses
1,606 views
0 likes
|
Last Post
by aligator
Today, 07:22 PM
|
||
Started by jaybedreamin, Today, 05:56 PM
|
0 responses
8 views
0 likes
|
Last Post
by jaybedreamin
Today, 05:56 PM
|
||
Started by DJ888, 04-16-2024, 06:09 PM
|
6 responses
18 views
0 likes
|
Last Post
by DJ888
Today, 05:12 PM
|
||
Started by Jon17, Today, 04:33 PM
|
0 responses
4 views
0 likes
|
Last Post
by Jon17
Today, 04:33 PM
|
||
Started by Javierw.ok, Today, 04:12 PM
|
0 responses
13 views
0 likes
|
Last Post
by Javierw.ok
Today, 04:12 PM
|
Comment