Announcement

Collapse
No announcement yet.

Error msg "Type Error variable has no properties" in return statement.

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

  • Error msg "Type Error variable has no properties" in return statement.

    I am plotting several valiables and displaying others in the Cursor window which is working as intended.

    When I add another variable (Tradepnl) to display in the cursor window in the return statement I am receiving the error msg " Type Error ProfitTarget has no properties" for the first variable in the return statement, ProfitTarget?

    PHP Code:
    return new Array(ProfitTargetTrailingStopNewTrade.toFixed(0), 
       
    Signal.toFixed(0), TradeEntryPrice.toFixed(5),SharesToTrade.toFixed(0), BarsSinceEntry.toFixed(0/*, Tradepnl.toFixed(5) */); 
    When I uncomment "Tradepnl.toFixed(5)" the last variable in the return statement, I receive the error msg referring to the first variable ProfitTarget?
    Glen Demarco
    [email protected]

  • #2
    Hi Glen,

    I would suggest removing all the variables that you are getting errors from the return statement and include them in a debugPrintln() statement (the line before the return statement) surrounded by a try...catch statement which outputs the error in a debugPrintln() statement.

    try{
    // your debugPrintln() statement
    }
    catch(e){
    debugPrintln(" error = "+e);
    }

    Comment


    • #3
      Steve,

      Never used the "try catch" but I'll give it a try.

      The strange thing is when I used debugPrintln() for all the variables specified in the return statement, they all look valid.

      It's only when I try to return all the values together, do I get an error, and not on the newest variable added, but rather the first one in the array. Which prior to adding the last variable was being plotted correctly.

      I thought perhaps there was a maximum number of values that could be returned or something else I was missing.

      Thanks for the suggestion, I'll give it a try.
      Glen Demarco
      [email protected]

      Comment


      • #4
        Glen,

        The error you get is typical for addressing variables that are supposed to have properties [like studies, arrays, etc.].
        Check if all vars are properly declared.

        Mihai
        Mihai Buta

        Comment

        Working...
        X