Skip to content
The Chat Archive
nous-hermes-2-mixtral-8x7b-dpo· Nous Research Arena Human Preference 55K

I have below script pos = iff(signal < macd , 1, iff(signal > macd, -1, nz(pos[1], 0)))…

  1. User

    I have below script

    pos = iff(signal < macd , 1, iff(signal > macd, -1, nz(pos[1], 0)))

    after i change to version 4, the above does not work. could you help update the code

  2. Assistant

    Certainly! I'll update the code for you. It seems like you're using a basic script for MACD (Moving Average Convergence Divergence) in a previous version. The script looks like this:

    pos = iff(signal < macd , 1,
    	    iff(signal > macd, -1, nz(pos[1], 0)))
    

    In version 4, the script can be updated to:

    pos = iff(signal < macd, 1,
    	    iff(signal > macd, -1, nz(pos[1], 0)))
    

    The main difference between the previous and Version 4 is the change in the order of the arguments in the iff() function. Previously, the order was (condition, true_value, false_value), but in Version 4, the order is (condition, false_value, true_value). This change is also applied to the nz() function. So, the updated script in Version 4 should look like this:

    pos = iff(signal < macd, 1,
    	    iff(signal > macd, nz(pos[1], 0), -1))
    

    Now, the script should work as expected in Version 4.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.