Cross of MAs Appears Incorrect

Optuma Forums Optuma Scripting Cross of MAs Appears Incorrect

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #69085
    Ben
    • Topics: 1
    • Replies: 0
    • Posts: 1

    I am writing a script to scan ASX shares to find which have their 6EMA cross the 10SMA in a certain date range. I found an example script in the knowledgebase which to my thinking produced the results I would expect. It was:

    In the following example the script is looking for each 25EMA crossing above a 50EMA since the 1st of January 2008.

    V1 = MA(BARS=25, STYLE=Exponential) ;
    V2 = MA(BARS=50, STYLE=Exponential) ;
    V3 = V1 CrossesAbove V2 ;
    ACC(V3,RANGE=Look Back Period, BACKTYPE=Date, STARTDATE=2008-01-01)

    Adapting some of the parameters, I wrote:

    v1=MA(BARS=6, STYLE=Exponential);
    v2=MA(BARS=10);
    v3 = v1 CrossesAbove v2;
    ACC(v3,RANGE=Look Back Period, BACKTYPE=Date, STARTDATE=2022-08-23)

    Scanning with this script produced several hundred results from all the ASX shares. However, picking one at random to validate the result, it was obvious that the resulting chart was not the expected outcome of the script (see the attached image).

    From the attached image, I would have expected that the chart would not be included in the result because:
    (a) The 6EMA is actually below the 10SMA.
    (b) There was no crossing of the 6EMA and 10SMA between 23 Aug and the last day (26 Aug).

    Any suggestions on what I am doing wrong?

    #69093
    Darren
    • Topics: 71
    • Replies: 880
    • Posts: 951

    Thanks Ben. Please ensure that the tools on the chart have the same settings as the scan formula. For example, your script MA(BARS=6, STYLE=Exponential) will be based on the average of the High, Low, & Close (HLC) by default, which may be different from the tool on the chart.

    To change, click on the MA() text in the script editor window and change the Calc Using option to Close:

    Capture

    Additionally, if you just want to know those that crossed in the last week use this formula with the Date Range setting in the Scanning Manager setup as Last Week:

    Capture

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Pin It on Pinterest