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
Multiple Strategies on the same ticker/instrument
Collapse
X
-
Multiple Strategies on the same ticker/instrument
Hello, I use ninjatrader for automated equities trading with my TDA account. I am trying to figure out what is the best way to run multiple strategies on a single instrument such as SPY. So for example let use assume I have a trend strategy and a mean reversion strategy and I would like to have both strategies running on SPY. I do not want to combine the logic of both strategies as I also run them on different tickers as well. I also do not want to create a different account as that is not feasible for the amount of strategies I run. I do not care that the strategies are in sync with my account position and should work independently of one another. Considering you can only have 1 active strategy with IsAdoptAccountPositionAware, what would be the best way to run these strategies. I do not want to wait until flat and I dont want to submit any historical orders in the queue. I just want to activate each strategy and have it enter/exit based on the rules of the respective strategy without it effecting the other strategy or my existing account position for that ticker. Hope my question makes sense...Thank you in advance for any support.
-
Originally posted by proptradingshop View PostI do not care that the strategies are in sync with my account position
-- Assuming the same account ---
Strat #1 enters SPY via BUY 100 (AcctPos is LONG 100)
Strat #2 enters SPY via SELL 100 (AcctPos is FLAT)
...
... time passes, each strategy manages their own
... position, oblivious to all other running strategies
...
Strat #1 exits SPY via SELL 100 (AcctPos is SHORT 100)
Strat #2 exits SPY via BUY 100 (AcctPos is FLAT)
You really think the amount of profit made (or lost)
by Strat #1 and #2 will be accurately reflected
in your real live account?
Maintaining that accuracy is precisely what 'keeping
your strategies in sync with your account position'
means.
Could you explain your reasons why you would choose
to not care about that?
If choose to do this anyways, each strategy's
performance will be a lie -- your real account
will most likely not reflect what the combined
strategy performances say it should.
-
And that's just two strategies!
And you want advice on running multiple
strategies on the same instrument in the
same account?
The results will be unpredictable.
Your strategy performance will be unreliable.
Your real world PnL will be hard to follow.
You'll lose faith in your strategies.
The best advice is don't do it.
But if you insist on trying ... good luck!
Comment
-
Originally posted by bltdavid View PostThe best advice is don't do it.
Don't allow one or more strategies to run
in the same account where by LONG and
SHORT positions could be entered for the
same instrument at the same time.
-=o=-
Is there an relatively easy way around that?
Yes, if you restrict all running strategy
instances to only take LONG positions,
or just SHORT positions, then you'll be
fine.
So, to do this right, you would only need
two separate accounts, one account is
dedicated to LONG positions, and the
other account is dedicated to SHORT
positions.
Then let 'em rip ... and you'll be safe,
and each strategy's performance will
be reliable.
My point is:
The best advice is to use two accounts.
Comment
-
bltdavid I do not understand your intentions in spamming this post with unsolicited advice. I have been running these strategies for close to a decade on a separate platform with no issues and expected results. Some instruments I trade have over a dozen strategies running on them simultaneously. Think of different strategies that have filters for different market regimes and different time frames can have different market structures so they are traded accordingly. I appreciate your concern with my PnL but I am not looking for advice on whether my approach is to your liking. I am looking for guidance on how to setup a similar structure within NT. The examples you gave are my exact expected behavior and I expect my account position to not be in sync with the strategies position. How can I start multiple strategies on the same instrument without trying to have the strategies sync account position?Last edited by proptradingshop; 03-07-2024, 08:08 AM.
Comment
-
Hello proptradingshop,
While you cannot prevent the strategies start behavior beng run you can add a condition to prevent the strategies from trading historically to avoid it entering into any trades before realtime. You could combine that with Immediately submit which assumes both the account and strategy position are where you want them before it starts.
Code:if(State == State.Historical) return;
JesseNinjaTrader Customer Service
Comment
-
NinjaTrader_Jesse Thank you for the suggestions, this is exactly what I was looking for. Appreciate the support.
Comment
-
NinjaTrader_Jesse One other related question I have is how can I make it so exit on session close only closes strategy position and not full account position?
Comment
-
Hello proptradingshop,
The strategies exit on session close should only exit positions that the individual strategy has, if you are seeing something else happening I would likely suggest to disable that feature and use time conditions instead. A time condition can be used to restrict entries to certain times of day, the same can be done to exit the strategies individual position after a certain time of day. There is a sample of limiting a window of time here: https://ninjatrader.com/support/help...ightsub=totime
You can also find a sample of creating a custom exit on session close logic in the unmanaged sample here: https://forum.ninjatrader.com/forum/...elp#post770579
JesseNinjaTrader Customer Service
Comment
-
NinjaTrader_Jesse So today one of my strategies with exit on session close marked true took on an equity position of 5L when I already had 300L. At the end of the session it closed all 305 instead of the 5L that was entered by the strategy...is this not expected behavior?
Comment
-
Hello proptradingshop,
Without knowing the strategies virtual position at that time it would be hard to say why that may have happened if you have more than 1 strategy running. For your described use case and because that goes beyond how strategies are intended to operate I would suggest to avoid the strategy based features like ExitOnClose and instead use your own logic to control exiting. That would allow you to target the individual virtual position using its Position object and quantity.JesseNinjaTrader Customer Service
Comment
-
NinjaTrader_Jesse I only had 1 strategy running on the instrument. It was set to adopt account position...I am assuming this is the cause correct?
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Balage0922, Today, 07:38 AM
|
0 responses
5 views
0 likes
|
Last Post
by Balage0922
Today, 07:38 AM
|
||
Started by JoMoon2024, Today, 06:56 AM
|
0 responses
6 views
0 likes
|
Last Post
by JoMoon2024
Today, 06:56 AM
|
||
Started by Haiasi, 04-25-2024, 06:53 PM
|
2 responses
19 views
0 likes
|
Last Post
by Massinisa
Today, 05:32 AM
|
||
Started by Creamers, Today, 05:32 AM
|
0 responses
6 views
0 likes
|
Last Post
by Creamers
Today, 05:32 AM
|
||
Net Change
by Segwin
Started by Segwin, 05-07-2018, 02:15 PM
|
12 responses
1,786 views
0 likes
|
Last Post
by Leafcutter
Today, 05:30 AM
|
Comment