PDA

View Full Version : Strategy Wizard and variable Profit Target


scjohn
06-20-2007, 08:23 PM
I'm trying to to get the Strategy Wizard to issue a Profit Target order based the Average Entry Price and using the indicator ATR as the offset. The Wizrd generates the correct code for the Exit Long Limit but on the Exit Short Limit I can't seem to get the Wizard to accept a minus offset. It will not accept my minus sign.

Here is the code that the Wizard generates:
// Condition set 3
if (Position.MarketPosition == MarketPosition.Long)
{
ExitLongLimit(Position.AvgPrice + ATR(15)[0], "Exit Long PT", "Entry Long");
}

// Condition set 4
if (Position.MarketPosition == MarketPosition.Short)
{
ExitShortLimit(Position.AvgPrice + ATR(5)[0], "Exit Short PT", "Entry Short");
}

I can't seem to be able to tell the Wizard that for a Short Profit Traget the ATR needs to be subtracted from the Position.AvgPrice.

Thanks

NinjaTrader_Dierk
06-21-2007, 07:16 AM
Here is the trick: You need to get the ATR multiplied by a -1. You can do this like:
- add Action
- Exit long position by a limit order
- click on Limit price -> new box pops up
- Average position price
- Offset type = Price
- click on Offset -> new box pops up
- select ATR
- Offset type = Percent
- Offset = -2
- Ok, Ok, Ok

-> ExitLongLimit(Position.AvgPrice + (ATR(14)[0]) * (1 + -2), "", "");

Which is equivalent to ExitLongLimit(Position.AvgPrice - (ATR(14)[0]), "", "");