Coding a Moving Average crossover

Forums ProRealTime English forum ProScreener support Coding a Moving Average crossover

Viewing 7 posts - 1 through 7 (of 7 total)
  • #16796

     Hi all,

    I usually have no problems with this type of code as you can basically select the criteria with ProScreener.

     However, this one is not bringing up anything at all! (even if I select it to look at all markets).  I’m basically looking to find markets where the 21 day EMA has crossed over the 400SMA within the last 100 days/periods on a daily chart.

     

     

    Any help would be great.  

    Also a random question – ProScreener shows the top 50 results.  Is there a way to view the next 50?

    Many thanks, David.

    #16802

    <p>Hi David</p><p>Have you tried changing Crosses Over  to > or < just to see if your Screener springs into life with some results?</p><p>Cheers</p><p>GraHal </p>

    #16806

    Mmm my message above screwed again … what am I doing wrong!

    I got your code working, but not above MA [250] … must be to do with the ‘preload bars’ … but I cant see a preload bars command to increaser to 400.

    There were 7 hits using Average[250](close)and Cross Over on a Daily TF.

     

    #16809

    Re  the next 50 results, I suggest you try putting a filter / limit on your sort criteria starting at result 50 so as to show result 51 to 100. Hope that makes sense? 

    #16817

    Hi,

    Thanks for your help again.  Yes it’s strange that it will allow the code to work with a 250SMA but not a 400SMA!

    Using a 250SMA however would help me spot markets that are heading towards the 400SMA anyway so that may be more ideal. :o)

    Can I ask what you mean by preload bars?

    Thanks, David.

    #16827

    You can’t get results which are oldest than 256 periods. So if you want to test a crossover of a SMA200 that occured 60 periods ago, it is not possible because a 200 periods SMA needs of course 200 periods to compute correctly and it’s getting worse with EMA for instance. This is a limitation of the Proscreener module ..

    #16844

    Preload bars are the numbers of bars that are pre loaded at the beginning of a backtest or for a screener.

    A 250 MA needs 250 bars in order to compute the Moving Average so as Nicolas says (this is his site btw :)) the limit is 256 bars … hence why the MA not give any hits above MA 256? (I didnt try 256, only 250).

    On Backtest you can select the Command ‘Preload Bars’ and enter what you wish (up to a limit). The default PreLoad on Backtest is 200 Bars.  

Viewing 7 posts - 1 through 7 (of 7 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login