Price Index 6 months

Price Index 6 months

I wrote this strategy hoping to start some discussion on value trading vs. day trading and also to give a different option to people with little time available.

I adapted a buy-and-hold strategy based on the price index 6 months with an long-only-entry. When the close of the day crosses above 144% to the price registered 6 months ago we go long and we hold the stock for 1 year (apron 254 bars).

As I said it’s an adaptation made for automatic trading!! With Italian stocks the results are very good but might be MUCH better if you used Price to book (P/B) and  Earning yields (EY) to confirm the entry. Running this strategy manually with the use of P/B and EY12 months, and using a portfolio, returned an average of 55% a year in the last 10 years (Only one year I didn’t beat the market).

Blue sky!!!

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. Nicolas • 20 days ago #

    Very interesting but why 144%? What about the drawdown of the portfolio? The one from this single stock is already huge! 😉 

  2. Kenneth Kvistad • 20 days ago #

    I have never been wondering about long trades or made any due to overnight costs, butdo you think it still affordable for such long trades as months/years?


  3. gabri • 20 days ago #


    144% was just an adaptation to make the automatic trading. Any number between 140% and 150% is fine. You should take the 20-40 stocks with the highest 6 months Price Index and search their fundamentals to pick the right one. Drawdown are not really a factor when you buy and hold value stocks.

    This was actually a real trade I made but I bought only in September 2004 since P/B was 1.4 (expensive but not too bad for the market of that moment) and the other fundamentals were promising. What I wanted to prove is that there are bizilions of trend indicators on the various trading platforms but the real big wave worth surfing is the one started by the institutional investors and they buy GOOD companies for CHEAP. Price index (for momentum) and fundamentals are the only data they use. 

    Having a portfolio made with stocks selected with fundamentals leads to really high performances (they almost always beat the market), even better the one of this single stock.


  4. gabri • 20 days ago #


    I buy stocks, hence a part of a business. For stocks there are not overnight fees. You find overnight fees for CFD and derivatives. On top of that I go LONG only. With my bank I pay approx 3.5 Euros everytime I buy and the same amount when I sell. It’s totally worth for me.


  5. Kenneth Kvistad • 19 days ago #

    Ah okay. You can make automated trading with stocks as well 🙂 ?

    I dident know that

  6. gabri • 19 days ago #


    I manually trade only but I decided to code this strategy to show that there is more than intraday trading and this “more” might lead to substantial gains with less work and stress (on the stress I am not so sure 🙂 )


  7. luxrun • 17 days ago #

    Hi Gabri,

    I realized screener with the specifications of your trading system. Do you give me feedback on its reliability? This is the code:

    // Price Index 6 months

    thr=44 // entry threshold
    ref=close[130]*(1+thr/100) // price entry level
    cond1=(close CROSSES OVER ref)

    SCREENER[cond1] (Variation AS “% Var barra prec”)


  8. gabri • 17 days ago #


    I would personally  just make it like this:

    thr=44 // entry threshold
    ref=close[130]*(1+thr/100) // price entry level
    cond1=(close > ref)
    SCREENER [cond1] (ref AS "Price index")

    so you can see ONLY the stocks that meet the condition and they will be ordered by the amount of gain in the last 6 months. You want to pick the top 20-30 stocks in the list so the amount of gain is important. Like I already mentioned 44 is not a fixed umber. If you’d rather use a yearly return you can lower the threshold to 30-ish. The setting are very personal.


  9. gabri • 17 days ago #

    Also, don’t forget to make sure you are buying stocks with low Price to Book ratio.


  10. gabri • 16 days ago #


    I wrote the previous answer in a rush. Try this code:

    thr=44 // entry threshold
    ref=close[130]*(1+thr/100) // price entry level
    cond1=(close > ref)
    SCREENER [cond1] (pi6m AS "Price index")

    Now you will see the stocks that meet the requirement and they will be ordered based on their gains. Sorry for the wrong code of before.


  11. luxrun • 15 days ago #
    Thanks Gabri for your screener rework. I'm working on producing the indicator to get the graphic signal on the chart. It seems to me important to understand when it signals in the six months considered by the trading system. Luxrun
  12. gabri • 15 days ago #


    non ho o capito di cosa hai bisogno?


    • luxrun • 15 days ago #

      Nulla di particolare! Scusa il mio inglese tradotto da google. Dicevo solo che sto provando a costruire l’indicatore che mi mostra a video quando scatta il segnale long, nei sei mesi che il trading system, prende in considerazione. Non serve a molto, ma forse aiuta visivamente. Grazie Luxrun

  13. gabri • 15 days ago #


    no problem per l’inglese. Ti posso fornire due soluzioni. La prima disegna la linea del 44% e quella del prezzo:

    return linea1 style (dottedline,1) as "44%",close coloured (205,0,0) as "Close"

    La seconda ti disegna il ritorno degli ultimi 6 mesi e quando passa il 44% ti segnala la zona positiva:

    return a,44


  14. luxrun • 15 days ago #

    Benissimo, grazie, molto gentile e disponibile! Lo provo subito.  Io avevo scritto questo codice (ma programmo poco e male…), per l’indicatore:

    // Price Index 6 months indicator

    thr=44 // entry threshold
    ref=close[130]*(1+thr/100) // price entry level

    // conditions to verify entry long
    c1 = (close CROSSES OVER ref)

    IF c1 THEN

    cross = 1


    return cross as “CROSS”

    • gabri • 15 days ago #

      Il tuo codice va benissimo, continua cosi’!! dovresti solo aggiungere una linea per fare in modo che cross non rimanga sempre uguale a uno:

      c1 = (close CROSSES OVER ref)
      IF c1 THEN
      cross = 1
      return cross as “CROSS”

      in questo modo ti da dei picchi quando avviene il cross over (e solo quel giorno). Oppure puoi fare cosi’:


  15. gabri • 15 days ago #
    c1 = (close CROSSES OVER ref)
    c2 = (close CROSSES under ref)
    IF c1 THEN
    cross = 1
    IF c2 THEN
    cross = 0
    return cross as “CROSS”

    In modo che cross rimanga uno fino a che il valore di gain e’ superiore alla soglia.


  16. luxrun • 15 days ago #

    Grazie, Gabri, per il tuo supporto e aiuto. Ti sono veramente grato! Continuerò a seguire il tuo lavoro! L 

Register or


avatar avatar avatar avatar avatar
Related users ' posts
Juan Salas Hi, I got the same problem in Oil USA 10'. The system was canceled because there is a divis...
Francesco78 I have opened a forum thread as suggested by Grahal in order to make discussion more confort...
Kv6 Hola Francesco, Muy buenos resultados. No obstante, cuando pongo el código a funcionar, a...
Wilko Thank you all for your comments! I treat shorting very separately from the long side, at lea...
gabri Wilko,  great code!! I never worked with RSI2 and I found it very interesting. I made some ...
Wilko I'm happy my code snippet inspired some new thoughts! Thanks for the feedback!
Kenneth Kvistad What does buy 1 «perpoint» means? I also see there is some inside candlestick trades that i...
Francesco78 Kenneth, it means that the tick value is 1 euro
Kenneth Kvistad Francesco, can you try to make this strategy with short and long proffit tragets just like i...
Stenozar Hi Francesco, thanks for your code. May I have your email? I'd like to send you a message. ...
Francesco78 Hi Stenizar and thank you! For the email, I think the rule of the forum is to ask Nicolas t...
Stenozar OK Francesco, thanks
CKW Thanks Pier! Excellent! I add the SL capped at 0.8% for safety purpose. The Backtest perfor...
JR1976 Dear Pier ,  your screenshot which rappresent the backtest , is since dec 2009 , but the eq...
CKW Dear Pier, Does it work on forex?
Wing The system trades 1 to 3 contracts, and 5 under extreme circumstances. If trading the DAX 1 ...
Stefanb Wing Can i find you on Twitter?
Toto le Heros Hi Wing, Your code looks quite interresting. I was wondering if you could develop a bit mo...
Nicolas Please send it to me with the contact form, thanks.
Magnus Park Hi! Thanks for sharing! Have the code been swapped to the new one? or is it the first one st...
corne Hi there - is there maybe somewhere a new version available to look at?
Francesco78 hello Prince Myshkin. Thank you for the time you spent on my code. Im currently travelling, ...
PrinceMyshkin Enjoy your travels!
Francesco78 Hi Prince Myshkin I was interested that you chose a 3 day (72hr) period for your ATR calc. ...
Nicolas Thanks for sharing your automated trading strategy idea. Even if you accumulate loosing orde...
Maz Ok. Potential here to build onto this. Have opened a forum thread for further discussion: h...
juanj Okay so today the strategy again immediately stops out. Since IG changed the bitcoin quote p...
IGOSNELL  Hi I cannot get it to work on IG every position taken is a loss and only longs. Any ideas?...
juanj @OGOSNELL, IG recently changed their quote prices for Bitcoin and this caused the strategy t...
2 months ago
CSR strategy DAX 1 D
CSR strategy DAX 1 D
ALE Hello GuysI'm trying to fix a problem that I missed during the probacktest, I update you as ...
Nicolas The code has been updated in the attachment of the post with the last version which contain ...
ALE Thanks as always Nicolas
pepmartorell  It seems it doesn't work, even with the change proposed by Francesco78. In fact the maximum...
Francesco78 Hi Pepmartorell, please let's continue the discussion on the forum thread so that we can sha...
Francesco78 Hi Pepmartorell, please let's continue the discussion on the forum thread so that we can sha...
reb Hello Marc your strat seems very intersting, will take a look Reb
897148 What exactly is meant by Total price? Is r1 =28 in your example the no of days for "Total P...
3 months ago
Francesco78 thats weird, I get a completely different result..
Francesco78 I cant attach the picture here, shall we exchange email?
Pollux Hi Juan. Thanks for sharing. I like the concept.  I'm curious to find out what broker you ...
Maz Nice idea thanks for sharing. I think you forgot to simulate spread thought, in the back tes...
Maz Have added a basic framework for further optimization and left some screen shots and source ...
juanj Also change the ATR multiplier to 2 instead of 3. Slightly better drawdown.
GraHal I started he thread below as I get the results shown on image below. Please help on the Foru...
imokdesign Hi Everybody, when I look at the strategy I felt the need to implement a Moneymanagement-Sy...
Francesco78 Hi Keemax, I dont have it on real at the moment, in any case the strategy is very long term ...
Francesco78 I did a little bit of work on that and now the results looks better and more stable. Please...
Francesco78 I did a little bit of work on that and now the results looks better and more stable. Please...
Francesco78 Hi Juan Salas and thank you very much for your undeserved compliments. I'm not sure if I un...
Juan Salas Hi Francesco, Yes, this is pretty much the question. The system ask me a number of contract...
Francesco78 ok sounds good, you can put min size = 1 and go for the seasonable breakout too, also you ca...
Francesco78 Many thanks JR1976 for your improvement,  although results with your filter looks better th...
JR1976 HI Francesco, in  effect  3 consecutive lose  in May and today .... doesn't work well ,  ne...
Francesco78 Hi JR, yes indeed quite disappointing in may and today, but still within the max drawdown sh...