Market Phase

Market Phase

Inspired by a script seen on TradingView, I translated and adapted this indicator.

It shows the relation of price against different period moving averages.

The arrows indicates possible retracements in a general trend direction, so they can be used as entry point.

No ground breaking math here, but I am finding very useful and some algo based on it is giving good results in demo live.

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. cjr30 • 84 days ago #

    Please, could you tell me how can i to put yours colours on the indicator and how colour the zones.
    Thanks and sorry for my english

  2. luxrun • 84 days ago #

    AlexF, thanks for the market phase indicator; please, you could give an indication of how to set the resulting graph (color zones and line colors) in order to reproduce a visual effect similar to yours. Thanks again

  3. AlexF • 84 days ago #

    Set the “phases” as histograms with different shades of green and red for above/below zero. Set the other ma values as lines.

  4. Jan Wind • 82 days ago #

    Thanks for the post !
    Have you tried it with the volume indicator, maybe it gives another good restriction /confirmation for a trading strategy?
    At least I will try around with this indicator for a trendfollowing strategy.
    KR Jan

  5. Jan Wind • 81 days ago #

    I added the (boring) coloring coding to this indicator, see below, so the indicator will immediatly be colored when you add it,

    // This indicator shows the relation of price against different period ma’s.
    // When put in daily Timeframe it gives the 1400 Day (= 200 Weekly) and the 200 ,100 an 50 Daily.
    // Features:
    // – The lines show the 200,100 and 50 ma in relation to the 1400 ma.
    // – The arrows indicate possible (retracement) entry points
    // Coded by AlexF

    if ma50 < 0 then
    r = 255
    g = 0
    b = 0
    r = 0
    g = 128
    b = 0
    if ma100 < 0 then
    r1 = 192
    g1 = 0
    b1 = 0
    r1 = 51
    g1 = 204
    b1 = 51
    if ma200 < 0 then
    r200 = 255
    g200 = 51
    b200 = 0
    r200 = 153
    g200 = 255
    b200 = 102
    if ma1400 < 0 then
    r14 = 162
    g14 = 43
    b14 = 30
    r14 = 204
    g14 = 255
    b14 = 153

    if dma50 < 0 then
    dr = 255
    dg = 0
    db = 0
    dr = 0
    dg = 128
    db = 0

    if dma100 < 0 then
    dr1 = 192
    dg1 = 0
    db1 = 0
    dr1 = 51
    dg1 = 204
    db1 = 51

    if dma200 < 0 then
    dr2 = 255
    dg2 = 51
    db2 = 0
    dr2 = 153
    dg2 = 255
    db2 = 102

    return ma1400 coloured(r14,g14,b14)style(histogram) as "1400 phase",ma200 coloured(r200,g200,b200)style(histogram) as "200 phase", ma100 coloured(r1,g1,b1)style(histogram) as "100 phase", ma50 coloured(r,g,b)style(histogram) as "50 phase", dma50 coloured(dr,dg,db)style(line,3) as "50", dma100 coloured(dr1,dg1,db1)style(line,3) as "100", dma200 coloured(dr2,dg2,db2)style(line,3) as "200", 0 as "zero"

  6. winnie37 • 81 days ago #

    thanks, could you post somes algos suggestions to improve, based on this indicator?

  7. Jan Wind • 81 days ago #

    Hallo Winnie37,
    Not sure about your question,
    I will have investigate if I can make a new trading algo for myself based on this indicator. I am a trendfollowing trader, so I hope this indicator can contribute..

  8. winnie37 • 81 days ago #

    yes. “No ground breaking math here, but I am finding very useful and some algo based on it is giving good results in demo live” in description; I investigate too but not very good results for the moment…

  9. Jan Wind • 78 days ago #

    Also interesting to know what does not work, which set up you use, saves me investigating ! Do you mind sharing this ?

  10. winnie37 • 77 days ago #

    i just set the proorder like this: buy when 50/100/200 phase >0 and sell when under 0, good backtest but no effective trades in demo…strange thing…Ok to share 🙂

Register or


avatar avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
camporan You can use it 5M onwards, but the longer timeframe the more accurate it is. My preferred ar...
manchokcity can we have it in mql4 platform? or how or which platform do we use it?
camporan I don't use MetaTrader so I won't be able to do the translation myself. Sorry!
ggolfet I tried to use it (with prorealtime version 11 - end of day version). I receive an error mes...
Nicolas Try to reduce the displayed units of the chart. MaxScale should always be superior to Start...
ggolfet Thanks Nicolas, I imported the itf file and solved the problem.
3 months ago
Jan Wind fatcat, sorry to hear. Today I did run the code for 100.000 bars (from 17 dec 2017 till 31 ...
GraHal I confirm that I get almost exactly the same (+7 days difference now) results as Jan states ...
Jan Wind A discussion Topic is opened, and can be found at
Francesco78 derschnee spiace a me che non riesci a replicarla. Prima di esprimere giudizi pensaci 2 volte.
unkown ;-) sfido chiunque a riuscirci!
unkown infatti basta leggere i post degli altri....
juanj DId some tests using MACD validations on higher timeframes using MTF functionality and unfor...
FREDNC Hi Francesco I tried with :
FREDNC adx[14]>adxmin and adx[14] > adxr[14] and adx[14]>adxmin and adx[14] DIminus[3](clo...
Stenozar Thanks Leo!
Madrosat Hi Leo something is missing in the strategy above because it does not work at all as it is
Leo I don't know, I just copy paste the strategy. The optimisation of the values I wrote them in...
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.
Vonasi Discussion on this indicator/filter can be found here:
Vonasi Forum discussion on these indicators can be found here:
jennr29 Hi. Is it possible to convert this code to an mq4 file?
Nicolas Sorry but our website is dedicated to prorealtime programming. However, you can ask for priv...
Leo Does it opens pending orders?... maybe they were not trigger.
Mattzi Dont know, all i can see is that it opened an order yesterday in backtest but not live. Th...
Jean-Christophe Hello Leo, when running the strategy from 29/12/2015 to 31/08/2018 on ProRealTime Premium, I...
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...
Geronima Ortiz I watched the video three times, but I can not put the npips parameter as a variable. I do...
Geronima Ortiz I think the video is for an old version of prorealtime, the images do not correspond at all ...
Nicolas indicator1 = CALL “PRC_StopReversal”[npips, 1] and define npips in the optimization window ...
Tradingrob Is it possible to make this indicator also suitable for dax30, s&p500, mdax50, and even...
Pablo Jimenez Hello, Odin , thanks for this amazing strategy. One question , would it work for indexes cfd...
Juanjo Hola, Gracias por la estrategia. Cuando comentas que funciona para todos los mercados, ...¿f...
Caribeengeek Bonjour j’avais vu que vous proposiez d’écrire des codes pour ceux qui s’y connaisse pas Mai...
Caribeengeek Les devises unité
Nicolas Merci d'utiliser le forum pour les demandes de programmation personnalisée
Actabi Thank you ! Have you realised your "next step" ?
Jessar guten Tag, gibt es bereits die Aktualisierte Datei?
Per Inge Gents - An update - I have been studying various trading approaches, as this one that is bas...