Breakout of range Trading Strategy

Breakout of range Trading Strategy

Trading system “OUT OF THE RANGE”:
The system looks at the last X candles and determines which were the highest and lowest price values during this period. When the system is activated, it automatically add two pending stop orders on market: a long stop order at Y pips above the highest detected; a short stop order at Y pips below the lowest detected.

The idea is to have 2 pending stop orders placed below the detected high / low in order to enter the position if the price goes out of the range formed during the last X candles. If at the candlestick X + 1 one of the input stop order has not been executed, the system does not touch the pending orders.
NB: the system re-calculates the input stop levels according to the new X last candles. If at the candlestick X + 1 the system has executed an input stop, then the system remains inactive during X candles, so as not to re-position input stop commands which would be distorted by the last break of a Last up / down on the X + 1 last candles.
ALSO: the system might not succeed in positioning the new input stop if the candlestick X + 1 was closing at the new high / low.

Stop orders positioned at Y pips above / below the last up / down of the last X candles must be linked; That is, if one of the orders is executed, the other stop order of the waiting entry must be deleted. It is only after executing one of the input halts that the system then waits for the formation of X new candlesticks to reposition two input stop orders. NB: Without this condition, the system would be able to position 2 orders permanently all X candles even though there are already two stop orders of input already waiting …
The system has a time schedule: At the start time, the system starts counting X candles (and not it looks at the previous X). This is to prevent the system from counting candles on Friday one Sunday for example … At the end of the hour, the system no longer counts the candles. If two orders are waiting for execution, they are deleted. And if a trade is open, it remains because it has a fixed SL and TP anyway.

This trading strategy has been coded by a request on the French forum. Please consider that there is no typical settings and it is not dedicated to any instrument or timeframe at all. This strategy is almost like a “sandbox” for studying purpose and to define suitable parameters for your preferred instruments. Current default settings come from optimisation on EURUSD 5 minutes timeframe over last 20.000 bars only.

 

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. bluetime6 • 03/16/2017 #

    Hello Nicolas.
    Can i ask you for something?
    I backtested your strategy in Dax 4H Timeframe in this way
    //PRC_Out of the range TS | strategy
    //10.03.2017
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge

    defparam cumulateorders = false

    // --- parameters

    Size = 1 //position size
    StopLoss = 60 //stoploss in points
    TakeProfit = 60 //takeprofit in points
    LookbackPeriod = 20 //lookback period to find highest high and lowest low (price range)
    PointsDistance = 5 //distance in points to add/substract from highest high or lowest low to put the pending stop orders
    // ------------

    if not onmarket and barindex-tradeindex(1)>=LookbackPeriod then
    BUY Size CONTRACTS AT highest[LookbackPeriod](high)+PointsDistance*pointsize STOP
    SELLSHORT Size CONTRACTS AT lowest[LookbackPeriod](low)-PointsDistance*pointsize STOP
    endif

    SET STOP PLOSS StopLoss
    SET TARGET PPROFIT TakeProfit

     
     
    The backtest brings around an +/- 0,00 Euro result. Is not really fine, but i see an interesting thing. The max drawdowin by 10.000 units testing is only -720 Euro. The losses in follow only 5 times!
    So the code above is likely suitabel to use with an martingale system (dangerous i know).
    So i hope you can put the martingale code snippet in the code above?
    kind regards
    blue
     
     

  2. Mirko borgna • 03/16/2017 #

    va bene anche france 40, ho modificato stoploss a 50 e takeprofit a 90

  3. Mirko borgna • 03/16/2017 #

    a 15m

  4. David29 • 03/16/2017 #

    Bonjour Nicolas,

    Merci pour ce code.

    L’avez-vous également pour CAC40 ? Ou sinon quels sont paramètres à modifier pour l’adapter au CAC40 ?

    Merci d’avance

    • Nicolas • 03/16/2017 #

      Tous les paramètres à modifier sont situés entre les lignes 8 et 16.

  5. carlo__ • 03/16/2017 #

    Hi Nicolas, sorry for the noob question. I want to test the script on stocks. Which are the right parameters to replace Size, StopLoss and TakeProfit assuming i would use the price % and number of shares?

    Thanks

    • Nicolas • 03/16/2017 #

      Change the stoploss and takeprofit value to percent ones. And change the SET TARGET PROFIT to SET TARGET %PROFIT , same for %LOSS.

  6. bertrandpinoy • 03/16/2017 #

    bonjour je suis novice dans les strategie, je test un code sur PRT et lorsqu il se declanche il ne precise pas de SL sur mon graph…qq un peu m expliquer? Merci cordialement

    • Nicolas • 03/16/2017 #

      si il n’y a pas de stoploss définit dans le code, alors c’est normal 🙂

  7. bertrandpinoy • 03/16/2017 #

    bonjour merci pour la réponse. Oui b sur … est il possible que le SL soit coder sous une autre forme?
    il s agit du code SP500 OPTIMIZER
    // Definición de los parámetros del código
    DEFPARAM CumulateOrders = true // Acumulación de posiciones desactivada

    // Condiciones para entrada de posiciones largas
    indicator1 = ExponentialAverage[24](MACDline[21,44,24](close))
    indicator2 = MACDline[21,44,24](close)
    c1 = (indicator1 = indicator4)

    indicator8 = close + 5
    ignored, ignored, indicator9 = CALL “MiIndicador(3)”(close)
    c6 = (indicator8 = indicator21)

    IF c1 AND c2 AND c6 and c11 THEN
    BUY 5 CONTRACT AT MARKET
    ENDIF

    // Condiciones de salida de posiciones largas
    ignored, indicator10, ignored = CALL “MiIndicador(3)”(close)
    c7 = (close CROSSES under indicator10)

    IF c7 THEN
    SELL AT MARKET
    ENDIF
    SET STOP pLOSS 100
    SET TARGET pPROFIT 60

    • Nicolas • 03/16/2017 #

      ok mais pourquoi poser la question ici ? Pour des questions non spécifique à cette article, il vaudrait mieux utiliser le forum, merci.

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
Oxxoz Re bonjour Vivien, Il me smeble que 3 mois, c'est 60 séances. Cordialement,
Vinks_o_7 thanks ...and It can be used on a monthly and weekly basis by changing just the duration in ...
nicko Many Thanks Viv. It looks good
Nokis Bonjour Vivien, Comment je peux faire pour adapter ton code afin: De cibler les sociétés q...
sam00075 I tried it today and it gave great results. So a big Thanks !
oliverkeim Hi, also here not working. Only white lines.
killerplatuze Dont work anymore with the current version?
KryptoKat tolle Arbeit, professionell
Bard Hi @Vonasi, this is an excellent tool! I noticed you times by 180 and was wondering why? W...
Bard I have no idea what is wrong with the posting on this website. I have problems editing posts...
Bard And now my first post displays okay? It literally had copies of my orig post all added toget...
Nicolas Ask on an Excel website?!
JJMR HOLA NICOLAS, TENGO LA ULTIMA VERSION ACTUALIZADA DEL INDICADOR TTM SQUEEZE PRO EN LA VERSIO...
imokdesign @nicolas ,if in want to "call" this indicator, which values i have to write down?
Screw27 Salut nicolas j'aimerais savoir tes résulats grace a cettte methode
eva.g.forsgren It dose not work, I get a strap instead of candels???????????????????????????????????????????
Nicolas That indicator is the one below the chart. The indicator to put on the price chart is this o...
pyhrus P.S : IG , que j'ai contacté ,m'indique que la version V11 , ne sera pas disponible avant un...
Hasardeur Dear Nicolas, is there someting at the arry to modify in order to run the trend at the actu...
MALIMALO Dear Nicolas, just try touse your indicator with backtest but it's not working. is anybody...
carpentier Joffrey Bonjour à tous, Avant tout merci pour ce travail, cependant je suis bloqué quand je l'insta...
carpentier Joffrey Re, C'est ok, j'ai trouvé mon erreur... Cependant sur quel base peut on calculer son CALC...
Aragorna Hi Nicolas, How is it possible to use it in a higher timeframe plotted on a lower timeframe?...
Vinks_o_7 Thanks again Vonasi !
Bard Thank you, this is a great tool @Vonasi, especially for those that used to like shorting Ind...
Aragorna Hi Vonasi, is there a reason why it does not work anymore in new version ePRT Platform? tha...
sycomore Ça ne fonctionne sur aucune valeur, je dois être trop con...
Nicolas il faut appliquer l'indicateur sur le prix.
AntoGH Je crains de ne pas comprendre... Cela indique la probabilité de la prochaine bougie ou donn...
LucioleLucide Clean view, thanks for sharing
dertopen hi where i can found the window for candle configuration?
paolosab69 Ciao! . I have seen the pictures that explain this metod but i don't understand when is mome...
Vonasi Yes that was the issue. I have posted an updated ITF file here: https://www.prorealcode.com/...
crolakstrading @vonasi Thank you for fixing the issue! This is a great indicator.
gregoire good evening vonasi , I had made the request to create this indicator a few years ago and I ...
tobytarczy Hi Vonasi, Sounds lovely, I race yachts around europe myself. Most regattas cancelled unfor...
mlouys Hello Vonasi thank for your work ! A question how can we do it for minutes ( or 15 min or x ...
Vonasi I think that would be possible but probably in a whole new indicator as detecting when a new...
sir_i Bonjour à tous, Je suis nouveau sur le forum et sur la plateforme, pourriez-vous me dire com...
Nicolas Il faut simplement l'appliquer sur le prix.
sir_i Merci pour la réponse, je ne suis pas familier avec l'application de cette procédure simple,...
Vonasi There is another version of this indicator that can plot the same lines but onto an indicato...
Martin35 Hello Vonasi, do you think it is possible with PRT to code with the same principle as on thi...

Top