Negative percentage

Optuma Forums Optuma Scripting Negative percentage

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #54045
    • Topics: 3
    • Replies: 5
    • Posts: 8

    I have this code for a percentage increase in price value of more than 3% than the previous day, with a limitation of greater than $500,000 traded for the previous week.

    MA1 = MA(BARS=2, CALC=Close) ;
    ( ( (CLOSE() – MA1) *100) / MA1) > #Percentage:3
    TO(Week(PERIODAMOUNT=1)) > 500000
    and VOL()>0


    How do I change it to a decrease  – i.e. -3%

    I’m assuming my code above is correct, even though I’m using moving averages. I don’t know of another way, and it basically works.




    • Topics: 4
    • Replies: 269
    • Posts: 273


    While your script works there is an easier way to achieve the result you’re after, and that is by using the MOMENTUM() function.

    For 3% increase compared to the previous day, you would use the following script:

    For a 3% decrease compared to the previous day, you would use the following script:

    The full script for a 3% decrease, with your Turnover criteria would be:

    • Topics: 13
    • Replies: 25
    • Posts: 38

    Hi Alexander, Matthew, I noticed an interesting piece of syntax in Alexander’s initial post

    I’m not familiar with that syntax and it looks useful. Could either of you give me a clue where some explanation on that syntax might be in the Knowledge Base or the Script Video tutorials or elsewhere on the Optuma site? I’ve had a bit of a look around but couldn’t find anything.

    Many thanks, Dean

    • Topics: 3
    • Replies: 5
    • Posts: 8

    Dean – I found it in  the preset list of Searches under the name of “Value Change Greater than %”. I’m sorry, I can’t program. I just try and interpret and modify existing ones. Someone else will need to assist you in more details of that syntax.

    Thanks Matthew for the answer.

    • This reply was modified 12 months ago by AvatarAlexander.
    • Topics: 28
    • Replies: 1,373
    • Posts: 1,401

    Hi Dean,

    That is legacy from years ago when we started the scripting engine. In the tiles we use in the scanning manager and testers, it used to expose the property into a menu. It was causing us so many issues that we abandoned the concept. The scripting engine still knows how to parse scripts with them in there.

    I did not realise that the default scripts still had them. I’ll have to set aside time to run through them all.

    All the best


Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

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.