R or Python for someone with elementary CS skills?

Discussion in 'App Development' started by ehbeehefak, Jul 5, 2015.

  1. Hi everyone,

    I am looking to get into algotrading to test my strategies. However the problem is I have basic CS skills and knowledge. I want to do backtest, walk-forward test, monte carlo simulation and if possible demo trading with live data and also last but not least, be capable of sending trade orders to a platform like MetaTrader.

    I have done quite a bit of research and R and Python seems to be the most friendly languages out there, other than software like Tradestation.

    Which language would you recommend for someone like me, based on available packages for algotrading, the ease of writing and maintaining code and similar considerations that I can't think of but someone would good knowledge have?

    I want to clarify that I am not looking for any off-the-shelf platforms. I want to code my own, I know it may take a while or a lot longer.

    Please if I didn't give some essential info, just ask and I will reply as quickly as possible.

    Thanks and happy trading!
     
  2. Please do not consider writing your own algorithmic trading platform if you don't know the language and what you are doing. You are asking for disaster and a spanking par excellence...

     
    eusdaiki likes this.
  3. jj90

    jj90

    I don't know how basic your coding knowledge is so here is my 2 cents.

    Take a basic course or 2 on beginners OOP (object oriented programming). I had been studying coding for ~14 months before I took my 1st course and I was going up the learning curve very slowly. You don't need to be able to build the next facebook but you do need to be able to read code. There are some code examples here on ET or you can check out stackoverflow. If you can't read those samples and understand at least abstractly what is going on, go take a course at your local community college.

    I have now coded multiple strats I have into Python, and backtested those ideas. For forward testing you can just automate thru a paper trading interface at IB or equivalent via API. IMO you don't need to reinvent the wheel, you don't need to fully build your own platform, there are plenty of solutions out there unless you are doing something really niche.

    R vs Python: I chose Python because currently its a complete GPL vs R. I also use R but for quick visualization and early prototyping. R may have more support on the calculation/data packages than Python currently, but Python is catching up fast.
     
    ehbeehefak likes this.
  4. I appreciate the comment. I know that it will be hard, but I would like to improve my CS skills by doing a project that I might benefit from in the future. I won't be trading with strategies tested on this platform until I am sure that it is a good platform that I can trust.
     
  5. Thanks for the thorough answer. I am nearly at the point where I can do coding on my own with the help of stackoverflow and other sources.

    As a follow-up: Which package did you use for coding your strats and backtesting them? Was is it a general-purpose package like pandas or a more-specialized package fo trading?
     
  6. jj90

    jj90

    I think you will find pandas/numpy/scipy will do a lot for you. Visualization use matplotlib. That's for backtesting the logic. There are a couple of stats packages if you want to get into pairs, you can google for their names.

    For forward testing/execution I suggest you pick a broker or data feed you can live with and work with their API. Depending on what you are trying to do something like Quandl may or may not work for you.
     
    Bizzy Bee and ehbeehefak like this.
  7. spacewiz

    spacewiz


    MetaTrader uses it's own language - MQL, which is similar to C, but takes care of memory management. Other than that - you could write your algos in Python or another language, and integrate with MetaTrader via DLL or web services...

    R is a good choice for prototyping , use it if you have a good mathematical background, Python is a good all-around language for building limited scripts and prototyping, and learning programming, but is a bad choice for building large or scalable systems, which is not what you are going to do anyway, at least for a while...

    My suggestion - find a good freelance programmer who has experience in finance and is able to stick around for a long time, and work with him. He must provide all source code to you, which you can read and learn from, and slowly start making modifications when you feel more comfortable.

    Good luck.
     
    ehbeehefak likes this.
  8. Thank you for the thorough answer, I appreciate it a lot. Can you clarify a point or two for me, if possible? What limits the scripts in Python as you wrote ".. for building limited scripts.."? Also, can you elaborate on systems that might benefit from scalability, I am having trouble thinking of circumstances that might need it?

    Again, thank you very much.
     
  9. Tavurth

    Tavurth

    A nice way to learn programming would be to download candle or tick data, and use it to create your own charts. Using imagemagick to draw on an empty png works very well.

    This will teach you Object Oriented code, at the same time as giving you a deep understanding of how your trading platform works. (It's also much easier than writing execution critical, and event based code)
     
  10. Two things could happen:
    1) You'll be dead before you finish it without any bugs.....or
    2) you'll start using it too soon and the bugs will wipe out your trading profits.

    BTW: One of the first robust trading/backtesting platforms (Tradestation 2000i) was over a million lines of C++ code. They eventually scrapped it when they could not remove the bugs.
     
    #10     Jul 7, 2015