Reply To: IF Statement

Optuma Forums Optuma Scripting IF Statement Reply To: IF Statement

  • Topics: 68
  • Replies: 99
  • Posts: 167

Hi Mathew,

thanks for your replay. Using your Var4 recommendation I have to say that it does not what it should.

Here is the script with your recommendation:

This the the chart with the above script.
SP 500 SWITSCH Function

The histogram is the following script:

I have done the job in Excel, the Excel file is attached. Here are the charts how it should be.
S P 500 - Daily Trend #1

S P 500 - Daily Trend #2

I have saved the trend values “1” and “0” in the volume column of the csv file and then have displayed the “volume” in Optuma. The volume is the trend indicator. The csv file is also attached.

Here are the description what the trend indicator should do and how it is calculated:
Var2: I calculate a 8 period Exponential Regularization Moving Average
Var3: Percent change of the Exponential Regularization Moving Average over the last three days
Var4: The trend indicator should have a value of “1” as long as Var3 is above minus 0.3 and when the Var3 is negative more than minus 0.3 the trend indicator should have the value “0” as long as Var3 is below 0.3.
When Var3 moves the first time above 0.3 and the trend indicator value was the bar before “-1” it turns to “1”.
When Var3 moves the first time below minus 0.3 and the trend indicator value was the bar before “1” it turns to “-1”.

The problem is the range between 0.3 and minus 0.3. This is the range where often whipsaws occur and to remove these whipsaws makes the issue a little bit complicated.

I hope I have clarified the issue, if not please let me know.


  • This reply was modified 1 week, 1 day ago by AvatarThomas.

Pin It on Pinterest

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.