Parameter must be a number error in .jsl

Moderator: admin

Parameter must be a number error in .jsl

Postby fxcodebase_007 » Thu Jun 10, 2021 1:23 am

I get error "The fifth parameter must be a number" for following line in my .jsl Indicator
TL = instance.addStream("TL", core.Line, name + ".TL", "TL", instance.parameters.TL_color, first);

I am using Indicore 4 Debugger.
Please help.

Code: Select all

function Init()
{
    indicator.name("Name");
    indicator.description("Description");
    indicator.requiredSource(core.Bar);
    indicator.type(core.Indicator);

    indicator.parameters.addColor("BB_TL_color", "BB Color of TL", "Color of BB TL", core.rgb(255, 0, 0));
    indicator.parameters.addColor("BB_BL_color", "BB Color of BL", "Color of BB BL", core.rgb(255, 0, 0));
}


var first;
var source = null;


var TL = null;
var BL = null;

// Routine
function Prepare(nameOnly)
{
    // Assign parameters to variables section
    source = instance.source;
    first = source.first() + 2;
   
    // -------------------------------------------------------

    var name = profile.id() + "(" + instance.source.name() + ")";
    instance.name(name);

    if (!nameOnly)
    {
        TL = instance.addStream("TL", core.Line, name + ".TL", "TL", instance.parameters.TL_color, first);
        BL = instance.addStream("BL", core.Line, name + ".BL", "BL", instance.parameters.BL_color, first);
    }
   
}

// Indicator calculation routine
// TODO: Add your code for calculation output values
function Update(period)
{
    if (period >= first && source.hasData(period))
    {
    }
}

fxcodebase_007
 
Posts: 8
Joined: Wed Jun 06, 2018 4:22 am

Re: Parameter must be a number error in .jsl

Postby Apprentice » Thu Jun 10, 2021 9:52 am

Test.jsl
(1.54 KiB) Downloaded 269 times

Try it now.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Parameter must be a number error in .jsl

Postby fxcodebase_007 » Thu Jun 10, 2021 10:41 am

Thank you very much Apprentice.
Jsl file runs fine now in the Debugger
fxcodebase_007
 
Posts: 8
Joined: Wed Jun 06, 2018 4:22 am


Return to Indicator Development

Who is online

Users browsing this forum: No registered users and 6 guests