PDA

View Full Version : exitlong and exitshort together to close positions


anothertoy
09-01-2009, 04:17 PM
if i don't know whether the current position is long or short, can i just put in my strategy to:

ExitShort();
ExitLong();

and that will close any open positions? Or will this produce an error?

NinjaTrader_Josh
09-02-2009, 07:16 AM
That will work, but you could detect if you are long/short by using this:

if (Position.MarketPosition == MarketPosition.Short)
if (Position.MarketPosition == MarketPosition.Long)