Announcement

Collapse
No announcement yet.

missing code

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

  • missing code

    I am just learning EFS using the online video series http://www.esignal.com/support/esign...cript_efs.aspx and ran into a problem on the Functions section in the video the following code snippet generated the expected value

    debugClear();

    x = getMostRecentTrade();

    debugPrintln(x);

    When I did it I got this error message
    C:/Users/Vectisma/Documents/Interactive Data/Formulas/Training/ex15_functions.efs, line 3: Error: Failed to call function 'getMostRecentTrade': not appropriate context 'global'.

  • #2
    [QUOTE= Error: Failed to call function 'getMostRecentTrade': not appropriate context 'global'.[/QUOTE]

    That means that the function is used outside of a function. In this case the "main" function.
    Just call the "getMostRecentTrade()" function from within main as in:

    PHP Code:
    debugClear();
    function 
    main(){
        
    getMostRecentTrade();
        
    debugPrintln(x);

    If you want a value returned then the script must be loaded on a chart so it can retrieve data.
    NOTE: a knowledgebase search for "getMostRecentTrade" will also explain that it can only be used in realtime.

    A knowledgebase search for "variable scope" should also prove useful.

    Wayne
    Last edited by waynecd; 12-23-2014, 03:02 AM.

    Comment

    Working...
    X