PDA

View Full Version : Complex properties/parameters


Buthus
11-07-2009, 10:34 AM
Settings for complex properties are not saved/used.

Property code:

private OrderParameters _orderParameters = new OrderParameters();

[Category("Order Handling")]
[Gui.Design.DisplayName("ATM Parameters")]
public OrderParameters ATMParameters
{
get { return _orderParameters; }
}


Part of the OrderParameters class code:

[TypeConverter(typeof(ExpandableObjectConverter))]
public class OrderParameters
{
private int _profitTarget = 0;
private int _stopLoss = 0;
private bool _simulateStopOrders = false;

private AutoBreakeven _autoBreakeven = new AutoBreakeven();
private List<AutoTrail> _autoTrail = new List<AutoTrail>(3);

[Description("Gets or sets the initial stop loss.")]
[Category("Parameters")]
public int StopLoss
{
get { return _stopLoss; }
set { _stopLoss = value; }
}

[Description("Gets or sets the profit target.")]
[Category("Parameters")]
public int ProfitTarget
{
get { return _profitTarget; }
set { _profitTarget = value; }
}

[Description("Indicates whether to simulate stop orders.")]
[Category("Parameters")]
public bool SimulateStopOrders
{
get { return _simulateStopOrders; }
set { _simulateStopOrders = value; }
}

[Category("Parameters")]
public AutoBreakeven AutoBreakeven
{
get { return _autoBreakeven; }
}

public override string ToString()
{
return string.Format("SL: {0}{1}, TP: {2}", _stopLoss, _simulateStopOrders ? " (simulated)" : "", _profitTarget);
}
}


All settings for the property ATMParameters are lost when I start the strategy, instead the default values are used (in this case SL:0, TP:0, ...). Any workaround?

Another issue is, that these values are not optimizable. Hopefully this will be changed soon.

Regards,
Daniel

NinjaTrader_Dierk
11-09-2009, 03:32 AM
NT only supports the parameters types supported by the strategy wizard (double/int/bool/string). Anything else is not supported and may or may not work.

Buthus
11-09-2009, 04:47 AM
Hello Dierk,

is there any method that is called after the properties dialog is closed, so that I can store the settings and load them again when the strategy is actually started?

Regards,
Daniel

NinjaTrader_Dierk
11-09-2009, 04:59 AM
Unfortunately this is beyond what we could provide support for.