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.

Plus DI and Minus DI crossover scan

Hi, I'm currently helping my grandad but I don't have the necessary coding skills just yet.

All he wants is a scan to alert him on the day when the Minus DI and Plus DI cross over. I tried [Plus DI(14) = Minus DI(14)] first (although [Plus DI(14) >= Minus DI(14)] works) and then a few of the True Range indicators from the stockcharts school but at this point it's all just a little confusing.

Any help or advice would be appreciated!

Best Answer

  • markdmarkd mod
    Answer ✓
    The easy way to do it is using the crossover operator "x". The "x" means the term on left crosses above the term on the right.

    and [MinusDI(14) x PlusDI(14)]

    would be minus DI crosses above plus DI, meaning yesterday minus DI was below plus DI and today minus DI is
    above plus DI.

    For plus to cross above minus, you would switch the order of the terms

    and [PlusDI(14) x MinusDI(14)]

    The crossover operator is explained here ( a few paragraphs down)

    https://support.stockcharts.com/doku.php?id=scans:advanced_scan_syntax

Answers

  • lmkwinlmkwin ✭✭
    edited August 2020
    You're a good grandkid helping your granddad like this.

    As a granddad myself, I found using the resources in the Help on StockCharts, in conjunction with the this forum, provided all the help I needed to get comfortable with the scan coding.

    Also, a great way to "learn" how StockCharts does it is to go to the Predefined Scan page. Click on ANY of the Predefined Scans and in the upper right corner is a link that says Click here to edit this scan.

    This will open that scan, in the workbench, so that you can see the actual code used for that scan. You can then modify that code and save it to your account for use as you see fit.


    https://stockcharts.com/def/servlet/SC.scan
  • I am trying to incorporate this line of code and am getting an error message saying

    Could not parse "PLUSDI" located in the clause "PLUSDI(14) X MINUSDI(14)"

    Not sure what this means... any help greatly appreciated.
  • It means there is an error in your scan text somewhere near PLUSDI - it could be a missing comma, a missing parens or bracket, or an extra one of those, or something else.

    Error messages are a "best guess", since the language writer cannot anticipate every possible error we users can make. So they throw the error at the point where the interpreter engine can't go on, not necessarily where the error actually is. In other words, given what comes before it, PLUSDI can't come next.

    If you can't get it, post the whole line that's giving the error and maybe one of us can spot it.
  • OldeTowneOldeTowne
    edited July 2023
    [type is stock]
    and [country is US]
    and [market cap > 5,000]
    and [optionable is true]
    and [ADX Line(10) > 20.0]
    and [Close > 25]
    and [PlusDI(10) X MinusDI(10)]

    The error message occurs when I add the last line.
  • lmkwinlmkwin ✭✭
    If you select the options using the dropdown menus, they provide a correct format to use. You can change the parameters to your desired needs.

    When you select the Plus DI from the TECHNICAL INDICATORS dropdown



    it defaults into the workbench like this:

    and [Plus DI(14) > Minus DI(14)]

    Note the difference with your code for the last line. There is a space missing from yours, so the scan engine doesn't know what PlusDI(10) or MinusDI(10) is.
  • That was it! Thanks!
  • yeah, i noticed that space missing. In addition to the Dropdown menu, you can put a “ [ “ in the Editor, and it will often type in an example that will Pop-up, and then all you have to do is Edit it to your liking

  • i believe the Default is 14 and you are using 10 periods, I assume that was Intentional. One other thing that May help you, is to hit the “Check Code” button before running the Scan. It will often tell you which lines may contain errors, and sometimes will give helpful suggestions and even offer to fix it for you if it thinks it knows what you are trying to say. I used this Very often when I was Learning how to write these Codes.

  • Thanks! One other question... The periods being considered, 10 in this case... How can we specify a time period? Week, day, hour for example?
  • There are two time frame modifiers, "weekly" and "monthly".

    Put them in front of the indicator or constant.

    and [weekly close > 10]

    and [weekly sma(20, weekly close) > 10]

    and [weekly MACD Line(12,26,9) x weekly MACD Signal(12,26,9)]
  • The default is Daily?
  • Yes, if you don’t specify, it assumes daily

  • Minor note, I don’t believe you can scan ‘hourly’ at this time. Could be wrong I’m on my iPhone right now.

Sign In or Register to comment.