Internal bar strength QQQ strategy

Internal bar strength QQQ strategy

Here is a simple “long only” automated strategy built upon the mean reversion behaviour of the QQQ ETF. It uses the Internal Bar Strength indicator which represent the weight of the closing price related to the day’s range. It is a simple indicator that point the fact that deepest close would regain on the few next days. This indicator is the same as a stochastic oscillator with only 1 period = short term deviation from the price mean would expect that price will came back to it.

When the IBS (or stochastic oscillator) fall below the 10 level, buy at next open. Close the trade if a candle close above the previous day high.

I also add a dynamic lot calculation made upon the strategyprofit. You can change the value of the “initial lot” (100 shares at start) and the “step profit” which add more shares whenever the strategy gain a new stepprofit (50$ by default).

This strategy would be adapted to other indices, i will certainly go forward on 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. alfredo • 02/08/2016 #

    Ciao Nicolas, how said on fb I’have a problem with this strategie, some times go in crash in time frame at 1 hour because need of a protection by a division of zero for last candle, you can help me? Thank for all.

  2. Nicolas • 02/08/2016 #

    Hello alfredo, there are only 2 divisions in the code, that may cause crash of the script. Have you made any modifications to the original code strategy? Thank you.

  3. alfredo • 02/08/2016 #

    Yes, thi is code modified
    defparam cumulateorders=false
    STO = (Close – Low) / (High – Low) * 100
    If LongOnMarket AND Close>High[1] THENSELL AT MARKETENDIF
    if not shortonmarket and sto>90 thensellshort 2 contracts at marketendif
    if shortonmarket and close<low[1] thenbuy at marketendif
    set stop $loss 250

  4. Nicolas • 02/08/2016 #

    I do not have any error Alfredo, even while testing on 150000 bars in the past. By the way, you should use EXITSHORT : to exit a short position. I have change your code accordingly :
    defparam cumulateorders=false

    STO = (Close - Low) / (High - Low) * 100

    IF NOT LongOnMarket AND STO<10 THEN

    If LongOnMarket AND Close>High[1] THEN

    if not shortonmarket and sto>90 then
    sellshort 2 contracts at market

    if shortonmarket and close<low[1] then
    exitshort at market

    set stop $loss 250
    Where does your error appear? Is it a ProRealTime window?

  5. alfredo • 02/08/2016 #

    thank for the council, when i do start the strategie on Italy at 1h some mornings happen that i find the sistem interrupt with the error, but I’ think that in the night the graph does not form some candle, maybe I’should make the strategy work from the 09:00 to 17:00 because the results are better, what do you think? 

  6. Nicolas • 02/08/2016 #

    I think it’s because of price gaps and/or quote interrupt. Anyway, be aware that this strategy were made to work on a daily basis and not in intraday, but if you can make it better, do it! 

Register or


avatar avatar
Related users ' posts
victormork Hi! No I don't have 200k history.
Yannick There is a huge drawdown from 2012 to 2013 after it keeps rising
victormork Thanks for sharing the 200k test!
Robin von Bauhn Here you go! Would like to hear your feedback :) cl = RSI[2]100-a if cl and close &...
Francesco78 Sorry there might be few typos, pls send the full code. Thank you
Robin von Bauhn Oh, it's "cs" that's missing. I don't have the code right now but it's the exact same condit...
atlante je me demande si prorealtime pourrait etre programee sur fonction lorsquún point cgange de c...
lizmerrill can you provide this code for tradestation, please. Thanks
Nicolas No sorry, please use this file instead into a prorealtime trading platform.
StantonR Got good results on ZAF 1hr timeframe
Wilko Great!
Wilko Thanks for letting the community know!
lizmerrill can you explain the flow of the code, just to clarify. RE:fullness = (Dclose(0)-Dopen(0))/ab...
Francesco78 hi Lizmerril, yes, that is correct
lizmerrill Thanks for replying, so.... I assume in your backtest, the fullness calculations using dclos...
diegofe_2000 cordial saludo NICOLAS , gracias por excelente indicador. ¿ es posible obtenerlo en MT4 ? ...
Nicolas Lo siento, pero no estoy trabajando para ayudar a la gente aquí de forma gratuita para promo...
diegofe_2000 Nicolas , gracias por tu atención. La pregunta era por curiosidad (yo no trabajo ni manejo ...
9 months ago
HerveS_67 Bonjour, A quoi correspondent les données S, M, L ? Hello, What do the data S, M, L?
gabri Excellent job like always!! are you working also on the Barycenter indicator?
Nicolas No but I think you can find a lot of different version of the "center of gravity - COG" indi...
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...
JR1976 HI all , anyone test 200k bar for this great code ?
David Nicolas I've looked at it again and there's a problem.  As an example here's a simple cross...
Nicolas You'll need to preload bars to get the good calculations of you indicators. I did not test i...
David Nicolas I tried DEFPARAM Preloadbars = 5000 And still the same drawn output of entries/exit...
rpreviteri Hi Nicolas, thanks a  loto for sharing your knowliedge, Wasn't the original momentum pinball...
air Thank you!  
elanoa Buonasera sig. Nicolas......sarebbe possibile far in modo che quando l'indicatore raggiunga ...
Dimi.A Perfect for counter-trend scalping. I like this!
leyoy Elles viennent d'apparaitre après redémarrage. Merci Nicolas. Du coup, les signaux sont à pr...
patrick3 Merci Nicolas pour cet indicateur, il me tarde de faire les tests
helloe do u have same indicator for mt4 ? as mq4 ?
jctrader Bonjour . CAC 40    1988 = 1000   today = 4900  soit 490%  en buy and hold  .... + 370% av...
Nicolas Aucune immobilisation du capital. Quel est le drawdown du buy & hold ? Je ne l'ai pas ca...
jctrader ok pour le codage mais le choix "indice" n'est pas le bon : moins de 5%/an pour le meilleur ...
DonDollar ...and I do not see any opened positions...strange...
DonDollar I found the answer by myself for the second question. But still no idea about the False and ...
Nicolas The line 12 of the code is the answer of your question. Before launching a new trade, the co...
patrick3 Merci Nicolas pour cet indicateur, il est très utile pour voir les vagues