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.

Help with my scan please

What am I doing wrong?? Thank You

[60-day Simple Moving Average of Volume for today is greater than 100000]
and[60-day Simple Moving Average of Close for today is greater than 10]
and[Daily Close for today is less than 65-day Simple Moving Average of Close for today]
and[Daily Acc/Dist for today is greater than Daily Acc/Dist Signal(65) for today]
and [Daily OBV for today is greater than Daily OBV Signal(65) for today]
and[Daily Close for today is less than 20-day Simple Moving Average of Close for today]
and[Daily Acc/Dist for today is greater than Daily Acc/Dist Signal(20) for today]
and[Daily OBV for today is greater than Daily OBV Signal(20) for today]

Best Answers

  • markdmarkd ✭✭✭
    edited July 2015 Accepted Answer
    1. you are trying to do too much at once - get one line to work, then go on to the next
    2. if you are doing this on the advanced scan work bench, you have to use "proper" scan syntax instead of plain english - to get the correct scan syntax for technical indicators like simple moving average, acc/dist, obv, etc. use the drop down for technical indicators under the scan writing window. When you click "insert" they show up at the end of any code you already have (sometimes out of sight if you have several lines). Cut and paste them into place and edit for your needs.
    3. If you are writing a daily time frame scan, you do not have to write "daily" - that's the default. As far as I know, "for today" is not a legal modifier - drop it altogether
    4. see the instructions link at the bottom of the advanced scan page for valid operators like +, - , >, <, =, etc.
    5. Your brackets are excellent.

    So, to get you started, the first line would be

    [sma(60, volume) > 100000]
    and [ etc. ...

    If you get stuck - post again with what you have and explain the problem.
  • markdmarkd ✭✭✭
    edited July 2015 Accepted Answer
    OK, whenever you use an indicator in a scan, you always have to follow the format for that indicator. The format includes the name of the indicator, plus the two parentheses, plus the numbers and/or text within the parentheses, separated by commas. Otherwise, the scan engine doesn't understand it.

    So the generic form varies, depending on what the indicator is measuring.
    The generic form would be

    indicator(parameter 1, parameter 2, etc.)


    Let's look at simple moving average:

    indicator name(number, text)

    or

    simple moving average(number of things to be averaged, the thing to be averaged)

    or

    sma(60, volume).

    If you want to average something else for a different period:

    sma(20, close)

    or

    sma(50, high)

    and so on.

    So what's happening there is that the code "sma(60,volume)" is a "function call". It is telling the scan engine, hey- I have something for you to do - do this function with these values.

    A function is built in code that always does the exact same thing in the exact same way, except is doesn't know, until you tell it, what values to use to do that thing (the values are called parameters). But it is built in such a way that you can give it those values (parameters) as long as you always do it in the same particular order - in this case, the number of times to add up a number and divide the result (60) and the number to work on - in this case volume.

    But if you vary the order (the syntax) of your function call request in ANY way- say you misspell something, or put the parameters in a different order, or leave out a parenthesis - the scan engine won't understand you and you get a syntax error.

    So use the Technical Indicator drop down to plug in the function call (indicator) you want to use and it will automatically be in the correct order with all the correct values. You can change the values as long as they are the same type - a number for a number (like 20 instead of 60) or a word for a word (like close instead of high).


    Note: some indicators, like AccDist and OBV don't have parameters.

    Stick to it. You're getting there :)

Answers

  • Thanks I appreciate it. I didn't build this one myself it came from the site. I just copied it and added the brackets and the "ands" really trying to run this one.....
  • Ok I know this has to be closer. What am I doing wrong? All the syntax says is that the syntax is incorrect

    [sma (60, volume) > 400000]
    and [sma > 10]
    and [sma < 65 close]
    and [acc/dist >(65)]
    and [obv >obv (65)]
    and [<20 sma]
    and [acc/dist >acc/dist (20)]
    and [obv > obv (20)]
Sign In or Register to comment.