Larry Williams’ X bars & Linear Regression Slope

Larry Williams’ X bars & Linear Regression Slope

Hello everyone,

Do you remember Larry Williams’ 3 bars strategy?

Well, I tried to automate this strategy.

Without much success at the beginning, I admit, with the basic parameters.

I wanted to optimize it by adding a trend indicator, and changing the value of the moving averages.

Among many trend indicators (MACD, long period stochastics, Ichimoku, moving averages, etc.), I finally chose to keep a simple one : the slope of linear regression.

Moreover, this new approach remains in position as long as the linear regression slope is well oriented : the trade is not closed only by the price crossing above / below a moving average.

So I show you a simple code, which trades the bounces in trend, at the level of the bottom or the top of a channel of moving averages.

For the backtest to be efficient, it must be optimized according to the action / index / currency pair concerned.

Here is an example on the DAX, in graphs Daily, with 1 point of spread, over the last 20 years round.

Moving averages period : 12

Slope of linear regression : 28

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. reb • 05/15/2017 #

    Hello Marc
    your strat seems very intersting, will take a look
    Reb

  2. 897148 • 05/15/2017 #

    What exactly is meant by Total price?
    Is r1 =28 in your example the no of days for “Total Price” and the best line thru these points gives the slope?
    Looks very good but  I wish to clarify my understanding.

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar

+1 more likes

Related users ' posts
Nicolas Le plus simple est de télécharger le fichier itf présent sur cette page et de l'importer dan...
Daniele Maddaluno Le closedbar est simplement une variable de type boolean, et = t signifie qu'il est Ă©gal Ă  t...
yanntorp merci pour vos réponses et le partage de ce code. Cela fonctionne très bien.
MauroPro To be more precise, what I don't understand is how it is possible that the variables: "slow...
Nicolas these variables are assigned between lines 39 to 48
MauroPro Hi Nicolas, could you recommend me some mid-high level programming manuals for Prt or simi...
Nicolas email notification are not available for custom indicators.
DIOS Bonjour Nicolas, comment coder un indicateur de rsi de Divergence? Merci pour ta réponse
Nicolas En apprenant la programmation :) Plus sérieusement, il y a quantité d'exemples dans la libra...
Juan Gonzalez Que buen contenido! No tienes alguno que me permita operar Order Flow? Gracias
jissey Bjr Nicolas, merci pour cet indicateur interessant, mais en le recopiant pour creer un progr...
Nicolas Il doit s'agir d'un mauvais copier/coller. Je suggère de télécharger le fichier itf contenu ...
XXXXVII Fixed ITF Trend Background //Indicateur CCI ID2 = CCI[50] => 60 ID3 = CCI[100] => 60...
Sanglier thanks ! i have been looking forward to find something like this
Screw27 Hi man, I installed the indicator and i don't know why but my graph it is so big
HelixKing sounds interesting I'll take a look
mostafa samady How can I optimize it for DAX 30? Thanks!
Godo Bonjour Souhait Sam, Après de nombreux essais pour le mettre en format afin d'utiliser ce c...
Nicolas Il faut supprimer celles qui existent dans la fenêtre d'optimisation et les créer en dur dan...
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 Pourriez-vous nous proposer une version adaptée pour PRT V13.0 , ou nous préciser les instr...
pyhrus Erratum : je veux parler de la version V10.3 , bien sur ...
pyhrus P.S : IG , que j'ai contacté ,m'indique que la version V11 , ne sera pas disponible avant un...
Nicolas Bien sûr, pourquoi pas ?
ribes65 Bonjour Nicolas, Merci pour votre travail. Est-il envisageable de créer un screener pour ...
Nicolas Bien sûr, merci de formuler une demande dans le forum des screeners pour prorealtime. En res...
Nicolas Poni qui la tua domanda se è correlata a questo indicatore, altrimenti apri un nuovo argomen...
PhilipSchultz Hi Nicolas, can i backtest this indicator? And if so, how do i do it? I have tried, but don´...
Nicolas Sure, use the forums to create a new topic to ask for it Please respect the posting rules ...
Nicolas How to import file page: in the help section of the website explains howto
kenssa import through the indicator page/window in the Proreal time
chicoteca Buenas, no consigo que se me muestre en el chart de DAX. ÂżCĂłmo procedo? Gracias.-
IvanFinanza Sorry, I found where I need to set MatV1 and 2 But to have it exactly identical to the Bac...
Jezza34 Thank you for that amazing program ! :-)
superprof bonsoir comment faire les tests In Sample et Out of Sample.? je ne comprend pas le sens
Stockastiss Can this code be simply transferred into Backtestingcode so one doesnt need to use call ? (i...
Vonasi Sorry for the late reply. Add the code to your strategy and remove line 5 and line 39. Chang...
leofi https://www.prorealcode.com/topic/simple-average-with-visual-color/
leofi Go visit www.prorealcode.com/topic/simple-average-with-visual-color/ and watch 2em post
Dritan Hi,I am new on Prorealtime and coding.I downloaded the indi but I have it on a separate wind...
Nicolas You should open a new topic to discuss about the strategy and its coding.
dvlukic Hello Nicolas, How could plot this indicator over the price series? Thanks Dave
Nicolas Just add it on the price series.
Byggtrader Hi Nicolas! How do I get the indicator in the price chart? It only stays under i new chart.
Nicolas Just add it on the price chart by using the wrench on the left upper side of the chart (pric...
scarphace38 Bonsoir, je découvre PRT et je n'arrive pas a afficher le meme résultat pour l'indicateur de...
Dom Hello, hello....je commence le trading et découvre par la même occasion le codage....et ce n...
Nicolas Merci, ça fait plaisir !

Top