winja
02-18-2009, 09:58 PM
I have a simple strategy that takes a short position on SMA(3) cross below HMA(20) when Stochastics(20,90,3) is above 80. Here is my code:
protectedoverridevoid OnBarUpdate()
{
// Enter position
if (CrossBelow(SMA(Fast), HMA(Slow), 1) && CrossAbove(Stochastics(20,90,3), 80, 1))
EnterShort();
}
When I place this strategy on a 30 min SPY chart I get exited from the position even though I did not code any exit. See image. What do I need to do to prevent being exited from this position and why did it occur? Thanks.
http://www.ninjatrader-support2.com/vb/attachment.php?attachmentid=4677&stc=1&d=1235019344
protectedoverridevoid OnBarUpdate()
{
// Enter position
if (CrossBelow(SMA(Fast), HMA(Slow), 1) && CrossAbove(Stochastics(20,90,3), 80, 1))
EnterShort();
}
When I place this strategy on a 30 min SPY chart I get exited from the position even though I did not code any exit. See image. What do I need to do to prevent being exited from this position and why did it occur? Thanks.
http://www.ninjatrader-support2.com/vb/attachment.php?attachmentid=4677&stc=1&d=1235019344