We have Windows 7, .NET 4.0.30319.296 (also installed: 2.0.50727.5466, 3.0.4506.5452) with German localization and MultiCharts.NET 8.5 (Build 6861). When I run the following strategy in the exhaustive optimizer
Code: Select all
using System;
using System.IO;
namespace PowerLanguage.Strategy
{
public class _verifyinputs : SignalObject
{
public _verifyinputs (object _ctx) : base (_ctx) {}
[Input] public double inputdouble { get; set; }
[Input] public int inputint { get; set; }
protected override void Create()
{
inputdouble = 0.11;
inputint = 3;
}
protected override void StartCalc ()
{
Output.WriteLine ("double = "+inputdouble.ToString ("g")+"; int = "+inputint.ToString ());
}
protected override void CalcBar ()
{
}
}
}
When I run the strategy for the first time, I see the correct default values.
When I change the inputs manually via Format Signals -> Format -> Inputs, I can change the double input to any decimal fraction, and the output is as expected. Because of our localization, the double needs to be input as "0,44" (with a comma) rather than "0.44", but with "0,44" I get the expected behaviour. If I enter "0.44" (with a decimal point), the double receives the value "44". This is presumably how .NET converts that string into a double under our localization.
When I run an exhaustive optimization, however, the integer input behaves as expected, but the double input never does. When I select start value "0,4", end value "0,5" and step "0,01", MultiCharts.NET correctly determines a step count of "10", however, the strategy is calculated with "4", "41", "42", ..., "49", "5". When I enter start value "0.4", end value "0.5" and step "0.01" (which is wrong in our localization), MultiCharts.NET still determines the correct step count (which it shouldn't be able to), but the strategy is again called with the wrong values.
Are you treating the input of double values in the exhaustive optimizer in a way different from the input of doubles in Format Strategy? Are you sure you are handling the localization of double input fields in the optimizer correctly? What else could it be?
Thanks for your help,
HPF