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.

small scan

How do i code the following on stockcharts?
I feel so hopeless ive been trying to code simple things like this and i just cant make anything work, see all my previoue messages

and 14 day moving average > 50day moving average
and 200day moving average is 15% lower than the price 1 day ago
and the price 1 day ago is greater than the 50day moving average


  • markdmarkd mod
    edited August 2018
    Hi @shammyx1

    You can select the indicators in your scan - moving average and close (price) - from the drop downs on the advanced scan workbench and edit them to your needs. They have the correct syntax already built in.

    For "price" select close.

    For "moving average" select SMA.

    Edit and combine the default versions to match your conditions.

    The look back adjustment is just how you have it, e.g. 1 day ago close.

    The only difficult line is "and 200day moving average is 15% lower than the price 1 day ago".

    It's very unlikely the 200 day moving average ( or sma(200,close) ) will be EXACTLY 15% lower, so you have to define a range. So maybe sma is less than close * .85 and sma is greater than close * .80, or between 15 and 20 % lower.

    I strongly suggest you spend some more time with the scanning videos, and look back through my previous answers for a condensed version of the basic rules.

    I rarely will write complete scans for people because others then pile on and want me to do their work for them.
    I am happy to help with tricky logic problems or arcane details of syntactically correct scans that produce unexpected results. But I'm not here to be a scan writing service.
Sign In or Register to comment.