Optuma Forums › Optuma Scripting › A few scripting questions › Reply To: A few scripting questions

- Topics: 32
- Replies: 1,654
- Posts: 1,686
Hi Jeff,
Re 1. Each of those levels are available using the ” dot notation” whenever a function has multiple outputs, enter a “.” and you will see the options available.
In this case I also want to use a variable as it is more efficient.
So this would be the code to signal when the Black Ratio line enters into the red zone.
1 2 3 4 5 6 |
// store all the Optex results in a variable o1 = OPTEX(); // do we cross into the red zone o1.Ratio CrossesAbove o1.25Upper |
Re 2 and 3. Remember that we have a separate group for Astro scripts. In this case your questions are more general so I’ll answer them here.
Re 2: When you have a true false condition, that is stored as 1 for true and 0 for false. So something you can do when you want to signal on the first bar is use the ChangeTo operator to find when the result ChangeTo 1
eg If you were looking at Higher Bars —something which could be true multiple times in a row — and you wanted to capture only the first higher bar.
1 2 3 4 |
c1 = BARTYPES().Higher; c1 ChangeTo 1 |
Re 3: You would use offsets. In this case you have a Higher bar and you want the last bar to be higher and this bar to have a low which is lower than the previous bar. We use square brackets to offset the data.
1 2 3 4 5 |
h1 = BARTYPES().Higher; l1 = LOW(); (h1[1] == 1) and (l1 < l1[1]) |
Hope that helps
Mathew