learn to put calculation in a dll code, Java or C++, How to start?

Discussion in 'Automated Trading' started by mcgene4xpro, Jun 1, 2011.

  1. hi,
    I have an idea and i would like to take the opinions of the experienced programmers here.

    I would like to learn programming but ONLY to be able to write the calculating code. Either with Java or C++. I would like to be able to interface the code to the execution code. Also, to be able to test it

    how could i start? any resources? any ideas ? suggestions

    share me plz your opinion even it is against.

  2. I personaly dont understand what you mean by that.
    Is there a specific reason for JAVA or C++? Cuz they are not the easyest to start with. Sure you can do complex things but the barier to entry is high if you never programmed anything. Matlab or VBA would be much better to start with. Or even C# with ninja. All depends on what you want to do. An example would help people to comment IMO (no need for strategy specific details).
  3. Qbit


    From what I understand, you have an execution system and you want to build an analytics system and link it to the execution system.

    If this is indeed the case, it's not necessarily a good idea, analytics systems take up processing power & memory which could harm the execution engine. It's best if you have a separate analytics system, figure a couple of rules from your backtests and hardcode these rules into the execution system. Therefore, no need to learn to program, Excel will do just fine.

    If you still want to learn to program, I'd rule out C++, because it takes time to learn it, it is more unforgiving than Java. For Java look at the Javadocs & tutorials by Sun available online.
  4. Well, I did a speed test comparing a DLL to regular easy language code, and believe it or not, for simple functions, the EZ language interpreted/compiled code was faster. For stuff like array functions, trig functions, log functions etc, I believe the DLL is faster. This is because the DLL has to pass the arguments to and from the function which adds overhead. So, you should check if using a DLL will even be worth it.

    The other item is security. I've seen articles that say trading strategies are difficult if not impossible to read from compiled DLLs. So, I use a DLL anyway because the strat runs in less than a microsecond whether by DLL or EZ language while the lag between data is probably> 1 millisec.

    As for your original question, if you are using EZ language with the define function statement and programming in C++, I can tell you how I made it work. Just let me know.
  5. I have a trading sytem and i want to develop its ATS. I am not a programmer so i will give it to a coder. To protect my IP, i wanted to design my ATS as 2 parts " execution and calculation". The calculation part will handle any kind of calculation needed such as signal prediction, sizing, tp, sl, MM and so. The execution part will send orders and confirm their execution. Then, i wanted to send each part to a different coder to develop it. I have done this with an MT4/DLL EA but this time, the work will be with Java or C++. and my ATS will be connected to brokers ( such as Dukascopy , IB and Oanda) by API.

    However, i was always thinking to be engaged in this.
    I thought there are three regions i could engage in,
    1- Mathematical/financial modeling using Excel/matlab. to continue develop/enhance the logic of my system.
    2-Programming the DLL that deal with calculation.
    3- programming the execution part.

    However, i have a full time and i can not dedicate too much time to learning and excel programming. So, i will avoid learning how to program the execution part using java or c++ and i will give it to a pro.

    So, now i have 2 other parts i could engage with.. Learning matlab/enhancing my skills with excel or to learn how to program to JUST design and continue modifiy/upgrade my calculation dll. The mathematical modelling will also done by pro in matlab/excel so i suppose to get all formulas and ready to be deployed into the DLL. I thought to learn a programming language JUST to deploy ready-made formulas and interface it with the execution system is not that difficult. " i might be wrong here" and doesnot require to learn the whole language.

    So, i am trying to find answers on:
    Is it possible to learn C++ for example only to design DLL. so i will not be interested to learn all other chapters in C++?
    Would be a relatively easier to learn language to JUST design a dll than learning the language to do a real application?
    Is my general plan sound and could work?

    That is it so please share

  6. As I mentioned earlier, using a DLL does not necessarily mean it will go faster that the regular code. For complex code it will go faster.

    C++ is easy to use for this, once you have the interface working. I would suggest you find a worjing example of C++ in the technical trading forum for the language you use and start there. That way, you can know which version of C++ to use. I use a freeware c++ environment I found online but if you have a commercial software package that might be better as there is more support. i will post my c++ stuff here (without strategy details) here later.
  7. Qbit


    What *you* can do with it and how fast *you* will learn code up dlls, nobody knows.

    Broadly speaking, it takes some time for people to build solid C++ skills, it's not rocket science but it has its learning curve, much like anything else.

  8. Great. Thanks for the sharing.

    However, i am not after the faster but i am after " how to protect my intellectual property mainly and to be able to upgrade my calculations by myself
  9. mcgene - here is a link to an example that creates a dll using visual c++.


    Here is an example showing how to link a visual c++ created dll to tradestation.


    I didn't post my own code because I'm using a freeware compiler/development environment that might not work the same as commercial software. Visual c++ seems to be a popular commercial software package, so I posted an example using that.

    An internet search will find you hundreds if not thousands of examples of DLL code and linking.
    #10     Jun 5, 2011