Moving Average Daily

Moving Average Daily

At this stage ProRealtime doesn’t have multi timeframe capabilities. However one easy possibility is to use the moving average of the daily timeframe with the options of DOpen, DHigh, DLow, DClose and that’s what this indicator enables you to do. You can select the number of periods ie. Days: number of periods/days (please note there’s a limit depending on the timeframe you use this on and there’s a difference between PRT and IG data periods) open/high/low/close, etc… If you are going to use this in a live trading account you will need to set: DEFPARAM Preloadbars = Here is the table of how much Preloadbars you will need depending how many periods you want to look back.  The column max days shows the maximum of what you can set Preload to.

As an example of you are using a 10 minute timeframe the maximum DEFPARAM Preloadbars = 5000 // maximum is 5000 and this is equal to the moving average of 35 days.

DEFPARAM Preloadbars =
60 24 5000
Minutes bars per hour bars per day max days
1 60 1440 3
5 12 288 17
10 6 144 35
15 4 96 52
30 2 48 104
60 1 24 208

You should find this indicator useful if you are trading mean reversion system and want to make an entry a timeframe less than the daily while using the daily moving average as the mean.

REMINDER: if you want the indicator to appear in the Price section of the chart, you must add it by clicking on the spanner icon on the little Price tab in the Price window.

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. Nicolas • 12/20/2016 #

    Thanks a lot, a lot of people will find it useful!
    About customclose of the daily OHLC, you could have compute them this way: (totalprice for instance)
    LMA = ((DOpen(i)+DHigh(i)+DLow(i)+DClose(i))/4) + LMA
     

  2. David • 12/20/2016 #

    Unfortunately the PRT is unreliable. 
    I made a simple 7 day moving average crosses over 30 day moving average but Pro Realtime opens position even though there’s no cross over.
    I tried to provide a screenshot but I keeping getting a HTTP error.

    • Nicolas • 12/20/2016 #

      Did you change trading hours or weekends data of the tested instruments? Calculate the daily moving average like the author do it in this code means a lot of preloaded bars, did you adapt this parameter correctly? 

    • David • 12/20/2016 #

      Nicolas, I wrote the code and I have DEFPARAM Preloadbars = 3000 on m60 so that’s plenty of preloadbars.
      As far as I know I didn’t change the weekend data of FX. But the drawn moving average lines do not cross many times but the position open and they should not open. So no one else is having this issue?
      I am running the Demo of 10.3 via IG so maybe that’s having an issue?
       

    • Nicolas • 12/20/2016 #

      How do you call this indicator in you trading strategy code? Did you make a CALL? Have you tried to GRAPH the returned variables of the indicators while backtesting?

    • David • 12/20/2016 #

      I’m using the call function. I checked again and it seems okay now on Demo and Live testing. Luckily I took a screen shot otherwise I wouldn’t believe that there was an entry issue as per my initial comment. 

  3. David • 12/20/2016 #

    Nicolas I’ve looked at it again and there’s a problem. 
    As an example here’s a simple cross over system and you can see the entry and exit is not at the cross over. It’s even worse if you use <> for the daily moving averages for the BUY. I made 2 instances of the indicator and Call the indicators Moving Average Daily with DHigh and DLow. I’m still having HTTP error when trying to upload a screen shot. Here’s a screenshot https://ibb.co/na7LDv 
    I look forward to hearing what results you have Nicolas. 
     
    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated

    // Conditions to enter long positions
    indicator1 = CALL \"Moving Average Daily HIGH\"[14]
    indicator2 = CALL \"Moving Average Daily LOW\"[50]
    c1 = (indicator1 CROSSES OVER indicator2)

    IF c1 THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF

    // Conditions to exit long positions
    indicator3 = CALL \"Moving Average Daily HIGH\"[14]
    indicator4 = CALL \"Moving Average Daily LOW\"[50]
    c2 = (indicator3 CROSSES UNDER indicator4)

    IF c2 THEN
    SELL AT MARKET
    ENDIF

     
     
     

    • Nicolas • 12/20/2016 #

      You’ll need to preload bars to get the good calculations of you indicators. I did not test it myself though. 

  4. David • 12/20/2016 #

    Nicolas I tried DEFPARAM Preloadbars = 5000
    And still the same drawn output of entries/exits not at the drawn Cross Over  around 2 days earlier than the drawn Cross Over /Cross Under. 

  5. marcara • 12/20/2016 #

    Hi, Thank you very much for the Moving Average Daily indicator, I am using it as indicator in an intraday chart so I would like to preload bars. I tried to add at the beginning DEFPARAM CalculateOnLastBars = 5000 but it seems that it is doing nothing. If I use DEFPARAM Preloadbars = 5000 it claims that it is only used in Probacktest. Thanks in advance

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar
Related users ' posts
Gio56 Super idée. j'ai juste un souci. j'ai pas de barre verte mais plusieurs lignes de couleurs.....
DeathMetal change line in histgram, (click on indicator name, click on tool (
Gio56 Super merci.
jacquesgermain Bonjour non pas de soucis car src=customclose donc dans le menu configuration/propriété me...
geroniman Merci Jacques , indic tres utile. J'ai un indic à programmer avec du price action. es tu dis...
jacquesgermain ok pour regarder ...
Nicolas
1 year ago
f1_maik Ein sehr schöner Indikator, vielen Dank. Wenn ich den Indikator importiere und starte hat d...
Nicolas das ist in der Tat normal, Sie müssen die Auf- und Abwärtsfarbe direkt im Parameterfenster d...
FXtonio Bonjour Nicolas, merci pour cette merveille, je l'utilise en compl2ment du "magical buy sell...
supertiti Bel outil si on ne se tape pas sur les doigts avec ! Comment ajoute-on une image avec le co...
Patrice210 bonjour STANKO, effectivement la première ligne apparait en anomalie et je ne comprend pas v...
KumoNoJuzza Hi guys, Thanks @Stanko and everyone for your contributions. I have been playing around ...
Stanko Hi KumoNoJuzza, thanks for the post. I also tried your code with Dax and the performance is ...
magnus59 Hi Nicolas, thaks for your great work here, I need a scanner for the swedish OMX when ma...
Nicolas Yes, sure please open a new topic in the ProScreener forum section, thank you.
paullyons Hello! Thanks for post your indicators. I'd like you to let me know how to draw lines for ...
Rafa Hi Nicolas! I can´t install this indicator. it installs in a separate window not as an av...
Nicolas Add it on the price, see how: https://www.prorealcode.com/blog/video-tutorials/how-to-add-an...
Frankyslo1 No consigo instalarlo en el precio en PRL-version 10
Roland57800 Bonjour Noobywan, si je comprends bien l'utilisation de ce code que je trouve particulièr...
Noobywan Bonjour, quand la question a été posée dans le forum à celui qui avait fait la requête en am...
Fabian This Code draws only a retangle if the condition has been confirmed and NOT before (in that ...
RakeshPoluri I have a question about the bands on the candles. Is it bollinger bands or something else?
Nicolas I think that's 2 Bollinger Bands
Emperor.it "style(line,2)" C'è una guida ai parametri che si possono modificare ? Tipo stile della lin...
IV Mcm https://www.prorealcode.com/programming-with-prorealtime/
fazel53 How do i attach this indicator to my mt5 platform?
Nicolas You can't! All indicators here are for ProRealTime trading platform: https://www.prorealtime...
Nicolas c'est exactement ce que je fais entre les lignes 58 et 64 pour pouvoir tracer la ligne complète
Italo Fabian Nicolas, Ces matrices sont-elles des vecteurs unidimensionnels ou multidimensionnels? Depu...
Denis Bonjour Nicolas et RicLg, Merci Nicolas pour cet indicateur intéressant et merci RicLg pour...
Nicolas Il faut l'ajouter sur le prix avec l'icône de la clé situé en haut à gauche du graphique du ...
jerome777 merci de ta réponse
jerome777 bonjour c est bon il fonctionne parfaitement merci beaucoup
kbrooks323 Hello would someone be willing to release a scan code for this? that would be helpful as I s...
Nicolas You can do easily this screener by using the assisted creation tool. It would take you about...
kbrooks323 I just figured it out thanks!
Vinks_o_7 Thanks Doc !
Maxime Baudin Intresting, thank you!
frenqle Hi There.. It seems the TSL stop loss is not working.. it does not respond is that correct?
Ciccarelli Franco Per lasciare che la strategia venga eseguita (dopo aver importato il file): Basta eliminare...
JADINVEST Hello Jan, hello everyone, Thanks Jan for this strategy! Since 2020, have any of you found a...
FXmike hey my friends, thank you for this great code. my problem is he make no trade open. backtest...
FXmike Can i put a Action that my start contract is smaller than 1 ? 0.3 or 0.5 ? In wich Position...
phoentzs I wrote the code for M15 back then and also variants in H1 and M1. Everything works so far....

Top