Warning: the function returns 2 values but your code needs 1

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #31270 quote
    Bard
    Participant
    Master

    Hi

    I wanted to add a second condition to a system buy condition and it gave me a warning (pls see screenshot). Any ideas why? (The Oscillator is bounded between -1 and +1)

    Thanks.

    The original code was:

    if (stdev[0]+stdev[1]+stdev[2]+stdev[3]+stdev[4]) < (stdev[1]+stdev[2]+stdev[3]+stdev[4]+stdev[5]) then
     SWBUY=1
    else
     SWBUY=0
    ENDIF

    And then I wanted to add a filter (the oscillator):

    c1 = CALL "Ehler's Univ Osc SuperSmoother"

    which was placed at the top of the system code and the Oscillator added to a Std Dev condition:

    if (stdev[0]+stdev[1]+stdev[2]+stdev[3]+stdev[4]) < (stdev[1]+stdev[2]+stdev[3]+stdev[4]+stdev[5]) AND
    c1 >= 0.0 then
     SWBUY=1
    else
     SWBUY=0
    ENDIF
    
    
    returns-2-values-but-your-code-needs-1.png returns-2-values-but-your-code-needs-1.png
    #31284 quote
    JC_Bywan
    Moderator
    Master

    Hi,

    I don’t know the Ehler’s univ osc supersmoother, but I am going to guess its “return” line contains 2 variables? If the answer is yes, then if you want the first one of these 2, try with:

    c1,ignored = CALL "Ehler's Univ Osc SuperSmoother"

    or if you want the second one rather than the first:

    ignored,c1 = CALL "Ehler's Univ Osc SuperSmoother"
    #31310 quote
    Bard
    Participant
    Master

    Thanks very much Noobywan, example #1 above has fixed it because it was returning the actual signal line value plus the zero line value (the latter needing to be ignored). It is normally written, when created by simple programming, as:

    // Conditions to enter long positions
    indicator1, ignored = CALL "Ehler's Univ Osc SuperSmoother"
    c1 = (indicator1 CROSSES OVER -0.8)
    
    
    
    
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Warning: the function returns 2 values but your code needs 1


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Bard @brad Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Bard
8 years, 11 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/06/2017
Status: Active
Attachments: 1 files
Logo Logo
Loading...