Simple Moving Average Crossing Areas

Simple Moving Average Crossing Areas

Hi all,

I create and indicator that highlighted the moment previous to a crossing SMA and the moment afterwards. What is called “Golden Cross” and “Death Cross”

The indicator is very simple but an be very usefully for an automatic strategy. Because it shows in real time the moment where is inevitable the crossing of two Simple Moving Average and the moment afterwards.

How it can be used? well I can imagine an strategy using it as a filter for Higher Time Frame or multi crossing of SMA in different time frame.

Hope you like it.

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?

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

  1. Kris75 • 140 days ago #

    Hi Leo

    Line 2 period = 100 // => period002 right ?

  2. Leo • 140 days ago #

    Yeah. Inputs are period001 and period002. Strange… I think the post were edited. Anyway

  3. Carlos Garcia • 139 days ago #

    i think must check the code

  4. Leo • 139 days ago #

    Period001 and period002 are the inputs of the variables. When I update the code the fisrt two lines where not there. so you can delete them or directly import the ITF file.

  5. Leo • 139 days ago #

    By the way I create a very interesting strategy that look very nice even in walkforward test ( just tested in AUD/USD in 5min timeframe)


    //Period001= //from 10 to 40 step 10
    //Period002= //from 120 to 300 step 30
    //Period003= //from 10 to 40 step 10
    //Period004= //from 120 to 300 step 30
    //Pentry= // from 7 to 28 step 7
    //Kp= //from 1 to 2 step 0.5


    //Crossing areas definiton
    IF WMA001 > SMA002 and WwMA001 < SMA002 then
    IF WMA001 SMA002 then

    timeframe(1 hour, default)
    //Crossing areas definiton
    IF WMA003 > SMA004 and WwMA003 < SMA004 then
    IF WMA003 SMA004 then


    ONCE PXentry=round(0.6*Pentry)
    IF highest1 = highest1[PXentry] then
    IF high > Re1 then
    IF lowest1 = lowest1[PXentry] then
    If low 3 and hour<22 and DayOfWeek<=5 then
    // Bedingungen zum Einstieg in Long-Positionen
    IF NOT LongOnMarket AND CrossingBULL1=1 and CrossingBULL2=1 THEN
    stoploss=(close – S1)/pipsize +2*pipsize
    SET STOP PLOSS stoploss
    SET TARGET PPROFIT Kp*stoploss

    // Bedingungen zum Ausstieg von Long-Positionen
    If LongOnMarket AND CrossingBEAR1=1 THEN

    // Bedingungen zum Einstieg in Short-Positionen
    IF NOT ShortOnMarket AND CrossingBEAR1=1 and CrossingBEAR2=1 THEN
    stoploss=(Re1-close)/pipsize + 2*pipsize
    SET STOP PLOSS stoploss
    SET TARGET PPROFIT Kp*stoploss

    // Bedingungen zum Ausstieg aus Short-Positionen
    IF ShortOnMarket AND CrossingBULL1=1 THEN


  6. Stenozar • 139 days ago #

    Hi Leo, can you explain how the strategy works? I don’t know how to program and so it’s not easy for me to understand it by reading the code. THANKS!

  7. Leo • 138 days ago #

    Two SMA are crossing in a time frame (5min) while another 2 SMA are crossing in a higher Time Frame (1hour) stop loss is set to next support resistace.

  8. Stenozar • 138 days ago #

    Thanks Leo!

  9. Madrosat • 135 days ago #

    Hi Leo
    something is missing in the strategy above because it does not work at all as it is

  10. Leo • 134 days ago #

    I don’t know, I just copy paste the strategy. The optimisation of the values I wrote them in the code: line 3 to 8

Register or
Related users ' posts
Balmora74 Hi Jerke and thanks for your return. I choose the values because they gave me the best equit...
Dymjohn Great work I've changed the trade quantity to reflect whether price is above or below the 20...
PacoLopez Hello Balmora, good morning. Nice code, Thanks for sharing. I just read from your comments ...
osupero Buenisimo Sr Nicolas, seria posible que sólo marcara por encima o por debajo de una media mo...
capgros Bonjour @Nicolas, Thanks a lot for this tool, it is very useful for me. I would like to s...
Nicolas Alpha transparency from 0 to 255.
ehtsham Hi, Sir can you tell me how to put this code in indicator plz
Jan Wind Ehtsham, all you need to do is change the code in line 18 and line 20 (see the code above...
ottimo Congratulations Nicolas, What should I do for the 2 files I have to add them both in the gr...
Nicolas Only the "//PRC_StepALMA-VHF Hi/Lo band" is required, it uses the second code automatically....
ottimo Thank you Nicolas, great indicator, N. 1
Nicolas Yes, that's how it goes when using loops..
JosephFelix Hi, Could I please have help with adding these indicators 'on price'? Every indicator that I...
Nicolas Just add it on price by clicking the wrench on the left upper side of the price chart.
Tradingrob Hi Nicolas, when i upload this indicator in my list and use it as indicator. I get a totally...
Nicolas Apply it on the price chart. The indicator plot just one single line. There are two in the...
tradingpro salve io faccio spread trading e volevo sapere come impostare un profitto da chiudere in a...
Nicolas Per favore non fare domande generali, non correlate al post. Usa invece il forum.
Appsoluxions Hi Nicolas, do you have the MT4 version of the indicator? I am not sure if these kind of que...
Nicolas Hi, don't have one sorry. But you can still ask for private coding through our programming s...
Appsoluxions Cool. Thanks for the response.
Nicolas Yes, this could be easily programmed with the assisted creation tool.
Karthick S Hi Nicolas, Can you please share MT4 version of this? Cheers
Nicolas No. This website is only dedicated to ProRealTime programming :)
odin here is my code c1 = ExponentialAverage[3](close) c2 = ExponentialAverage[5](close) c3 ...
juanj HI Odin Can you also kindly provide the code for the 'Short Term Trader Squezze' indicato...
odin this is the short term Trader squezze indicator. short term Trader in Trouble and squezze is...
Rafa And the PriceMAPeriod? aren´t the same?
Nicolas The PriceMAPeriod is the period to make the average of all the last X medianprice found.
Rafa Thanks a lot Nicolás. Have a nice day
JanWd Hey Doctrading, I tried your code, optimising the A and V and the RSI period, see below. ...
Glen Marquis This will work as there is plenty of room for the Target before the Stop, yet the Stop would...
magicT I did a copy and paste of this code and PRT 10.3 returns a synthax mistake: OneTradePerD...
swapping merci gabri, on va le mettre à l'essai ;)
Genotik Merci de votre contribution !
Leo Hi all, I posted a new version of this indicator ( I just add arrows to spot the local maxi...
Trading_En_El_Ibex35 Muchas Gracias por compartir este interesante indicador. Un saludo
JM David, Thanks a lot and next week I begin the test of this strategy in real... You have ot...
rejo007 hello david, i'll try it could you tell me wich strategy do you use in real? thanks
David Somogyi Hello, I have a couple of DAX strategies of breakout and mean reversion. I'll try to post...