Negative percentage

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.

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:

`MOMENTUM(BARS=1, TYPE=Percentage, TOOLCALCTYPE=Percentage) > 3`

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

`MOMENTUM(BARS=1, TYPE=Percentage, TOOLCALCTYPE=Percentage) < -3`

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

`MOMENTUM(BARS=1, TYPE=Percentage, TOOLCALCTYPE=Percentage) < -3 and TO(Week(PERIODAMOUNT=1)) > 500000`

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

`#Percentage:3`

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

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.