Announcement

Collapse
No announcement yet.

TypeError

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • TypeError

    The following code fragment generates the following error in both "drawText" lines:

    Day Trading.efs, line 239: TypeError: upper is null

    This error started when I edited my EFS in eSignal 11. I don't get this error in eSignal 10.

    function fPrintPrice(fDigits) {
    var fMinTick = getMinTick();
    if (fDigits == 0) fMinTick = 0.5;
    var vRange = high(-1)-low(-1)+fMinTick;
    var upper = formatPriceNumber(low() +vRange);
    var lower = formatPriceNumber(high()-vRange);
    clearText();

    drawText(upper.substring(upper.length-fDigits,upper.length), AboveBar1, Color.white);
    drawText(lower.substring(lower.length-fDigits,lower.length), BelowBar1, Color.white);
    }

    Any ideas anyone?

  • #2
    Re: TypeError

    BerkoBob
    You should run a null check on those variables prior to passing them to drawText()
    Alex


    Originally posted by BerkoBob
    The following code fragment generates the following error in both "drawText" lines:

    Day Trading.efs, line 239: TypeError: upper is null

    This error started when I edited my EFS in eSignal 11. I don't get this error in eSignal 10.

    function fPrintPrice(fDigits) {
    var fMinTick = getMinTick();
    if (fDigits == 0) fMinTick = 0.5;
    var vRange = high(-1)-low(-1)+fMinTick;
    var upper = formatPriceNumber(low() +vRange);
    var lower = formatPriceNumber(high()-vRange);
    clearText();

    drawText(upper.substring(upper.length-fDigits,upper.length), AboveBar1, Color.white);
    drawText(lower.substring(lower.length-fDigits,lower.length), BelowBar1, Color.white);
    }

    Any ideas anyone?

    Comment

    Working...
    X