New Members: Be sure to confirm your email address by clicking on the link that was sent to your email inbox. You will not be able to post messages until you click that link.

Percentage

Assistance with a percentage calculation would be greatly appreciated.

I'm trying to scan for stocks BELOW the monthly PSAR within 0 to 10% and ABOVE the monthly PSAR within 0 to 5%.

The percentage scans always elude me!! Thank you in advance.

Comments

  • markdmarkd mod
    edited April 2019
    In equations, think of 1.0 as 100 per cent.

    Values less than 100 per cent, would be decimal values less than 1.0, so 80 per cent would .8, .75 would 75 per cent, etc.

    Of course, another way to say 80 per cent is 20 per cent less than 100 per cent - or translated to decimals, 1.0 - .2 = .8; 25% less would be 1.00 - .25 = .75

    So, when you have a base value - in your case, the monthly PSAR - you can think of that as 1.0, or 100 per cent.

    If you want something 10 per cent less than PSAR, it would be 1.0 - .1 = .9, or PSAR( ...) * .9

    To get values greater than 1.0, you would add the per cent amount, expressed as a decimal value, to 1.0. So 10 % greater would be 1.0 + .1 = 1.1

    In your case, PSAR(...) * 1.05

  • Thank you.

    this is what I have, but I’ve got the coding wrong somewhere

    and [monthly close > monthly min(monthly Parabolic SAR(0.02,0.2)) * 1.05]

    and [monthly close > monthly max(monthly Parabolic SAR(0.02,0.2)) * .90]

  • Probably should be

    and [monthly close > monthly min(monthly Parabolic SAR(0.02,0.2)) * .90]

    and [monthly close < monthly max(monthly Parabolic SAR(0.02,0.2)) * 1.05]


    but still I have something in the code wrong, it expects an integer somewhere

  • oh my I think I’ve been doing it backwards

    should more like

    and [monthly Parabolic SAR(0.02,0.2) < monthly max(monthly close) * 1.05]

    and [monthly Parabolic SAR(0.02,0.2) > monthly min(monthly close) * .90]

    but still not working, help :)

  • markdmarkd mod
    edited April 2019
    this is the correct version, but you need a parameter x for min( ) and max( ) - min and max for how many months?

    and [monthly close > monthly min(x, monthly Parabolic SAR(0.02,0.2)) * .90]

    and [monthly close < monthly max(x, monthly Parabolic SAR(0.02,0.2)) * 1.05]
  • markdmarkd mod
    edited April 2019
    I'm looking at this again. I was looking at the per cent thing and not thinking about PSAR, so I think you should ignore my answer above this one (April 26).

    Price cannot be both above and below the PSAR at the same time.

    So, I am wondering what conditions you want.

    When PSAR is above price, do you want price within a certain per cent, or beyond a certain per cent?

    Same thing when PSAR is below price, do you want price within a certain per cent or beyond a certain per cent.

    If you want to combine these two conditions into one scan, I think you will need an 'or' statement.
  • Thank you Mark. You are right, the max/min statements are not what I was looking for. I have been able, after some trial and error, to figure it out.
Sign In or Register to comment.