View Full Version : Market Position for a particular instrument
daven
10-07-2010, 09:31 AM
I have a basic strategy that I am running on four different instruments. I do this because the result of running all four instruments with slightly different variations of the same strategy smooths the account equity curve. Since this is a multiple exit strategy I find that if I limit the entries to occur only when the strategy is flat, my performance improves. However I am running the same strategy on four different instruments in the same account so that when I check to see if the account is flat, there is some chance one of the other strategies is not flat so I will not get the entry that should occur. Is there a way to check if the account is flat only for a particular instrument, so that I can still maintain the strategy independence that I get when I test a single strategy running in a single account, with nothing else running?
Thanks
DaveN
NinjaTrader_RyanM
10-07-2010, 09:38 AM
Hello DaveN,
You can't check an account position. The strategy position can be checked for other instruments in the series. This only applies for the specific strategy context you're working from.
You use Positions[x] (http://www.ninjatrader-support.com/HelpGuideV6/Positions.html) , where x is the series index.
if (Positions[1].MarketPosition == MarketPosition.Long)
Print(Positions[1].MarketPosition.ToString());
daven
10-07-2010, 09:46 AM
So when I test if a strategy is flat or not, it only recognizes the instrument that strategy is running on anyway. So I could have the same strategy running on the ES and the TF in separate charts, and if the TF strategy is flat, but the ES is short or long, when I do the test from within the TF strategy it will see the result as flat so it will launch the trade on the TF, irregardless of whether I have a position open on the ES or not? I realize I may be beating a dead horse here but I just want to be sure that I understand how it works.
Also I'm not sure what you mean by using Positions. I think that applies to multiple instruments in a single chart. I am running separate strategies on separate charts so Positions[X] doesn't apply right?
Thanks
DaveN
NinjaTrader_RyanM
10-07-2010, 09:52 AM
So I could have the same strategy running on the ES and the TF in separate charts, and if the TF strategy is flat, but the ES is short or long, when I do the test from within the TF strategy it will see the result as flat so it will launch the trade on the TF, irregardless of whether I have a position open on the ES or not?
Yes, that's correct. The strategy is not aware of positions opened on another chart, even if using the same named stategy. They're considered separate strategy instances and are independent from each other.
I think that applies to multiple instruments in a single chart. I am running separate strategies on separate charts so Positions[X] doesn't apply right?
Correct - Positions[x] can't read the position from another strategy instance and would only apply to multiple series strategies.
daven
10-07-2010, 09:58 AM
Thanks Ryan,
I appreciate the extra effort to make sure I understand.
DaveN