Kama & Sma Trading System DAX mtf

Kama & Sma Trading System DAX mtf

Coded for micro DAX €1 (simply multiply by 25 to run on standard DAX €25 or by 5 to run on mini DAX €5), 1-hour TF.

I used the Multiple Time Frame support to allow Breakeven/Trailing Stop to run on 1-minute bars (default TF).

Strategy from https://www.forexstrategiesresources.com/trend-following-forex-strategies/111-kama-strategy/.

Compared to the original version at the above link, I only optimized the SMA (called MVA in the above site) and set it to 22, instead of 7.

I also added SL & TP plus my own Breakeven/Trailing Stop code snippet.

Lines 10-11 allow to enable/disable Long/Short trading (both enabled by default).

Lines 21-25, along with lines 54-61 and lines 67 and 74, ban further trading before a whole 1-hour bar has elapsed, in case a trade exits within a few 1-minute bars. In such case the 1-hour signal is still set and valid, but it would most likely lead to a losing trade since the momentum is likely to have faded.

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. CN • 54 days ago #

    You mean coded for the 1-min TF?

  2. robertogozzi • 54 days ago #

    It’s a Multiple Time Frame strategy.
    It must be launched from a 1-minute chart, but signals are generated on the 1-hour TF.

  3. CN • 54 days ago #

    Sure Roberto, but didn’t get any trades on the 1H TF, so trading TF should be 1-min 🙂

  4. robertogozzi • 54 days ago #

    You need to search MTF to read what it is all about and understand how it works.
    You will only see trades on your 1-minute chart.

  5. Jesper • 53 days ago #

    What should be multiplied in order to compensate för other contracts size?

  6. robertogozzi • 53 days ago #

    Line 9, nLots is the number of contracts, you can change it as best suits you.

    • Jesper • 52 days ago #

      Ah, that’s what I thought as there were no ties in to the actual logics. Thanks!

  7. Edurecio • 53 days ago #

    I do not understand.
    Even if you change “time forbidden,” the system still produces the same results, with entries within that range.

    TimeForbidden = OpenTime 190000

  8. Jungblom • 53 days ago #

    I have ran this now for today and now @15:00 i got a “Alert triggerd for a sell Qty-1” and @ 15:05 I got a new alert on Buy (exit) qty +1 but no trades where triggerd why is that? Running with max position size of 2 contracts. when i backtest it a trade should have been done at these timestamps.

  9. robertogozzi • 52 days ago #

    If you want to discuss about inner workings or detail, please open a new topic on the ProOrder Support Forum and always attach detailed pics (instrument,TF,date and time should be visible), along with details posted.
    Thank you.

  10. winnie37 • 50 days ago #

    it could be tested on larger historic?

  11. robertogozzi • 50 days ago #

    If someone has access to 200K data history might post results (it would be better to start a topic on the ProOrder support forum). Upcoming v11 will support up to 1M bars of data history.

    • Gregg • 32 days ago #

      Hi Roberto, thanks for this new strategy but I don’t understand why I can’t backtest it with 200K units… it stops after 6 trades.

    • robertogozzi • 32 days ago #

      There must be an issue with candlestick data from March 7th through March 12th. which causes backtest to stop at 15:04 om March 7th.
      If you make your backtest start from 00:00 March 13th, then it works fine.
      I will report this to PRT/IG.

  12. Ruark Baker • 44 days ago #

    Hi, I found the same problem with the time forbidden code but I have messed about with it using some code that I use for day trading and money management along with altering the stop size based on the trades taken in the last 100k bars.

    • robertogozzi • 32 days ago #

      There must be an issue with candlestick data from March 7th through March 12th. which causes backtest to stop at 15:04 om March 7th.
      If you make your backtest start from 00:00 March 13th, then it works fine.
      I will report this to PRT/IG.

  13. Ruark Baker • 44 days ago #


  14. Jan Wind • 44 days ago #

    Sorry if I missed the latest discussions recently, but is MTF now usable and reliable in PRT production environment ?

  15. robertogozzi • 44 days ago #

    MTF was officially made available to all customers 2-3 months ago after almost a year being beta tested.

  16. Zebra • 19 days ago #

    OpenTime < 090000 AND OpenTime > 190000 should probably be OpenTime < 090000 OR OpenTime > 190000

  17. alfcont • 9 days ago #

    Is this trading system generating profit on micro DAX future?

Register or


avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
supertiti Bonjour Anthon...y ? On est vraiment tout près de ce que propose Julien , sur sa dernière...
anthon Salut à tous et merci ! Content que les indicateurs vous plaisent . Abonnez vous à ma page y...
Varadero54 Bonjour Anthon ... pourrais-tu me communiquer l'adresse ou le nom de ta chaine YOUTUBE ... j...
Alai-n @Vonasi Thanks
jiddan78 how to convert to afl amibroker ?
Nicolas We do not supply free coding assistance for AFL Amibroker on the website. You can ask for pa...
GraHal Is there a switch to start / stop the Trailing SL / TP as when I GRAPH SL & TP neither a...
robertogozzi No GraHal, there's no topic open. It would be great if you could start one and post that lin...
GraHal Discussion Topic started here ... https://www.prorealcode.com/topic/discussion-re-auto-sy...
snucke have anyone tested this live? and how does it perform?
Gubben I liked the idea so much I put it early into live and it took 19 straight losses before hitt...
Gubben Since july 24th it's doing well. Started with a longer drawdown than expected but now it's 1...
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...
xpiga I don't know I suppose you can attach the picture... Any new ideas to improve the code are ...
TempusFugit Sorry but I don´t see any option to attach the picture here... not sure but I think that´s...
rama Trailing stop wont work, will keep moving with price
Alberto Aguilera Hi! Thanks for your strategy Anyone can check it with 200 bars?
5 months ago
sharksteven Hi BALMORA, looks like a good compliment algorithm. I tried to test it on the EUR USD but it...
kompiuter Hello, how did you optimized all these variable? If I try to optimize only two variables it...
rrenaud_ig Great work ! My only concern is about risk management. Your results are based on 10k. Max lo...
LancerX Please indicate the trade stat to show ave gain against average lost..
Jan Wind Thanks for sharing the strategy !. Did you do an Out of Sample run when testing on the 100k...
jmf125 I don't know if anyone is following this thread anymore. Anyway I will post my comment. Aft...
Francesco78 derschnee spiace a me che non riesci a replicarla. Prima di esprimere giudizi pensaci 2 volte.
unkown ;-) sfido chiunque a riuscirci!
unkown infatti basta leggere i post degli altri....
hartgeld Hallo Atxeel, sehr interessanter Code, habe das installiert und funktioniert. Danke! Kannst ...
atxeel Hallo hartgeld, die Ziele sind schlicht, bspw. die Range beträgt 10 Punkte, dann ist das Zie...
Maik2404 wie kann ich den Code bekommen Paul?
jens_kittner Works with US Crude at 1h as well!
Jean-Claude REGIS Je préconise de regarder les graphiques H1 et M15 pour visualiser la tendance de fond et d'...
eugenio buongiorno paolo , volevo farti i complimenti x il lavoro fatto , funziona molto bene sul 3 ...
Modes68 muy buena estrategia, gracias por compartirla thank yoy for your estrategy, I like me
xpiga Good morning! How do we adjust the code to the different timeframes? You said something ab...
bala Hi Kris, I have imported the screen. I don't see any instrument loaded under this screen....
Kris75 Hi Bala, you need first to install ZeroLagMACDWeek indicator and then add on it the diverg...
berga Hi, thank you very much for this very useful screener. I would like to get another very clos...
1 year ago
Bebbo Thank you for your contribution. I have tested your system on some instruments and I like i...
bertrandpinoy bonjour j ai tente l installation mais PRT m indique que ce code ne peut etre utilisé qu en ...
Nicolas en effet, il faut utiliser l'éditeur de code ProBacktest, il ne s'agit pas d'un indicateur m...
Nicolas Thank you Xusto. Thank you a lot for your contribution :) Since your code is a Pathfinder'...
Xusto Hello, Fully Agree, I will update it with your advice. Btw Can would you like share you co...
Niklas johansson hägglund do you now if it's possible to use this strategy with this code in tradingview also?
Petersson Kristian Hi when I do back test I get 0 results, what do I do wrong? Trade Well Chris
JohnScher Yes i did before, see library/strategys/repulse and dpo https://www.prorealcode.com/proreal...
JohnScher Don't know what you're doing wrong. Import ITF and observe time zone settings. This should...
osupero https://www.screencast.com/t/QmSXRbBR
osupero https://www.screencast.com/t/2fCW8fkGsOeZ....solo posiciones largas por ahora
osupero https://www.screencast.com/t/MIaSZ2PRg