Long only strategy with the TMA channel

Long only strategy with the TMA channel

as simple as it gets

I stole the indicator from here.
Then I rewrote the indicator into a strategy.

The action instruction is Long after the price crosses over (!) the lower band with the target the middle line of the channel.

thats all
until then

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. ALZ • 12/13/2019 #

    Hi JohnScher,

    Nice work
    Is system works well in production ?

    With these parameters, the resultat is even better
    HalfLength = 151
    AtrLength = 151
    AtrMultiplier = 2.5

    • Ciurno981 • 12/13/2019 #

      Does anyone have the data at 200,000 units, why would I like to see over 5 years?

  2. ALZ • 12/13/2019 #

    With same parameters, it works as well on DJI / H1

  3. juju333 • 12/13/2019 #

    Thanks JohnScher for sharing and ALZ for optimization. I’ll try it !

  4. juju333 • 12/13/2019 #

    Slightly better in 100K (DAX H4) with this :
    TradingTime = time = 090000 or time = 130000 or time = 160000
    set target %profit 2

  5. ALZ • 12/13/2019 #

    thanks juju
    of course time isn’t optimized for DJI
    See below new version with optimized parameters
    with profit 1.5 and time = 090000 or time = 120000 on DJI H1
    we have 50.42 for the profit factor with only 2 losses

    • juju333 • 12/13/2019 #

      Not sure to have the good parameters : on DJI H1 (100 K, which brings back to 30 july 2015) ? could you repost the all code ? thanks !

  6. juju333 • 12/13/2019 #

    Quite good results with ‘Soy Flour’ (SM) too : +63.99 % in H4 100 K (dont’ really know the spread) :
    // maincode : TMA Channel 4H co lowerband
    // coded by johnscher

    // works on dax 1 euro
    // timeframe 4H
    // timezone europetime, berlin

    defparam cumulateorders = false

    // parameters
    HalfLength = 151
    AtrLength = 151
    AtrMultiplier = 2.5

    avg = average [1](close)

    sum = (HalfLength+1)*avg
    sumw = (HalfLength+1)
    k = HalfLength

    for j = 1 to HalfLength do
    k = k-1
    sum = sum+(k*avg[j])
    sumw = sumw+k

    myrange = AverageTrueRange[AtrLength](close)*AtrMultiplier

    middleband = sum/sumw
    //higherband = buffer1+myrange
    lowerband = middleband-myrange

    TradingDay = opendayofweek = 1 or dayofweek = 2 or dayofweek = 3 or dayofweek = 4 or dayofweek = 5
    TradingTime = time = 090000 or time = 170000 or time = 230000

    IF TradingDay and TradingTime then
    if average [1] (close) crosses over lowerband then
    buy at market

    if average [1] (close) crosses over middleband then
    sell at market

    set stop %loss 3
    set target %profit 4 // as insurance

  7. JohnScher • 12/13/2019 #

    Thank you very much. I am glad that the code is so well accepted here.

    As for improvements through optimization, I would like to say that I have not optimized through. I was more interested in trading the track from crossover the lowerline to the finish midline.

    Furthermore I would like to add that the system has been running in demo since 28.12.2018 with tema 12 close as avg and sl tp 2.4%.
    Number of trades = 12
    Won = 10
    loss = 2
    gains = 554 Euro

    From 01.01.20 it goes live at ig.com/australia with the germany 30 cash (1£)

    have good times
    until then

  8. ALZ • 12/13/2019 #

    Nice JohnSchern, thx for your contribution
    i’m going too with my parameters

  9. winnie37 • 12/13/2019 #

    could you post for Dji please?

    • JohnScher • 12/13/2019 #

      I’m sorry, I specialized in the Dax. I’m sure the basic idea of the strategy also works in the Dow Jones. Maybe, you can try the optimization for Dow Jones.

  10. ALZ • 12/13/2019 #

    Regarding the DAX, it’s good too with 200k bars (with parameters of the basic idea)

    For DJI with 200k, i try to have good result but it seems to be impossible to apply this strategy on DJI… maybe other markets…

  11. Crystal Babe • 12/13/2019 #

    Hi John,
    this strategy is Great for DJI -justneededa bitof tweaking for the 1 hr chart. Thanks a million.
    though its coded to eit early at lowerchannel level , i have edited them to exit at higher levels with lovely results.
    John, if you dont mind can you explain which parameters i need to inverse to go short? ( planning for the near future:))

    • samsampop • 12/13/2019 #

      Hi Crystal Babe – would you be happy sharing your revised code as I too am testing this on the DJI? Many thanks

  12. sfl • 12/13/2019 #

    What is the meaning of the time filer ?
    Why 9:00 13:00 and 17:00 ?

    • JohnScher • 12/13/2019 #

      The 4H candles begin at 09.00 13.00 17.00

  13. Gigi • 12/13/2019 #

    Bonjour, pourrait on mettre cette stratégie en Daily?

  14. Marcelus • 12/13/2019 #


    Sur Dax , en 1h avec ces réglages depuis 2011 :
    – HalfLength = 170
    AtrLength = 40
    AtrMultiplier = 2.8

  15. Marcelus • 12/13/2019 #


    Sur Dax , en 4h avec ces réglages backtestés depuis 2011 (200000unités) :
    HalfLength = 170
    AtrLength = 40
    AtrMultiplier = 2.8
    sum = (HalfLength+1)*avg
    sumw = (HalfLength+16)
    set stop %loss 3
    set target %profit 3.6
    j’obtiens 83,78% de positions gagnantes, un profit factor de 2,73, et 84% de gain pour un capital de 10000€. si quelqu’un à mieux? Bien à vous.

  16. Bruno38340 • 12/13/2019 #

    Bonjour, merci pour le code… Comment peut-on changer/augmenter le nombre de lots achetés sur le Dax30 ?

    • Ciurno981 • 12/13/2019 #

      il suffit de changer le nombre de contrats à acheter

  17. Ludwig • 240 days ago #

    Merci pour le code, je souhaite intégrer un break even et mette en place un réinvestissement mais impossible avec ce code, quelqu’un aurait une solution?

Register or


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

+1 more likes

Related users ' posts
adconsulting SCUSA . ECCO IL CODICE defparam cumulateorders = true // false is working well once ord...
wally Hola soy nuevo en el mudo robots. Alguien seria tan amable de poner el archivo itf.file ya q...
Darren Nash I found this works well on the DOW
KAMJKAZE thanks, really interesting!
2c95 thanks, why do U prefer average than lowest ? to close under average does'nt mean another...
cdc.andersson Hello, I´m trying to paste the code and start testing but can´t get it to work in PRT. Shoul...
Lupo32 Thank You Aaron
superfalcio I'm having no more issue on the new Prorealtime release 11.1
Fabian Hi IV Mcm, have you drawn the rectangles (Dinamic, Range) by yourself in the chart or are...
IV Mcm Myself to illustrate ;)
fucode I need to calculate this in excel. Is it posible ? how ?
Nicolas Ask on an Excel website?!
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.-
FXmike hey my friends, thank you for this great code. my problem is he make no trade open. backtest...
FXmike Can i put a Action that my start contract is smaller than 1 ? 0.3 or 0.5 ? In wich Position...
phoentzs I wrote the code for M15 back then and also variants in H1 and M1. Everything works so far....
Jan Wind Thanks for sharing ! The Gain/Loss ratio is a bit low, 1,16, hardly offset the risks take...
drive whats the period ?
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...
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 !
Be-n Bonjour tout le monde ! Dans l'indicateur de tendance, j'ai du mal à saisir la nuance entre ...
HeikinAshi https://www.prorealcode.com/topic/ssl-channel/
jobswaps oyes aste uno de soportes y recistencias
jobswaps eso lo necesitamos
frenqle I have it on 1 minute but still 13 april is the latest its doing
robertogozzi The error you reported has been fixed, now the strategy enter trades regularly in AutoTradin...
frenqle Done!! thanks Roberto, it is running again!
samsampop Hi robertogozzi - thank you very much for sharing this strategy. I have performed various ...
robertogozzi Thank you samsampop.
Dotan Hello guys I really appreciate this coding effort but can I use this code for Mt5 Forex Trad...
Gubben So far so good. After a long drawdown it was winning four times in five weeks. Since 24 jul...
pat95162 Salut Pourquoi je n'ai pas les même résultats que vous
UkCoopDownUnder Any hints for us, on which variables we should be optimising ? As of November 2020, the cu...
TempusFugit Interesting idea and with a lot of room for improvement.... maybe a trailing stop? Thanks fo...
Jan Wind Unglaubich das dieser Strategie Gewinne generiert ! Es erschient leider nicht so gleichmaßi...
Peter I recognized a possible problem with the timeframe / Defparam variables. As far as I know, t...
ALZ Hello, currently, I don't have the same result as above and don't no if it works good in...
JJ Tec Hola. Me gustaría contactar contigo para ver la estrategia..
nilsla1981 Has someone already tested in real ?