|10-16-2007, 06:51 AM||#1|
Join Date: Jun 2007
Thanked 0 times in 0 posts
Need to set a stop loss equal to indicator value...
Is it possible to set a stop loss or a trail stop equal to the output of an indicator. I'm trying to do this and in backtest, it does not work correctly.
I'm trying to set the a Variable's value equal to the indicator and then set the stop loss equal to the Variable.
This does not work as it always sets the trail stop equal to 1 tick.
Does anyone know what method I would use in the Strategy builder or what code I may try?
Thanks in advance,
// Wizard generated variables
private int sMAFast = 6; // Default setting for SMAFast
private int sMASlow = 12; // Default setting for SMASlow
// User defined variables (add any user defined variables below)
/// This method is used to configure the strategy and is called once before any strategy method is called.
protected override void Initialize()
SetTrailStop("", CalculationMode.Ticks, Variable1, false);
CalculateOnBarClose = true;
/// Called on each bar update event (incoming tick)
protected override void OnBarUpdate()
// Condition set 1
if (SMA(SMAFast) > SMA(SMAFast)
&& SMA(SMASlow) > SMA(SMASlow)
&& VOLMA(12) > VOLMA(12)
&& ToTime(Time) >= ToTime(13, 0, 0)
&& ToTime(Time) <= ToTime(16, 10, 0))
Variable1 = ATRStop(12);
|10-16-2007, 06:56 AM||#2|
Join Date: Mar 2005
Location: Bamberg, Germany
Thanked 6 times in 6 posts
SetTrailStop("", CalculationMode.Ticks, ATRStop(12), false);
NinjaTrader Customer Service
|Thread||Thread Starter||Forum||Replies||Last Post|
|Order Entry Property: Use stop market for stop loss orders||higler||SuperDOM and other Order Entry Windows||7||07-02-2007 09:06 AM|
|I'm getting the stop loss error again...||funk101||Strategy Development||2||05-08-2007 11:30 PM|
|Stop Loss Orders activated by number of trades past stop level||DoveforUsAll||Suggestions And Feedback||1||02-08-2006 01:19 AM|
|stop loss feature||QQQ||Suggestions And Feedback||2||09-01-2005 12:04 AM|
|Stop Loss Size||JohnnyB||Suggestions And Feedback||0||07-21-2005 04:04 AM|