Hi, Can someone make sense of what is going on here? My goal is that the 'switch ON' and 'switch OFF' logic is used more than once, so I don't want to have to repeat the logic everywhere. In trying to do that I am finding faulty behaviour as follows:
This extract from the script works, but is not what I want:
TRADING = SWITCH( (DPtot > 0) and (D2P > 0) and (OFFSET(D2P, OFFSET=1) > 0), (DPtot <= 0) );
where DPtot and D2P are both 'plot' variables.
Note: I can delete the ; from the end of this line and the 'script valid' does not fail. On execution, however, the script fails badly, killing a non-relevant plot and causing the switch to fail on permanently.
This extract revision is what I want, but can't be made to work
c1 = (DPtot > 0) and (D2P > 0) and (OFFSET(D2P, OFFSET=1) > 0)
c2 = (DPtot <= 0);
TRADING = SWITCH( c1 , c2 );
NOTE:
- If I properly terminate the c1 line with ; the 'script valid' fails and I can't run it.
- If I leave the c1 line terminator ; out the script is valid but fails badly: the plot of the TRADING variable disappears.
Final questions
- If both switch signals are true, which dominates the result? In logic gates in electronics and other software systems, 'flip-flop' logic can be 'set' or 'reset' - dominant by choice when both signals are on. How does that work in optuma?
- Ancillary issue: Property selection fails in the script editor, e.g. if I type in Plot1. I get no options for after the dot. Or any other information. This makes it really hard to know what properties exist, their exact names and what settings they can be (e.g. the names of colours). In the Optuma 101 videos this feature is shown working, but it doesn't work when I use it.
Once again I expect this is just me (I have viewed all the video I can find on the SWITCH and looked at the knowledge base, to no avail) .... but look forward to finding out what's going on....
Thanks again!
colin hales