Speeding up scans / alerts

Optuma Forums Optuma Scripting Speeding up scans / alerts

This topic contains 0 replies, has 1 voice, and was last updated by Avatar Steve 3 weeks ago.

Viewing 1 post (of 1 total)
  • Author
  • #52971
    • Topics: 9
    • Replies: 19
    • Posts: 28

    I’m looking for some advice re getting scans (and alerts) to run faster.

    I’m running a scan across the 28 major forex pairs. I’m looking for either positive or negative MACD (12,26, 9) divergence. The script I’m using for this (taking from another post in this forum) is below


    //Positive Momentum divergence

    NL1 = MACD(BAR2=26, BAR1=12, OSC=9, STYLE=Weighted, DEFAULT=Oscillator);

    //calculate 10 pivot Momentum low

    P1 = PIVOT(NL1, MIN=10, TYPE=Low);

    //get value of the Momentum peak

    V1 = VALUEWHEN(NL1, P1 <> 0);

    //Is Momentum low < previous>?

    Sig1 = V1 > V1[1];

    //get stock value at Momentum peak

    V2 = VALUEWHEN(Close(), P1 <> 0);

    //Is stock price lower than at previous Momentum peak?

    Sig2 = V2 < V2[1];

    //Show when both conditions are true

    Sig1 and Sig2



    I also have a negative divergence script similar to above.

    When I run a scan on a daily timeframe (across the 28 pairs) the scan takes approx 1 to 2 seconds to complete.

    When I run the same scan on a 60m timeframe, it around 1.5 minutes

    When I run the same scan on a 15m timeframe, it takes around 5 minutes.

    Ideally I would like to run the scan on 15m and/or 5m charts.

    Initially I thought that by changing the “Date Range” option, that this might reduce the number of bars used when calculating the scan results. (ie if the calculations are run on 100 bars it would take much less time than if they were being run over 2000 bars). However changing the date range value makes no discernible difference to the scan time. (I’ve tried everything from ‘last bar’ through to ‘last 5 years’)

    Because the daily scan is so quick, I don’t think it’s the script itself that is causing the scan to take so long. But i’m guessing that intraday scans are somehow using too much data (for my requirements), and I would like to reduce this amount of data, to hopefully speed up the scans to a more usable time.

    Is this possible? Would appreciate any advice or help.



Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

Pin It on Pinterest

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.