thanks
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Using Multiple MA Types in a Strategy
Collapse
X
-
Using Multiple MA Types in a Strategy
Can you please point me to a Sample strategy that uses multiple MA types. I have a strategy that I would like to backtest with all different types. I would like them to be available in the strategy's properties dialog box.
thanksTags: None
-
Ken, I would suggest you review this sample for working with enums - http://www.ninjatrader.com/support/f...ead.php?t=3420
-
I've added this to my strategy variables, which is the same as in the Indicator and it compiles OK
private NinjaTrader.Indicator.MAV.MAType dMAFastType = NinjaTrader.Indicator.MAV.MAType.HMA;
private NinjaTrader.Indicator.MAV.MAType dMASlowType = NinjaTrader.Indicator.MAV.MAType.SMA;
I've added this to my strategy properties, which is the same as in the indicator and it compiles OK
[Description("DMAFastType")]
[Category("Parameters")]
public NinjaTrader.Indicator.MAV.MAType DMAFastType
{
get { return dMAFastType; }
set { dMAFastType = value; }
}
[Description("DMASlowType")]
[Category("Parameters")]
public NinjaTrader.Indicator.MAV.MAType DMASlowType
{
get { return dMASlowType; }
set { dMASlowType = value; }
}
But when I add this to Initialize, I get an error, "NinjaTrader Indicator.MAV.MAType' does not contain a definition fo 'DMAFastType' ...Code - CS0117" Didn't I establish the definition with the variables and properties? What am I missing? thanks
Add(DoubleMA(DMAFastPeriod, NinjaTrader.Indicator.MAV.MAType.DMAFastType, DMASlowPeriod, NinjaTrader.Indicator.MAV.MAType.DMASlowType));
Comment
-
In thread 8# the "public " is added to Properties, it's the "Add" line that is causing the propblem (see last line thread #8). Somehow I am defining the Indicator and it's property "MAType" wrong. Can you see the problem and solution? The whole issue is that I am trying to define 2 types, a fast and a slow from the Indicator DoubleMA. I want to be able to say FROM the strategy's property dialog box, use an EMA type for the DMAFastType, as "defined" in the Indicator DoubleMA and an SMA for the DMASlowType without having to hardcode it.
Somehow I think the real issue is that I am trying to define DMAFastType, which is defined in the Indicator DoubleMA but not in MAV which is the Indicator that DoubleMA gets it's MAType from. The problem seems to be defining the property of an Indicator of an Indicator, if that makes any sense. Any help?
Thanks
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
56 views
0 likes
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
143 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
160 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
96 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
276 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|

Comment