double values as inputs in the optimizer - localization?

Questions about MultiCharts .NET and user contributed studies.
HPF
Posts: 47
Joined: 02 Apr 2013
Has thanked: 11 times
Been thanked: 7 times

double values as inputs in the optimizer - localization?

Postby HPF » 08 May 2013

Hi,

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 ()
{
}
}
}
I am unable to specify a range of fractions for the double input, say, from 0.4 to 0.5 in steps of 0.01.

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

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: double values as inputs in the optimizer - localization?

Postby Henry MultiСharts » 08 May 2013

Hello HPF,

This issue has been confirmed. It will be fixed in the next version of MultiCharts .Net.
As a workaround you can use English localization on your PC.


Return to “MultiCharts .NET”