Negative percentage

Optuma Forums Optuma Scripting Negative percentage

This topic contains 4 replies, has 4 voices, and was last updated by Mathew Mathew 3 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #54045
    Avatar
    Alexander
    • 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
    and
    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.

     

     

     

    #54055
    Matthew
    Matthew
    • Topics: 4
    • Replies: 190
    • Posts: 194

    Hi,

    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:

    #54059
    Avatar
    Dean
    • Topics: 13
    • Replies: 23
    • Posts: 36

    Interesting script syntax

    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

    #54063
    Avatar
    Alexander
    • Topics: 3
    • Replies: 5
    • Posts: 8

    #Percentage:3

    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.

    #54067
    Mathew
    Mathew
    • Topics: 16
    • Replies: 1,057
    • Posts: 1,073

    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

    Mathew

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.

Close