The trancendental use of Data in Optimizations

Discussion in 'Data Sets and Feeds' started by TSOKAKIS, Feb 11, 2003.

  1. We may improve optimization results, if we improve our "logic" .
    There is a usual procedure in optimizations:
    When we optimize, MSFT for example, we use MSFT data.
    Is there any special reason ? I do not think so.
    We just suppose that MSFT data match better with MSFT.
    It looks obvious but not necessarily true.
    From the math point of view, EOD [OHLCV] is nothing more than a 5-d vector .
    Which vector fits better to the trading behavior of a certain stock ?
    I was surprised to notice that a foreign OHLCV may be more expressive than the stock OHLCV itself !!
    The research looks quite interesting and may expand the use of optimization in more profitable areas.
    The "normal" use of MSFT data for MSFT optimization is restricted to some optimal values.
    The "transcendental" use of some other data for MSFT optimization gives, in many cases, a visible improvement.
    MSFT study may "borrow" some other data, some other stocks fit better to the indicator we use.
    Join this fact with the [existing] directionality of the market and you will have another interesting
    method for this endless game.
    Let us see the technique:
    Suppose we work the single level D-ratio and we optimize DELL.
    D-ratio is a very simple and useful indicator.
    It is defined as
    D-ratio=1000*(H-L)/(H+L)
    and usually oscillates in the [0,100] region.
    The optimal solution is for D1=43 with 17 trades/12 winners/5losers, total Net Profit +176% since Jan2000,
    with a profit factor 2.84 as it comes from the AFL code 1.

    // Code 1: Single level D-ratio optimization
    Dratio=1000*(H-L)/(H+L);RRR=DEMA(Dratio,5);RRRR=DEMA(RRR,10);
    D1=Optimize("D1",39,10,70,1);D2=D1;
    F1=RRRR>=D2;F2=RRRR<=D1;
    Sell=F2;Buy=F1;Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);
    Short=Sell;Cover=Buy;Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);

    A quick 5-day DEMA was applied to increase sensitivity and a second 10-day DEMA to avoid whipsaws.
    [Settings : Trade at +1Open, commission 0.5%, all stops disabled]. See Fig. 1

    Searching now for better solutions, let us see from the basket of Favorites how some other data perform on DELL trading:

    // Transcendental use of Data in Optimizations
    // Application : Single Level d-ratio
    // by D. Tsokakis, Feb 2003

    NUM=Optimize("NUM",4,0,12,1);
    N=
    WriteIf(NUM==0,"^NDX",
    WriteIf(NUM==1,"AAPL",
    WriteIf(NUM==2,"AMZN",
    WriteIf(NUM==3,"BEAS",
    WriteIf(NUM==4,"CSCO",
    WriteIf(NUM==5,"DELL",
    WriteIf(NUM==6,"INTC",
    WriteIf(NUM==7,"MSFT",
    WriteIf(NUM==8,"ORCL",
    WriteIf(NUM==9,"RFMD",
    WriteIf(NUM==10,"SYMC",
    WriteIf(NUM==11,"YHOO",
    "QQQ"))))))))))));
    H=Foreign(N,"H");L=Foreign(N,"L");
    Dratio=1000*(H-L)/(H+L);RRR=DEMA(Dratio,5);RRRR=DEMA(RRR,10);
    D1=Optimize("D1",39,10,70,1);D2=D1;
    F1=RRRR>=D2;F2=RRRR<=D1;
    Sell=F2;Buy=F1;Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);
    Short=Sell;Cover=Buy;Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);

    The result is impressive.
    It would be much better to trade DELL using RFMD [No 9] or ^NDX [No 0] or BEAS [No 3] data.[see Fig. 2]
    The exclusive use of RFMD [set NUM=9; ]data gives a wide range for D1 [40 to 80] to trade DELL with a profit range [+50% to +900%].

    This first example leads to the main question: Are there some "model" stocks which fit better to this D-ratio version for the whole market ?
    Optimize the whole N100 database with the transcendental formula and see the Profit distribution per stock and level at fig. 3
    CSCO around D1=39, ^NDX around D1=26 or INTC around D1=25 give good results for the whole market.
    [See CSCO/39 market performance at fig. 4]

    It is interesting to "borrow" some Data from another stock which match better to our indicator.
    Dimitris Tsokakis
    References :
    AFL is Amibroker Formula Language, the basic tool of Amibroker software from amibroker.com
    The D-ratio was designed by me some time ago and a lot of interesting applications are posted at
    http://groups.yahoo.com/group/amibroker/messages/
    Result lists and figs from amibroker.
     
  2. Here is the additional Fig. 3 and Fig. 4
     
  3. man

    man

    At the moment I do not have anything useful to add from my own research, but I am looking forward to the development of this thread.
    The topic moves somehow towards multivariate analysis, which I find very interesting.


    peace
     
  4. Let us use another example for the popular Stochastic trading system.
    To smooth the oscillator and avoid undesirable whipsaws, we will study
    the trading properties of
    Y=DEMA(StochD(X),X1);
    The basket of stocks was
    ^NDX, AAPL, AMZN, BEAS, CSCO, DELL, MSFT, ORCL, RFMD, SYMC, YHOO and QQQ
    and the period was the last 720 bars. Settings were trade at Open, Delay +1, commission 0.5%
    and all stops disabled.
    Is there a universal level system to trade this basket of stocks ?
    The optimal solution is coming from the optimization
    X=20;
    X1=15;
    Y=DEMA(StochD(X),X1);
    B1=Optimize("B1",15,10,30,5);
    S1=Optimize("S1",65,50,80,5);
    Buy=Cross(Y,B1);Sell=Cross(Y,S1);Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);
    Short=Cross(S1,Y);Cover=Cross(B1,Y);Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);
    and the results are presented on Fig. 1.
    If we use B1=20 and S1=55 we may reach the ideal total Net profit +189%.
    Note that profits decrease dramatically as we change B1, S1 values
    [only 5 combinations perform better than +100%]
    Let us apply now the transcendental use of data : All these 12 stocks will follow one unique
    Stochastic curve, which will produce the universal trading signals for any stock.
    The new optimization AFL code is

    NUM=Optimize("NUM",4,0,12,1);
    N=
    WriteIf(NUM==0,"^NDX",
    WriteIf(NUM==1,"AAPL",
    WriteIf(NUM==2,"AMZN",
    WriteIf(NUM==3,"BEAS",
    WriteIf(NUM==4,"CSCO",
    WriteIf(NUM==5,"DELL",
    WriteIf(NUM==6,"INTC",
    WriteIf(NUM==7,"MSFT",
    WriteIf(NUM==8,"ORCL",
    WriteIf(NUM==9,"RFMD",
    WriteIf(NUM==10,"SYMC",
    WriteIf(NUM==11,"YHOO",
    "QQQ"))))))))))));
    H=Foreign(N,"H");L=Foreign(N,"L");C=Foreign(N,"C");
    X=20;X1=15;
    Y=DEMA(StochD(X),X1);
    B1=Optimize("B1",15,10,30,5);
    S1=Optimize("S1",65,50,80,5);
    Buy=Cross(Y,B1);Sell=Cross(Y,S1);Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);
    Short=Cross(S1,Y);Cover=Cross(B1,Y);Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);

    The results are on Fig. 2 and speak better.
    CSCO or ^NDX Stochastic give more profitable pattern for the whole basket than individual Stochastic
    per stock.
    Dimitris Tsokakis
     
  5. How about the smart money ?
    From the Market Profile we see that buyers acted better : the higher % of money spent were in the area
    [10,20]. On the other side, a lot of money were spent in the [50,60] interval : Sellers are forced for a
    premature exit, when Stochastic is ascending, or take delayed action when stochastic is descending.
    The majority of the capital spent does not make interesting profits, from the Stochastic point of view !!
    Dimitris Tsokakis
     
  6. Here is the top10 of N100 stocks for the transcendental data method.
    The AFL code was

    NUM=Optimize("NUM",15,0,9,1);
    N=
    WriteIf(NUM==0,"AMAT",
    WriteIf(NUM==1,"CPWR",
    WriteIf(NUM==2,"CSCO",
    WriteIf(NUM==3,"JNPR",
    WriteIf(NUM==4,"MXIM",
    WriteIf(NUM==5,"NTAP",
    WriteIf(NUM==6,"PSFT",
    WriteIf(NUM==7,"QCOM",
    WriteIf(NUM==8,"TMPW","VRTS"
    ))))))))) ;
    H=Foreign(N,"H");L=Foreign(N,"L");
    Dratio=1000*(H-L)/(H+L);RRR=DEMA(Dratio,5);RRRR=DEMA(RRR,10);
    D1=Optimize("D1",46,39,48,1);D2=D1;
    F1=RRRR>=D2;F2=RRRR<=D1;
    Sell=F2;Buy=F1;Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);
    Short=Sell;Cover=Buy;Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);

    Settings : Buy, Sell, Short, Cover at Open
    Delay +1
    Commission 0.5%
    Stops disabled
    Period : Jan3, 2000 till Feb14, 2003
    The result list means that if you trade the whole N100 database, using CSCO data [NUM==2]
    and D-ratio cross level D1=39, the market would make Net Profits +631%
    All the 100 combinations are profitable for the market from 10% to 800%.
    There are many other profitable combinations, we just use here the 10-step range D1= [39,48]
    Remember that past performance does not give any guarantee for future behavior.
    I hope it is useful to see the transcendental use of data, the first step in multiparametric analysis.
    Dimitris Tsokakis
    Notes :
    1. AFL is the Amibroker Formula Language from amibroker.com
    2. For the distribution graph the Herman van den Bergen method was used from
    http://groups.yahoo.com/group/amibroker/files/Herman van den Bergen/AB3DCharts.zip
    The rest is a part from my Transcendental Method notes.
     
  7. Here is the distribution graph.
     
  8. What are the ranges of ROI that you are talking about?
     
  9. could you just show a brief table of say five stages of improvement by that addition of a series of pertinant factors that iteratively improve what you are talking about.

    Use the base you mention in my prior Q.
     
  10. scJohn

    scJohn

    How are you accounting for survivor bias in the NASD 100? For instance, in post #8, you used data from 1/3/2000 to 2/14/2003. Now, did you use the stocks in the NASD 100 that existed on 1/3/2000 for your analysis or the NASD 100 stocks that exists, now.

    You picked the 10 largest stocks. Assuming you are using market cap, are you using the market cap as of today, or the market cap of the stocks as of 1/3/2000.
     
    #10     Feb 16, 2003