Language comparison

Discussion in 'App Development' started by Sergio77, Oct 17, 2014.

  1. M.ST.

    M.ST.

    Ron, don't listen to guys who don't know. You can find a lot of those in Internet forums.
     
    #11     Oct 24, 2014
  2. The question was specifically about 2 proprietary languages (Amibroker AFL, Tradestation Easylanguage) 1 platform (NinjaTrader) and an open Programming language (Python).
    The proprietary languages may be based on open programming languages but they are tailored for use with a specific platform.
    Amibroker allows integration with many programming languages? That's great. Good for them.
    Any of those programming languages will allow you to connect to many different brokers, unlike AFL.

    I write based on my biases, perceptions and previous experiences and I am fallible on my opinions, just like you and anyone else. I even mixed up EasyLanguage with esignal scripting language -ESL- in my original response. Go figure! At the end of the day everyone is subject to error and I participate of this forum and others with the goal of learning and maybe helping someone out everynow and then.
    So far your 4 posts here have only been focused on pointing that someone else is wrong and you are right.
    If my responses are forcing you to pull your hair out, then by all means click on my nick open the member profile and click on the ignore button. Health comes first mate and there are more productive ways to spend your time.
     
    #12     Oct 24, 2014
    d08 likes this.
  3. Like support vector machines
     
    #13     Oct 24, 2014
    cjbuckley4 and eusdaiki like this.
  4. cjbuckley4

    cjbuckley4

    @howardbandy i feel like it's pretty easy to write a simple SVM like a linear or guassian kernel in any language, but your point is well received by me nonetheless. Great post haha, if people want to get technical and use more advanced tools, then they should be 100% encouraged to do so.
     
    #14     Oct 25, 2014
    eusdaiki likes this.
  5. 1. Trading system development platforms -- AmiBroker, TradeStation, Ninja, MetaStock, etc -- are great for indicator-based trading systems. We each have our favorite, and understand what we need to do and how it can be accomplished. But TSDPs are special-purpose programs, designed for trading system development and trading. They are far less capable of support for matrix-intensive computation, pattern recognition, and machine learning than Python (the specific general purpose language mentioned in the thread).

    2. It may be pretty easy for some readers of this thread to write the code for an SVM with a radial basis function, handle the data wrangling, code the indicator functions, determine the best definition of categories for the classification, perform the data split into train, guide, validate sets, manage the dates to walk forward, set up and run Monte Carlo analyses to determine risk of drawdown in excess of personal tolerance, estimation of profit potential, and trade-by-trade determination of system health and correct position size. But probably not in EasyLanguage. And probably not using any of the TSDPs for most. They might prefer Python with NumPy, SciPy, Scikit-Learn, etc.

    In my research and experience, results from machine learning techniques applied to trading are worth the effort. Today's TSDPs are not adequate for support of them.

    Whether anyone wants to investigate those techniques or not, my point is that I should not suggest that a technique will not work simply because I do not know how to do it.

    Best,
    Howard
     
    #15     Oct 25, 2014
    eusdaiki and cjbuckley4 like this.
  6. cjbuckley4

    cjbuckley4

    ^Excellent post.

    Agreed on the distinction of applications: Indicator based strategy design vs. other other forms of design and research where special purpose languages and general purpose languages shine, respectively.

    Agreed also on the applicability of machine learning. With proper feature engineering, I believe it is a very powerful tool for quantitative research in trading and other fields. Unsupervised learning can estimate or even find interesting relationships between variables and supervised learning techniques can be instrumental in designing and optimizing strategies.
     
    #16     Oct 25, 2014
    eusdaiki likes this.
  7. M.ST.

    M.ST.

    Ignore button? That as it looks probably is your preference but not mine. So don't tell me what I have to do and what I don't have to do.

    As for AFL ... within AFL you can connect to multiple brokers sending/receiving stuff. So why insisting on claiming something you have not much clue about. Better remain silent then.

    But all that got nothing to do with the original post #1 anyway.
     
    #17     Oct 28, 2014
  8. I came across the code for an SMA crossover system built on python zipline.

    http://nbviewer.ipython.org/github/...lob/master/3. Backtesting using Zipline.ipynb

    It is not exactly the system requested by Sergio77. but it is pretty close (after i modified the SMA timeframes all that it'll need is the 5%MM stop)



    Code:
    ## imports
    
    import pandas as pd
    import pandas.io.data
    import numpy as np
    
    import pytz
    from datetime import datetime
    
    import zipline as zp
    
    from zipline.finance.slippage import FixedSlippage
    
    ## data from yahoo
    
    start = datetime(1990, 1, 1, 0, 0, 0, 0, pytz.utc)
    end = datetime(2002, 1, 1, 0, 0, 0, 0, pytz.utc)
    data = zp.utils.factory.load_from_yahoo(stocks=['AAPL'], indexes={}, start=start,
                                            end=end, adjusted=False)
    
    ## plot the data as a sanity check...
    data.plot()
    
    
    
    # Class for SMA signal
    
    class DualMovingAverage(zp.TradingAlgorithm):
        """Dual Moving Average Crossover algorithm.
    
        This algorithm buys apple once its short moving average crosses
        its long moving average (indicating upwards momentum) and sells
        its shares once the averages cross again (indicating downwards
        momentum).
    
        """
        def initialize(self, short_window=50, long_window=200):
            # Add 2 mavg transforms, one with a long window, one
            # with a short window.
            self.add_transform(zp.transforms.MovingAverage, 'short_mavg', ['price'],
                               window_length=short_window)
    
            self.add_transform(zp.transforms.MovingAverage, 'long_mavg', ['price'],
                               window_length=long_window)
    
            # To keep track of whether we invested in the stock or not
            self.invested = False
    
        def handle_data(self, data):
            short_mavg = data['AAPL'].short_mavg['price']
            long_mavg = data['AAPL'].long_mavg['price']
            buy = False
            sell = False
    
            if short_mavg > long_mavg and not self.invested:
                self.order('AAPL', 100)
                self.invested = True
                buy = True
            elif short_mavg < long_mavg and self.invested:
                self.order('AAPL', -100)
                self.invested = False
                sell = True
    
            self.record(short_mavg=short_mavg,
                        long_mavg=long_mavg,
                        buy=buy,
                        sell=sell)
    
    ## Run the program.
    dma = DualMovingAverage()
    perf = dma.run(data)
    
    
    ## make pretty plots
    
    fig = plt.figure()
    ax1 = fig.add_subplot(211,  ylabel='Price in $')
    data['AAPL'].plot(ax=ax1, color='r', lw=2.)
    perf[['short_mavg', 'long_mavg']].plot(ax=ax1, lw=2.)
    
    ax1.plot(perf.ix[perf.buy].index, perf.short_mavg[perf.buy],
             '^', markersize=10, color='m')
    ax1.plot(perf.ix[perf.sell].index, perf.short_mavg[perf.sell],
             'v', markersize=10, color='k')
    
    ax2 = fig.add_subplot(212, ylabel='Portfolio value in $')
    perf.portfolio_value.plot(ax=ax2, lw=2.)
    
    ax2.plot(perf.ix[perf.buy].index, perf.portfolio_value[perf.buy],
             '^', markersize=10, color='m')
    ax2.plot(perf.ix[perf.sell].index, perf.portfolio_value[perf.sell],
             'v', markersize=10, color='k')
    
    plt.legend(loc=0)
    plt.gcf().set_size_inches(14, 10)
     
    #18     Oct 28, 2014
    bashatrader likes this.
  9. cjbuckley4

    cjbuckley4

    Why are people so adversarial on this website? Sometimes people make mistakes, but its not like anyone is knowingly misleading others or anything malicious. We're (mostly) here with the objective of participating in a community of traders for educational purposes. Not a personal condemnation @M.ST. , I'm just saying this site has a pervasive attitude of hostility that a) I don't understand b) I feel often detracts from both learning and answering the original question.
     
    #19     Oct 28, 2014
    eusdaiki likes this.
  10. Machine learning is multiple comparisons <=> data-mining <=> useless:

    http://en.wikipedia.org/wiki/Multiple_comparisons_problem

    There is no way in the world that any such procedure will generate a profitable system. But I cannot see the reason for all these buzzwords:

    SVM
    radial basis function
    data wrangling
    categories for the classification
    perform the data split into train
    Monte Carlo analyses
    system health

    None of the above will make any money, try as much as you want you get nowhere. The OP asked a specific question. Here is some AFL code. I don't know why would anyone want to use anything else, including this strange Python stuff.

    Code:
    SetBacktestMode(backtestRegular);
    SetTradeDelays ( 1, 1, 1, 1);
    CondLong = MA(Close, 50) > MA(Close,200) AND Ref(MA(Close, 50) ,-1) <= Ref(MA(Close, 200), -1) ;
    CondShort= MA(Close, 50) < MA(Close,200) AND Ref(MA(Close, 50) ,-1) >= Ref(MA(Close, 200), -1) ;
    Buy=Cover=CondLong;
    Short=sell=CondShort;
    BuyPrice=ShortPrice=Open;
    SetPositionSize( 100, spsShares);
    ApplyStop(0,1,5);
    
     
    #20     Oct 28, 2014
    eusdaiki likes this.