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.

Scan using multiple math equations

Hi, I am having trouble creating a scan with multiple equations. I was hoping someone could help. Here is what I am trying to achieve.

1. I want the close to have crossed above the following combined level, therefore

[close x

2. The level I want the close to exceed the sum of three periods and I have tried to express this in the following equation;

The average of yesterday's H/L/C times 2 minus yesterdays low, represented below;

[[[[Yesterday's High + Yesterday's Low + Yesterday's Close]/3]*2] - Yesterday's Low]

but that is not the end, I also want to add the average of two days ago H/L/C times 2 minus 2 days ago low, represented below;

+ [[[[2 days ago High + 2 days ago Low + 2 days ago close]/3]*2] – 2 days ago Low]

Finally, I want to add a third days average of three days ago H/L/C times 2 minus 3 days ago low, represented below;

+ [[[[3 days ago High + 3 days ago Low + 3 days ago close]/3]*2] - 3 days ago Low]/3]

I want cross above level to be represented by the equation output of the three days, not just the first day. That is why I have tried to group them in this manner.




  • markdmarkd mod
    edited June 2020
    Do you get an error message ?

    What is it?

    It looks like it should pass syntax. Does it? If not, it may be more than the parser can handle in one line (in other words, nested too deep).

    It might help to run each equation individually - i.e. close x day 1's equation, then close x day 2's equation, etc.

    If that works, try combining 2 days - close x day 1 + day 2; and then close x day 1 + day 2 + day 3, then finally divide the sum of the 3 days by 3.

    If the individual equations work, but it fails at some point when combining them, then it's likely to much for the scanner.

    Another possibility is the scanner can handle it but the server is killing it for running too long. Try it against just the dow 30 or sp100.
  • Thanks Mark. Yes, run individually, the syntax is correct and the scan is successful. Once I add the second equation into the mix I get a "cannot parse error". I suspect it is that the nesting is greater than the scan can handle as I need multiple sets of brackets to ensure the math is correct. However, support has told me it should work but no matter what I try, other than individually, it fails. Appreciate the input...
  • markdmarkd mod
    edited June 2020
    When you add the second statement, try putting another set of brackets to contain the two statements, so

    [close x [ [statement 1] + [ statement 2] ] ]

    Then, if that works, try putting a bracket after the "x" and before the first bracket of the first statement, and one more bracket just before the "/3]. It may not understand that you want to divide the sum of all three statements by 3.

    [close x [ [statement 1] + [ statement 2] + [statement 3] ] /3 ]

    Sounds counter intuitive - but if support says its not nested too deep, that might be it.
  • Or, you could try reducing the math by substituting .67 (or .66666 etc.) for /3 * 2.

    [[a + b + c+] /3] * 2]

    [ [a + b + c +] * .67]
  • Thanks Mark! I will see if that can work for me. Appreciate your help...
Sign In or Register to comment.