Time Range Moving Averages (Simple-Exponential-Weighted): TRSMA – TREMA – TRWMA

Time Range Moving Averages (Simple-Exponential-Weighted): TRSMA – TREMA – TRWMA

Following a request by user discovery2005 (https://www.prorealcode.com/topic/media-mobile-a-tempo/) on the italiam forum, I coded these 3 MA’s to limit calculations to the desired time range, without being affected by data outside that same range.

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. Jan Wind • 05/22/2019 #

    Good evening Roberto,

    I do not understand Italian, so I could not read the background.
    Why coding the EMA’s for a certain time within a day, as you can also adjust the graph for trading hours at Options –> Platform Options at Trading Hours ?
    I would think it slows down the rebuilding of a graph when you would have more then 1.000 bars

    KR Jan

  2. robertogozzi • 05/22/2019 #

    Results, while matching when it’s SMA compared to TRSMA, are different in the case of WMA and EMA even when using the same custom hours.
    So, since it was requested on the forum, this must be the reason of its possible use.

  3. Khaled • 05/22/2019 #

    Hi Jan and Roberto, I agree, if you adapt properly the Trading Hours in Plateforme Settings, you are not supposed to calculate Indicators “manually” (I mean using coding).
    But, how would you do if, for example, you want to calculate the average volume intraday, updated at the end of each 5 min candle? the SMA[n](Volume) doesn’t do the job and you need to update the “n” manually if you’re scalping.
    Besides, if you look at IG Markets DAX CFD on 24th Dec. 2020, on a 5 min TF, you can see price changes but Volume always 0, so if you want the SMA[20](Volume) on a 5 min TF, you will get one day of zero volumes included in the SMA.
    (For some reason, I cannot add a graph with posting a reply to an exsiting post)

  4. SkippyTrader • 05/22/2019 #

    Does the EMA calculation have an issue? I can see that on the chart it keeps moving in the non-trade hours range: instead of a straight line between close of yesterday and open of today.

    Would it more correct as such to change the ‘Line 15’ ? To something like:

    IF (opentime >= StartTime and opentime<=EndTime) THEN

    TREMA = close

    endif

    ?

  5. robertogozzi • 05/22/2019 #

    It surely CHANGES even when currently outside time range, as the lookback periods change as well, thus making past calculations different each time.

    • SkippyTrader • 05/22/2019 #

      Thanks Roberto, but shouldnt the values in the outside time range not be different? As it should be the same at whatever the values were at “EndTime” until the next “Starttime” of which then the values calculate on the Bar[1] values which are whatever yesterdays Endtime values were, right? The time outside time range should be a constant = EndTime values ? The lookback period shouldnt be changing outside the time neither, as say Bar[1] at any time between opentime>Endtime and opentime<StartTime should be the EndTime's bar, and thus a lookback period of [14] at any time outside of the market should be the same lookback period of 14 bars before the EndTime ?

      Or have i confused myself on using this to calculate on only trading time range bars?

  6. robertogozzi • 05/22/2019 #

    Actually it is a constant (I tested them on a 1-hour TF, 9am to 5pm) and outside that time range it’s flat.

avatar
Register or

Likes

avatar avatar avatar
Related users ' posts
P. Marlowe Muy bueno. ¿Podría hacerse para señalar extremos por el lado bajista? Lo mismo a la inversa....
Miro Esta es una versión del indicador, para ambos extremos. //-------------------------------...
P. Marlowe Muchas gracias ¡¡
jordan //---settings MAmode=0 Period=150 NumberOfMA=100 //---end of settings MA2=undefined ...
jordan dites moi si cela correspond à ce que vous cherchez
kats bonjour merci de ta reponse mais non ca fonctionne pas sympa quand même d'avoir essayé cdlt
Stenozar Ciao mi restituisce errore line 1; forse è perchè utilizzo la versione 11 ? in questo caso d...
Stenozar Ciao IVAN , mi da errore per la riga 49 "print tema low"; puoi suggerirmi la modifica da met...
Iván Avete provato a scaricare il file .itf?
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
2 years 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...
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
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...
Alessandro Furlani Hi Ian, hope you still use PRT and so you can read this post. I have tested a lot your work ...
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