Designing and Building a Profitable Automated Trading System

Discussion in 'Automated Trading' started by ScottD, Dec 9, 2008.

  1. #
    This whole thread is a fraud. It's all bullshit. I wouldn't believe a word of it. For the real results, see:
     
    #51     Dec 10, 2008
  2. I think it is worth reflecting on the originators of the MACD and the STOCH. They did it on the frontier of the times and they were able to critically think through how to get an absolute iundicator and a relative indicator to do a good job of measuring the market status.

    It is almost a requirement to read "The Predictors" to find out how silly the journalists and writers are and, furthermore, to see how absurdly the mathematics tail can wag the market.

    Information in any form has to be processed through logic, either binary or analog.

    To just use "a signal" to trade is a pure invitation to failure.
    To code up the cash cow we will use the mathematical feed of the pairs of values from three indicators, the volume paces and binary vector of volume. We can work intrabar and set an ATS loop rate (rep rate) that is in a pleasant range so that a human oriented display can be "read" for the fun of it.

    The output of the cash cow can be reversal signals and market capacity levels. Inputs: six price feed lines, seven or so volume feed lines and a capacity input These are between the left and right boxes. The right boxes are just fed raw data.

    Laying out the logic that takes the feeds and gives the trading platform outputs will emerge fairly fast now that we have it scoped out.

    Here is an overview of the logic functional blocks

    [​IMG]

    You will notice that there is one critical loop where circular reasoning must be avoided. That is no slow STOCH info can be fed out of the suppression circuit that is dependent on slow STOCH input to the suppression circuit. Slow STOCH logic can get to the EXIT logic in two ways, but not in a way that sets up an oscillator combination.

    There is flapping going on all the time and that is a "trimmer" signal on the coding cycle lap rate.
     
    #52     Dec 10, 2008
  3. #
    This is not a cash cow, it's a cow pie.

    Jack, why don't you knock off your gibberish and just post simple buy and sell rules in clear unambiguous English so anyone interested can code them? Answer: because they wouldn't work and it would end your pied piper game... at least for now.

    You like to play the wise old man who speaks in riddles but in reality you don't even understand the difference between hindsight and real time.

    You've been playing this game on the internet for at least 10 years and little has changed except for who you jerk around. Anyone wanting to verify this can easily search google groups.
     
    #53     Dec 10, 2008
  4. This is a composite of today the 10DEC08 0n the 5 min ES.

    To make it easier to analyze I put in wide HOLD bars in BLACK for long trades and red wide HOLD bars for shorts. Sidelined periods are shown in wide YELLOW.

    I used pink signals from the fast STOCH for ENTRY and green EXIT signals off the slow STOCH.

    There is one GOLD signal showing on the chart. IT is an entry signal for a long that could be taken in the MACD "short" context. This is the typical CW freakout hold that is painful if the EXIT signal is not taken. The EXIT signal for this GOLD entry IS another ENTRY signal from the fast STOCH that wipes out the lookback on the non stationary window I mentioned in an earlier post.

    I did not draw vertical narrow boxes to indicate the "end effect" slices. To get our feet wet we need to wade into the indicator logic slowly.

    This is the wrap for the day and a lot was covered yesterday and today. Obviously, my three assistants here are getting the job done. I check each of their work tasks before they are posted.

    We can delve further into the overall boxes to get the logic on the table. At this point it is getting clearer what each indicator work assignment is. MACD came in handy where you see the red and black X's and it was helpful on the gold signal too.

    What is most important is the being sidelined when mixed signals are present. What wasn't That is the topic of mixed signals. What made the sideline work was not getting an enter signal after an exit signal. So the messy part of trading is avoided by not generating a signal on the given fractal.

    I am really stifling some humor at this point.

    Thanks to scott for all the charts today. They really contribute to the assessing of the quality of the defaults when looking "across" the fractals.


    [​IMG]
     
    #54     Dec 10, 2008
  5. As a consequence of a review of several word groups that appeared I will make a comment or two using a simple focal point of the yellow zones where mixed signals appeared.

    If anyone has spent time in the CW of PA trading, then you are keenly aware of what happens when you "do not know that you know".

    I feel that it is like the geological evolution that happened during the "before" and "after" of tectonic plate theory in geology.

    The best parallel is the dilemma of adding electrician's tape to a soft ball to keep the cover on well enough to play on the play ground all before the days of parent's inventing "little league" by applying money to a sport.

    as it stands now we are doing 4 to 7 trades a day with certainty and we are kept out of the market when there is a "mess".

    THIS IS A MAJOR ACCOMPLISHMENT!!!!

    What happened was we substituted logic into the programming process as a replacement for a rule set composed of a bunch of written snetences.

    The yellow zones are there and they say the market is not giving clear instictions. As you look at the print you made in color, you see the price movement in the yellow zones. For sure if you are a CW -- PA only trader, you get to see those places od pronounced uncetainty that create bed and deep emotions.

    Reading from later in the day to earlier you see high volatility stalls and you see before that the results of low volume and a surplus of unfilled limit orders.

    These two things are VERY visible on the DOM and very visible on multi tic charts. The OTC is also a classic for expert traders to use. OTC means One Tic Charts.

    Both are where the slaloming comes in for making money. We can tune up the overall logic function chart to include this intermediate and expert trading over the course of time.

    Slaloming keeps a person on the right side of the market for when yellow periods come to an end.

    [​IMG]
     
    #55     Dec 10, 2008
  6. ScottD

    ScottD

    This is really great so far. I've read everything written at least once and mulled over certain areas. I've been working in the background and created a skeleton ATS that actually functions with rudimentary entry and exit signals. This is a nice project milestone after only a couple days. It means the rubber is meeting the road in multiple ways. I'm understanding much of what you're saying and, despite my elementary application development skills, I have been able to codify some of the logic.

    Please articulate the logic behind the IF ANDs. Prefer Boolean over analog for rapid application design. I think it would be fun to quickly develop an ATS that makes money and then, after the core engine is running, optimize it for maximum performance in multiple passes.

    The MACD is now souped up with upper and lower boundary levels.

    I've checked around and it appears automated pace lines are unavailable for MultiCharts/TradeStation. I'll examine the code from Ninja Trader and attempt to port it to MultiCharts.

    I'll post ATS code version 0.1 and a screen shot of the automated entries and exits for today.
     
    #56     Dec 11, 2008
  7. ScottD

    ScottD

    Here is the code for version 0.1 of the CashCow ATS. The name is nice and it's red rags for bull. In order for me to code stuff, I have to make the concepts very simple to match my lack of fluency in the programming language. As a side effect, it should be very easy to read.

    I have started to bring some MACD language into the code so that later I can form some logical constructs with it, but for now it's commented out. Anything in between curly brackets { ... } is commented out for now.

    Attached is a screen shot of the automated trade decisions. On the chart, you'll see labels for Long Entry (...LE), Short Entry (...SE), Long Exit (...LX), Short Exit (...SX) and, for today, End of Day Short Exit (EODSX). You will also see color coded vertical arrows showing the exact bar of entry and exit and horizontal arrows showing the exact price of entry and exit.

    Technically, it made net profits today with a 4/6 win rate. Realistically the P&L is irrelevant at this stage because the engine is extremely rudimentary and not yet even close to what Jack is describing. Having a rudimentary engine to improve is a nice start though.

    Code:
    {
    CashCow automated trading system
    Architect: Jack Hershey
    Version 0.1
    11 Dec 2008
    }
    
    variables:
    FastK5( 0 ), FastD5( 0 ), SlowK5( 0 ), SlowD5( 0 ),
    FastK14( 0 ), FastD14( 0 ), SlowK14( 0 ), SlowD14( 0 ) ;
    
    if Time > 945 and Time < 1600 then begin
    
    Value1 = Stochastic( H, L, C, 5, 2, 3, 1, FastK5, FastD5, SlowK5, SlowD5 ) ;
    Value2 = Stochastic( H, L, C, 14, 1, 3, 1, FastK14, FastD14, SlowK14, SlowD14 ) ;
    
    condition1 = CurrentBar > 2 and FastK5 crosses over 50 ;
    if condition1 and marketposition = 0 then                                                     
    	Buy ( "FastK5LE" ) 1 contract this bar at close ;
    
    condition2 = CurrentBar > 2 and FastK5 crosses below 50 ;
    if condition2 and marketposition = 0 then                                                     
    	Sellshort ( "FastK5SE" ) 1 contract this bar at close ;
    	
    condition3 = CurrentBar > 2 and (SlowK14 < SlowD14) and (SlowK14 crosses below 80)  ;
    if condition3 and marketposition > 0 then                                                     
    	Sell ( "SlowK5LX" ) 1 contract this bar at close ;
    
    condition4 = CurrentBar > 2 and (SlowK14 > SlowD14) and (SlowK14 crosses above 20)  ;
    if condition4 and marketposition < 0  then                                                     
    	buytocover ( "SlowK5SX" ) 1 contract this bar at close ;
    
    
    variables:  MACDVal( 0 ), MACDMA( 0 ), MACDHist( 0 ) ;
    
    MACDVal = MACD( Close, 5, 13 ) ;
    MACDMA = XAverage( MACDVal, 6 ) ;
    MACDHist = MACDVal - MACDMA ;
    {
    condition5 = CurrentBar > 2 and absvalue( MACDVal ) < 1.4 ;
    if condition5 and marketposition > 0 then                                   
    	Sell ( "MACDLX" ) this bar at close ;
    if condition5 and marketposition < 0 then                                   
    	Buytocover ( "MACDSX" ) this bar at close ;
    }
    	
    end;
    
    if Time > 1600 and marketposition > 0 then sell ( "EODLX" ) next bar at market;
    if Time > 1600 and marketposition < 0 then buytocover ( "EODSX" ) next bar at market;
    
    

    <img src=http://elitetrader.com/vb/attachment.php?s=&postid=2215939 width=800>
    click on attachment link to enlarge image
     
    #57     Dec 11, 2008
  8. ScottD

    ScottD

    Topic for my own clarification...

    There is confusing language in the industry surrounding stochastics.

    As a result, we need to validate that I've setup the Stoch parameters exactly as intended.

    The following is my current understanding...

    The stochastic oscillator formula can output 4 values:

    either:
    Fast%K
    Fast%D

    or:
    Slow%K
    Slow%D

    A "fast stochastic" outputs the first two values.

    A "slow stochastic" outputs the second two values.

    Therefore, it appears we should not refer to the Stocastic(14,1,3) as the "slow" stochastic unless we specifically want the Slow%K and Slow%D values. Especially since its middle value is "1" which I think automatically makes it a fast stoch.

    In written documents, perhaps we can use shorthand as follows:

    Stochastic (14,1,3): "Stoch14" (but not "slow stochastic").

    Stochastic (5,2,3): "Stoch5" (but not "fast stochastic").

    If we want the two fast lines of the Stoch14, then I suggest we call it "Fast Stoch14".

    If we want the two slow lines of the Stoch14, then I suggest we call it "Slow Stoch14".

    and so on.

    In addition, %K is faster than %D; however, we may want to avoid referring to one line as the "fast line"....because there can be a "slow fast line" -- Slow%K -- which is confusing. In our dialog, we can disambiguate by referring to the four lines as:

    FastK
    FastD
    SlowK
    SlowD

    ----------

    From what I have read, the three values in the stochastic formula are, in order:

    %K Periods. This is the number of time periods used in the stochastic calculation.

    %K Slowing Periods. This value controls the internal smoothing of %K. A value of 1 is considered a fast stochastic; a value of 3 is considered a slow stochastic.

    %D Periods. This is the number of time periods used when calculating a moving average of %K. The moving average is called %D and is usually displayed as a dotted line on top of %K.

    So, it appears our Stochastic(5,2,3) is a "slow" stochastic because the middle value is not 1.

    And our Stochastic(14,1,3) is a "fast" stochastic because the middle value is 1.

    We need to make sure that the MultiCharts stochastic indicator treats the "middle value" in the standard way.

    Does this make sense?
     
    #58     Dec 11, 2008
  9. We can take each of the boxes in the overall separately and show them as I/O boxes with the I's and O's named by a nomenclature you determine.

    I have been speaking about the chart representations of the lines on the indicators in a way I am accustomed to. This nomenclature goes back many many years on various web locations and in archived emails before the web got rolling. One consistency is that I have always used my real name when communicating.

    In coding the ATs's there are two principles that will serve us well (binary or analog): work in the direction of information flow from the general to the specific AND in any functional location be complete even though some sub functions may not come into use.

    Another minor point is the rep rate of the system. For making money and intrabar trading there is no need to be hustling along.

    As refinement takes place to increase effectiveness and efficiency going towards optimization, this is done by picking up more information lines that originate in the initial indicator boxes and using them in smaller more specific logic box locations. This approach precludes feedback oscillation (circular reasoning).

    Your approach of annotating the charts from the get go achieves two major goals of ramping up ATS software modelling and development: we stay on the same page in communications AND we get to see how moving from the left to right functionally and moving from general to specific works. We want to start with a left indicator based general core and build shells around it by adding more indicator functionality to the more detailed extraction capability. At some point the trading account function will come into the picture. as capital is compounded from profits only to build the equity curve, it will intersect the intraday market capacity curve. Presently we are building a volume module where a PACE look up table is located and the table will be kept up to date as is done in the SCT trading.

    In the original posting of the solution, we did assign the basic functions sets to each indicator. As was seen we did put in a suppression box in the upper row, center. It is fed by three functions, volume, MACD and the "slow STOCH 14". This is where the anomaly cases I annotated for the three indicators of 10DEC08. We will probably add an "entwine" function to the slow STOCH14 in that left box of the overall chart.

    Because there are many many ATS's out there it may be appropriate to address a couple of the generic problems they face. I would say the fine chop and coarse chop "prblems" that eat up the AM gains and create net daily losses could be something to handle soon. By having an "export function" from this ATS that can be temporarily plugged in to other ATS's those people then can reverse engineer their way out of the chop losses they encounter. By focussing on comtemporary generic problems like this, it can move the whole trading field ahead. It is a myth that if everyone knows something then that advantage goes away. The simple proof is that it has never happened as yet in 400 years of ATS's.
     
    #59     Dec 11, 2008
  10. To keep the illustrations simple (slicing wise) would you consider putting up a chart each time the ATS annotates the chart as you indicated is going on.

    We can, soon, then code up an advance warning SSS so we put up the chart BEFORE your ATS annotation and maybe put the intended happening in the blank place in the future. Usually this function is called "Tomorrow's Newspaper Today". Humorously, it is so old that newspaper data was being used at the time since PC's were not around as yet. (the telephone and crayola era).

    Because of IP and TS commitments I have, we will just take this to expert using a rational development of publically available info.

    The non stationary window defines the active data sets being used to maintain the context. (usually 15 bars or so). The pane or narrow slice in that context for completing profit segments is what we want to post as a rectangular frame within the nonstationary window for focussing our development purposes.

    It is a two step process: getting the logic articulated and then slipping over to the code and constructing the logic in code. Then for practcal reasons we determine that the code is doing the logic and the logic is doing it's intended function. Iterative refinement sometimes happens.

    The caveat is that nothing can be done by induction and the cases have to be in null hypothesis application logic.

    I'm not sweating the indicator coding comments since they are just arithematic.
     
    #60     Dec 11, 2008