Announcement

Collapse
No announcement yet.

floats being turned into strings?

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

  • floats being turned into strings?

    Hi all, have any of you ever run into anything like this? It looks to me like my float variables are being turned into strings by something I am doing. This is the code that seems to be doing it:

    var aClose = callFunction("/OHLC/getPrevDaysOHLC.efs", "main", "Close", 0);
    var aHigh = callFunction("/OHLC/getPrevDaysOHLC.efs", "main", "High", 0);
    var aLow = callFunction("/OHLC/getPrevDaysOHLC.efs", "main", "Low", 0);
    var range = aHigh - aLow;
    var p = range * 0.10;
    var r = aLow + p;
    debugPrint("\n"+getSymbol()+" day: "+getDay()+" low: "+aLow+" 10% range "+p+" low + 10% range "+r);

    This is what I get in the formula output window:

    JNJ day: 19 low: 50.18 10% range 0.07199999999999988 low + 10% range 50.180.07199999999999988

    It looks to me as if when I multiplied range by 0.10, it turned p into a string. Any ideas why this may be happening?

    Thanks.

  • #2
    Hello adonos,

    The callFunction() calls return arrays. Try changing:

    var range = aHigh - aLow;

    to:

    var range = aHigh[0] - aLow[0];
    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment


    • #3
      Thanks Jason, a suggestion for the next version of eSignal and EFS would be to display arrays such as these with [] around them, or some such demarkation when they are displayed in backtests or with debugPrint.

      Thanks!

      Comment

      Working...
      X