Indicator Parameter Default Value

Moderator: admin

Indicator Parameter Default Value

Postby aytacasan » Thu Dec 30, 2010 5:27 am

Hello,

I wrote my first indicator. There are many parameters of his indicator. There are default values for this parameters. But somehow when i add indicator to my chart default values looks wrong. For example, TrendBandTop_color parameter default value black and TrendBandTop_width default value 2, see below code. But when add indicator to chart i'm seeing that its color red and width 1. Could you explain me why?

INIT
indicator.parameters:addGroup("Calculation");
indicator.parameters:addInteger("BandDays", resources:get("param_BandDays_name"), resources:get("param_BandDays_description"), 28);
indicator.parameters:addDouble("DevConstant", resources:get("param_DevConstant_name"), resources:get("param_DevConstant_description"), 3.5);
indicator.parameters:addGroup("Style");
indicator.parameters:addColor("TrendBandTop_color", resources:get("param_TrendBandTop_color_name"), resources:get("param_TrendBandTop_color_description"), core.rgb(0, 0, 0));
indicator.parameters:addInteger("TrendBandTop_width", resources:get("param_TrendBandTop_width_name"), resources:get("param_TrendBandTop_width_description"), 2, 1, 5);
indicator.parameters:addInteger("TrendBandTop_style", resources:get("param_TrendBandTop_style_name"), resources:get("param_TrendBandTop_style_description"), core.LINE_SOLID);
indicator.parameters:setFlag("TrendBandTop_style", core.FLAG_LINE_STYLE);
indicator.parameters:addColor("TrendBandMiddle_color", resources:get("param_TrendBandMiddle_color_name"), resources:get("param_TrendBandMiddle_color_description"), core.rgb(0, 0, 0));
indicator.parameters:addInteger("TrendBandMiddle_width", resources:get("param_TrendBandMiddle_width_name"), resources:get("param_TrendBandMiddle_width_description"), 2, 1, 5);
indicator.parameters:addInteger("TrendBandMiddle_style", resources:get("param_TrendBandMiddle_style_name"), resources:get("param_TrendBandMiddle_style_description"), core.LINE_SOLID);
indicator.parameters:setFlag("TrendBandMiddle_style", core.FLAG_LINE_STYLE);
indicator.parameters:addColor("TrendBandBottom_color", resources:get("param_TrendBandBottom_color_name"), resources:get("param_TrendBandBottom_color_description"), core.rgb(0, 0, 0));
indicator.parameters:addInteger("TrendBandBottom_width", resources:get("param_TrendBandBottom_width_name"), resources:get("param_TrendBandBottom_width_description"), 2, 1, 5);
indicator.parameters:addInteger("TrendBandBottom_style", resources:get("param_TrendBandBottom_style_name"), resources:get("param_TrendBandBottom_style_description"), core.LINE_SOLID);
indicator.parameters:setFlag("TrendBandBottom_style", core.FLAG_LINE_STYLE);

PREPARE
TrendBandTop = instance:addStream("TrendBandTop", core.Line, name .. ".TrendBandTop", "TrendBandTop", instance.parameters.TrendBandTop_color, first);
TrendBandTop:setWidth(instance.parameters.TrendBandTop_width);
TrendBandTop:setStyle(instance.parameters.TrendBandTop_style);
TrendBandMiddle = instance:addStream("TrendBandMiddle", core.Line, name .. ".TrendBandMiddle", "TrendBandMiddle", instance.parameters.TrendBandMiddle_color, first);
TrendBandMiddle:setWidth(instance.parameters.TrendBandMiddle_width);
TrendBandMiddle:setStyle(instance.parameters.TrendBandMiddle_style);
TrendBandBottom = instance:addStream("TrendBandBottom", core.Line, name .. ".TrendBandBottom", "TrendBandBottom", instance.parameters.TrendBandBottom_color, first);
TrendBandBottom:setWidth(instance.parameters.TrendBandBottom_width);
TrendBandBottom:setStyle(instance.parameters.TrendBandBottom_style);
aytacasan
 
Posts: 15
Joined: Thu Jun 03, 2010 3:40 pm

Re: Indicator Parameter Default Value

Postby Apprentice » Thu Dec 30, 2010 10:43 am

If this is not a problem
Can you send me the whole indicator on my private mail.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36478
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Indicator Parameter Default Value

Postby aytacasan » Fri Dec 31, 2010 8:28 am

Hi,

Definitely not the problem if you want i can post it here too. But I found the cause of the problem a few minutes ago. When i fist write the indicator i test it always same chart. First indicator color parameter was red and width parameter 1. Then i change parameters default values red to black and 1 to 2. And I add indicator same chart too. And i see there is a problem and post previous post here. A few minutes ago i try to test indicator different chart and i see there is not problem, it's working properly. I dont know how and why but now every thing is fine.

Thanks.
aytacasan
 
Posts: 15
Joined: Thu Jun 03, 2010 3:40 pm


Return to Indicator Development

Who is online

Users browsing this forum: No registered users and 42 guests