PDA

View Full Version : Reversing a position


sdgardiner
02-22-2010, 10:18 AM
Hello,
I'm new here. I've read almost all the posts available on the subject and I can't figure out how to program a reverse in the Wizard. Any suggestions?
sd

NinjaTrader_RyanM
02-22-2010, 10:26 AM
Hello sdgardiner,

Welcome to our forums.

By default entries will reverse a position. You would have to add a condtion to your entries to verify that you're flat if you wanted to change this behaviour.

For a reversal strategy you just need at least one long entry and one short entry.

sdgardiner
02-22-2010, 11:44 AM
Are you refering to a simple cross over strategy? What I am trying to do is trigger a reversing entry off a stop loss trigger. For example, if I were to be long from a price and get stopped out. I want to enter the market short from that level. I can do this manually, but would like to be able to program it into a strategy. Thank you
SG

NinjaTrader_RyanM
02-22-2010, 12:01 PM
Hello sdgardiner,

No, I'm not referring to a CrossOver strategy.

All entries will reverse a position unless told to do otherwise. You could have:


if (Condition1)
EnterLong();

if (Condition2)
EnterShort();


These entries will reverse.

When working with stop losses as reversal, there are at least a couple different approaches.

1) Submit an EnterShortStop() order at your long entry price - some ticks
EnterShortStop(DefaultQuantity, Position.AvgPrice + -10 * TickSize, "");

2) Work with GetProfitLoss() and submit an order based on that value.
http://www.ninjatrader-support.com/HelpGuideV6/GetProfitLoss.html

BBzDan
02-26-2010, 02:51 PM
How can I stop this reversal behaviour using the Wizzard?

I built a strategy using the CCI indicator, with a set of conditions to enter long when CCI crosses above the zero line and a 2nd set of conditions to enter short when it crosses below. I also included a target and a stop loss. Now, when it hits the stop loss, it reverses automatically, which I do not want to.

I tryed to include a condition to enter if position quantity is zero, but it still reverses, probably because it gets flat first when it hits the stop, then it enters the other direction because the position quantity was zero after hitting the stop loss.

Thx.

NinjaTrader_RyanM
02-26-2010, 02:59 PM
Hello BBzDan,

I have attached an image showing these settings in the strategy wizard.

Strategy -> Current Market Position == Strategy -> Flat

BBzDan
02-28-2010, 09:53 AM
OK, thank you.

Dan

sdgardiner
03-03-2010, 07:52 AM
If I am using a strategy that gets stopped out, why does the strategy get right back in the same direction? The initial conditions are still met, but I don't want to continue entering after getting stopped out.

NinjaTrader_RyanM
03-03-2010, 09:04 AM
Hello sdgardiner,

One way to solve this is add a bool condition for your entry, and then set this bool condition as false when the condition is true. Sample pseudocode below.


if (yourCondition && yourBoolFlag)
{
EnterLong();
yourboolFlag = false;
}