Linkers::X - Let's code in C++ , Daytrade & Daydream :)

Discussion in 'Programming' started by LinkersX, Dec 26, 2017.

  1. LinkersX


    Over years I've been involved with many trading platforms. I've seen it all.

    For example Ninja's unbeatable speed that even a snail can surpass. An everlasting sarcastic smile engulfs my face every time i want to start Ninja's legendary Market Replay. Man, you can do chores while you are waiting for the platform to load and prepare?! historical data for market replay(C# ->!@#$)

    Then there is the C++ SierraChart which is speedy and nice, but its language scares the hell out of me even though I got a cat with Red Eyes and I'm a senior c++ developer.

    And among many other platforms like cAlgo, MultiCharts etc. there is the Legendary MT4&5. Unfortunately, MT4 is, well, how would i say, Metatrader's way of doing things;

    So I got a dream. Yeah, i daydream a lot.

    In my dream I've seen an EA that spells out into code similar to this[​IMG]

    xAccount acc1;
    xSymbol symbol1;
    xOrder long1;
    xOrder short1;
    xCharts chart1;
    xBars renko1;
    xTicks tik1;
    xSMA sma1;
    // init
    acc1("accountNumber");                        // connect to MetaTrader
    symbol1(acc1.x, Symbol());                   // symbol attached to account
    chart1(symbol1.x, 3);                            // chart1 attached to symbol1 and offline timeframe will be 3
    renko1(symbol1.x, UltimateRenko, 20);   //Ultimate renko1 (period 20) attached to chart1.
    sma1(renko1.x, chart1.x, 20, 0);            // attach simple moving average with period 20 to Ultimate Renko1 and chart1
    Linkers::X(EventType e)
      //let's see if the event is error
         if(e._broker_busy){//do something ...}
      if (e._economic_news)
        print (renko1.high(5));      // print High value at bar index nr 5
        print (renko1[2].typical);      // print Typical value 2 bars back
        print (sma1[0].value);   //print  current bar SMA indicator value
      // check for event if bar touched (+/- few pips, configurable) around  Daily High
      if (e._daily_high)
        //check if 5 days back Daily high is higher than UltimateRenko BarSeries 2 bars back
         if (symbol1.dailyHigh(5) > renko1.high[2]) {short1.sell();}
       // check if last bar close touched around nearest round number
      if (e._round_number) {print(e.roundNumber());} // print out the actual nearest round number value
    In my dream this code compiles and executes on all above mentioned trading platforms.

    What do you guys think? Do you see what I'm seeing?
    Last edited: Dec 26, 2017
    tommcginnis likes this.
  2. LinkersX


    I mean this example compiles in MQL4 on Metatrader and there are no additional Indicators or scripts.
    It could also compile on NinjaScript and it would do the same job ;)
    Last edited: Dec 26, 2017
  3. i960


    You're asking for a portable standard or generic study API within a space that doesn't even remotely consider portability to be important. It can be done, but not without writing the entire API and wrapper libraries yourself and it'll suffer from implementation holes where one platform supports something the other completely doesn't support. There's also implementation specific details like how the code is expected to be compiled, run etc.

    On top of all that expecting platforms to actually help with portability is expecting them to be altruistic in making things better for everyone. They're negatively incentivized to keep things as platform specific as possible because portability provides an extra degree of freedom to their userbase. The for profit exchanges help ensure the status quo by limiting access to exchange API libraries and documentation to those who will pay for it or those who will provide them a flow of exchange fees.
    vanzandt, LinkersX and truetype like this.
  4. LinkersX


    Ok, I felt strange after this initial dream, very upset I've gone for a walk in downtown Jersey City.
    On the "main street" i stumbled upon this fuzzy pet store where the guys from animal shelter were displaying cats for adoption.
    And there he was, an orange tabby devilish looking cat with Red eyes called Pyro.
    Poor cat looked very anxious and he was just looking into nowhere.
    Lovely Cindy from the shelter told me that he's 8 months old an got picked up on some parking lot in JC.
    Then Pyro looked at me and flashed his Red eyes and that cat on that Sunday afternoon spoke to me Like Martin Luther, Like Pericles...

    On my way back home to Metropolis Towers, i was anxious and i got this urge to call dr. "Feel Good" for a little Green Energy, you know, for an emotional preparation for the message, a revelation that i just got received from the cat.
    Of course Pyro got adopted instantaneously by me, but I went home alone because the guys from the shelter would deliver him later...
    I was all confused with a dream that wasn't really clear to me at that moment and with fact that i just adopted a devilish looking cat out of the blue.
    I got myself a glass of Coke and sat down on the couch and rolled one. I told to myself, Mickey, let it all out in a puff and started crying for unknown reason....
    Thanks God, Two and a half men was about to start to cheer me up...
    Last edited: Dec 26, 2017
  5. LinkersX


    So you think it can't be done?
    What I'm looking for is NOT to connect the platforms but to have one language for all
    Last edited: Dec 26, 2017
  6. fan27


    Actually, I am working on doing something very similar. I am building a Quant ML SDK which will drastically reduce the effort to find profitable trading strategies. Without going to much in to how it will work, the end result will be strategy definitions which will be saved as JSON and the SDK will come with methods to translate the JSON to platform specific code (i.e. TradeStation, NinjaTrader, Custom, etc). As i960 mentioned, the code with have to know the limitations of each platform. The main value add of product will be finding the strategies. Automatically converting them to platform specific code is an added convenience. As a standalone utility, I don't necessarily see a lot of value in having a generic strategy definition (code, JSON, etc) that can be translated to multiple platforms.
    LinkersX likes this.
  7. LinkersX


    Genesis 1:1

    The Beginning
    In the beginning God created the heavens and the earth. The earth was formless and void, and darkness was over the surface of the deep, and the Spirit of God was moving over the surface of the waters.…

    And indeed, back in the days my life was a big void...

    Don't get me too religious here please, actually I'm more on the devilish side, s@x, medication, rock & roll, after partying in Manhattan hanging out in the Hamptons and so on...
    But back in the days I've dated this very religious woman, so reading The Bible on a daily basis was my every day routine.
    At least that's what she thought....
    You know, men do things like this to make the woman happy to keep the peace in the house because we lived together in Jersey City...
    On top of all problems that i was facing, she's a daughter of some Asian billionaire, so she was grooming me to be "Introduced" to the family... Meet the Parents Asian style. Instead of Oyster Bay Long Island, the actual hangover would be at some Asian Island overlooking the mainland, BUT before that i got to "Succeed" whatever that meant in her head...
    I met her on OK Cupid, poor soul she was looking for a spiritual leader and what she got is a guy who was chating up girls on OKC in between coding sessions :wtf:
    Last edited: Dec 26, 2017
  8. That code is terrible
    IAS_LLC likes this.
  9. LinkersX


    I like the idea ;-)
  10. LinkersX


    Sometimes dimming the light bulb makes the picture clearer ;-)

    Maybe you can share with us how would you improve the code...

    Last edited: Dec 26, 2017
    #10     Dec 26, 2017
    lawrence-lugar likes this.