翻译与研读 Building Winning Trading System with TradeStation

Discussion in 'Philosophy and Strategy' started by 思迷思, Jul 15, 2005.

  1. 已熟悉了菜单和相关的选项,接下来让我们一起编一段小程序。开始编程时并不需要对菜单中的各种功能很熟悉。回到最开始的地方,将下列看到的文本键入PowerEditor编辑器。
    Inputs: longLength(40) , shortLength(40);
    Buy tomorrow at Highest ( High , longLength ) stop ;
    Sell tomorrow at Lowest ( Low , shortLength ) stop ;
    (注:对那些使用TradeStation 6.0的用户必须键入Sell Short以触发做空)
    键入完成后,在文件菜单下选择确认或使用F3功能键。菜单中许多命令都有相应的键盘快捷键。可以通过选择菜单及相应的选项来确定快捷键。(快捷键列在菜单项的最右侧)。当看到文件菜单中的确定选项时就可以看见F3键。执行此命名后,首先出现小对话框的提示信息是:Verifying,随后小对话框的信息是:Excellent。如果出现了错误,在文稿中检查代码的正确性并再做测试(确认)。恭喜,你已用信号的形式做了一次分析技术。
     
  2. Now let’s break each line of code down so that we can fully understand what is going on.
    Inputs: longLength (40), shortLength(40) ;
    By typing this line you have created two constant variable of the numeric data type. These two variables, longLength and shortLength, have been initiated with the value of 40. These variables cannot be changed anywhere in the body of the analysis technique. They can only be changed from the user interface of this signal or in the program heading. This will be discussed later in this chapter.
    Buy tomorrow at Highest (High , longLength ) stop ;
    This line instructs the computer to place a buy stop tomorrow at the highest high of the last 40 days. Highest is a function call. Functions are subprograms that are designed for a specific purpose and return a specific value. To communicate with a function, you must give it the information it needs. An automatic teller machine is like a function; you must give it your PIN before it will give you any money. In the case of the Highest function, in needs two bits of information: what to look at and how far to look back. We are instructing this function to look at the highs of the last 40 bars and return the highest of those highs. For now, just accept that High means High prices and Low means Low prices. ( This is yet another subject that will be touched upon later. ) When an order is instructed through EasyLanguage, you must tell the computer the type of order. In this case , we are using a stop order. Orders that are accepted by EasyLanguage are:
    . Stop . Requires a price and is placed above the market to buy and below the market to sell.
    .Limit . Requires a price and is placed below the market to buy and above the market to buy.
    . Market . Buys/sells at the current market price.
    So, if the market trades at a level that is equal to or greater than the highest high of the past forty days, the signal would enter long at the stop price.
    Sell tomorrow at Lowest ( Low , shortLength ) stop ;
    The instructions for entering a short position are simply the opposite for entering a long position.
     
  3. 我们将代码一行一行分开,看看它们到底都是什么意思:
    Inputs: longLength (40), shortLength(40) ;
    输完这行后我们就声明了两个数据类型是数字型的常数型变量,同时也用40对longLength , shortLength 这两个变量进行了初始化。这些变量的值在分析技术的代码体中是不能改变的。它们只能在信号的用户接口中或代码程序最开始的地方进行重新定义(或改变)。这章的稍后部分将讨论这个问题。
    Buy tomorrow at Highest (High , longLength ) stop ;
    这行指示计算机:明天在过去40天最高价的最大值stop价格处买入。
    Highest(最高价)是一个函数调用。函数是为特殊目的而设计的会返回一个特殊值的一些计算机子程序。只要给函数所需要的信息就可以与函数进行交互了。在提款之前要让提款机进行身份验证这点上自动提款机就有点象函数。Highest函数需要两个信息:要比较的是什么和比较的范围是多大。我们指示Highest函数比较过去40根条柱图的最高价并返回其中的最大值。此处就设定High是一天的最高价Low是一天的最低价(这也是随后要讨论的另一个课题)。当命令是通过EasyLanguage传递时,必须告诉计算机命令的类型。这段代码中我们用的停止指令。被EasyLanguage认同的命令类型有:
    . Stop . 设置在市场价之上买进和设置在市场价之下卖出的价格。
    .Limit . 设置在市场价格上下的买入价
    . Market . 当时市场的买卖价。
    所以当市场的交易价大于或等于过去40天最高价的最大值时,就会在停止(stop)价上发出做多信号。
    Sell tomorrow at Lowest ( Low , shortLength ) stop ;
    与做多相反,此指令发出的是做空信号。
     
  4. TradeStation StrategyBuilder
    Now let’s create a trading strategy with our simple Donchian Break Out signal. The StrategyBuilder is a program that asks all of the pertinent information concerning a trading strategy. It helps to organize all of the different trading ideas and makes sure all of the parameters are set before the signal is evaluated. Under the Go menu, select TradeStation StrategyBuild. A dialog box titled TradeStation StrategyBuild should open and look similar to Figure 1.2.
    Click on the New button. Another dialog box opens and asks for a name and notes for this strategy. In the Name field type,”MyStrategy-1”,and in the Notes field type,”A simple Donchian Break Out”. After typing the information into these fields click the Next button. The next dialog box asks for the signal to be used in this strategy. Click on the Add button. The next dialog box should look similar to Figure 1.3
    Scroll up/down and find MyStrategy-1. You will notice that the boxes under the Long Entry and Short Entry column headings are checked, but the boxes underneath the Long Exit and Short Exit are not. This tells us that the system only enters the market; it is never flat—the system is either long or short. Long positions are liquidated when a short position is initiated and vice versa. Our simple Donchian Break Out is a pure stop and reverse system. Click on MySignal-1 and click on the OK button. Click the next button and a dialog box like the one in Figure 1.4 will open.
     
  5. 现在我们就来用Donchian Break Out 信号来创建一个交易策略。StrategyBuilder是汇合建立交易策略方方面面信息的软件平台。StrategyBuilder协助整合不同交易思想,同时设置好信号评估需要的所有参数。在Go菜单下,选择StrategyBuild。一个标题是TradeStation StrategyBuild的外表如图Figure 1.2对话框随之打开。
    点击New按钮出现另一对话框,要求为准备创建的策略填写名字和相应注释。在域名中键入“MyStrategy-1”在注释域中键入“A simple Donchian Break Out”。完成后点击Next按钮。出现的对话框要求选择用于此交易策略测试的信号。点击Add按钮。出现的对话框如图1.3.
    上下滚动滚动条找到MyStrategy-1。你会发现位于做多和做空列标题下的方框已经打上了勾,但渣多渣空标题下的方框未选。这等于告诉我们这个系统是个单向交易的系统;它从不双向运行---或者做多或者做空。当做空信号产生时做多交易也就结束了,反之亦然。因此这个简单的Donchian Break Out是个纯粹的停止转向系统。点击MySignal-1,点击OK按钮,点击Next按钮,打开如图1.4的对话框
     
  6. This dialog is informing us that there are two input variables for our signal. You can change the inputs now, but let’s wait until later. If you did want to change the input values, you would simply select the Name of the input and edit the Value. Right now, simply click the Next button. The Pyramiding dialog box opens and asks if you would like to add positions in the same direction. Adding positions in the same direction occurs when our entry logic issues another buy signal and we are already long. We know that we will buy at the highest high of the past 40 days. This dialog is asking if we would like to continue adding positions at each subsequent 40 day high. If the market is trending , a new 40 day high could be made several times in successin. In this book, we will almost always only take one position per trade signal.
    Click on the Next button. The position information dialog now opens and asks for the maximum number of open entries per position and the maximum number of contracts/shares per position. Maximum number of open entries per position limits the number of positions you can add as a result of pyramiding. Maximum number of contracts/shares per position limits the number of total contracts/shares that can be put on per position.
    The dialog box also asks if you would like it to send a notification to the Tracking Center when our strategy generates a new order. For now, let’s accept the default values for the first two fields and make sure the box asking to send a notification to the Tracking Center is checked and then click Next.
     
  7. 支持一下。
     
  8. 此对话框告诉我们在信号中存在两个输入变量。现在可以改变这些输入了,但这个问题稍后再议。如果你的确想改变输入的值,仅需选择输入量的名字就可以编辑其值了。点击Next按钮。打开金字塔交易法的对话框并询问你是否采用追加买入。当已经做多而买入逻辑又发出另一个买入信号时追加买入信号就会出现。正如我们已经明白的那样我们是在过去40天最高价的最大值处买进。此对话框就是询问在随后出现的各个40天最高价处我们是否继续买入。如果市场以趋势运行,一个新的40天最高价会连续地出现几次。此书中,对每个交易信号我们几乎总是只买一次。
    点击Next按钮。出现仓位信息对话框并且要求输入每次最大的买入金额和最大买入股数。最大买入金额限制了依据金字塔买入法实施的每次追加买入量。最大买入股数限制了每次追加买入的总股数。此对话框还询问当采用的交易策略发出了新的交易命令时是否让系统向曲线管理中心发一标示信息。现在我们先就前两个域的选择采用缺省值并且选择向曲线管理中心发信息标示。点击Next按钮。
     
  9. 为了维护翻译小组的利益,此后仅给出手录的原文了。

    The Data referencing dialog opens and asks for the maximum number of bars study will reference. Our strategy only needs forty days of data to generate a signal. Remember, we are looking back forty days to find the highest high and lowest low. Always keep in mind how much data the strategy that we are working on requires and make sure that you tell the computer, via this dialog, that number. Make sure there are 40 or more in the field and click finish. Congratulations, again !. You have just created your first strategy. Seems like a lot of work doesn’t it ? TradeStation is just making sure that all the parameters are correct before testing a signal. Most of time, these parameters don’t change and you can simply click Next, Next, Next, Next and finally, Finish without paying much attention. Okey, let’s apply our strategy. This book assumes the reader knows how to create daily and intraday charts in TradeStation. Create a daily bar chart of a continuous Japanese Yen contract going back 500 days. When this chart has been plotted, go under the insert menu and select Strategy. A dialog box titled “Insert Analysis Technique” should open. Click on the Strategy tab and select MyStrategy-1 from the list of available strategies and click on OK. Anather dialog box titled “Format Strategy: MyStrategy-1” appears. Click on the input tab. You will see the two inputs that we have coded in our Donchian Break Out Signal.
     
  10. 又完成一段。第一章读到此我觉得它有点象在介绍怎样使用TS。

    By using the following line in our code, we have given the user of the strategy, be it ourself or someone else, the ability to change the longLength and shortLength inputs of MySignal-1.
    Inputs: longLength ( 40 ) , shortLength ( 40 ) ;
    You do not need to change the code to change the system from a 40- to a 50- day Donchian Break Out strategy. These inputs can be edited at anytime; before the analysis technique is inserted or after . You will notice that the values of these inputs default to those values that we had initiated when we programmed the signal in the PowerEditor. If you change these inputs from this dialog, they do not permanently change; they will only change during this session. If you want to change the inputs permanently, then change the value and click on the Set dedault button. If you do change these inputs, always make sure you change the maximum number of bars the analysis technique will reference parameter.
    You do this by selecting the Properties tab in our dialog box and changing the parameter. Let’s take a look at the Properties dialog. Click on the Properties tab. Your dialog window should change and look like the one in Figure 1.5.
     
  11. This dialog box allows the user to observe and change the current properties for MyStrategy-1. We initialized the properties when we first created the Strategy with the StrategyBuilder. We should be familiar with all of the property parameters except for the back testing rusolution. TradeStation enables you to specify the resolution or data compression to use for back testing your trading strategies. When you create a chart using data that has already been collected, TradeStation must make certain assumption about price movement. If you are back testing on daily bars, TradeStation does not know when the high or the low of the day was made. In some strategies, this information may be important. TradeStation calculates the chronological order of the high and low by using a formula. This formula is not always accurate and may lead to inaccuracies. ( This concept will be discussed in further depth in Chapter 6, but for right now , let’s ignore this option. ) Click on the Costs tab and you will be presented with the commission and Slippage $ values deducted for each trade. We all know what commission is. Slippage is the dollar value expected when the actual fill price minus the calculated fill price is calculated on each trade. Slippage is either positive or negative; it is positive when you get in at a better price and negative when you get in at a worse price. Most of time, slippage is negative. These costs can be charged on per contract/share basis or on a per transaction basis. If you trade 300 shares of AOL, you can have TradeStation charge a conmission/slippage on each share or for the entire trade. In addition, you will see the number of contracts/shares your strategy will assume with each new trade signal. If you select Fixed Unit, then this will be the fixed number of contracts/shares that will be traded throughout an historic back test. If you choose Dollars per Transaction and type in a value in the associated text box, the number of shares or contracts will be calculated by dividing the input amount by the price of the stock or by the margin of the futures contract. Go ahead and accept all of the default values by clicking the OK button.
    Since MyStrategy-1 is a pure stop and reverse system, you will probably get a New position dialog box that states the Market position has changed for JY. Let’s close this dialog box by clicking on the Close button. When this dialog box disappears, there should be one underneath it titled New Active Order. This dialog box lets you know that an order needs to be placed today. It will either say Buy 1 at a certain price stop or Sell 1 at a certain price stop. We need to learn more about the Tracking Center, so click on the Go to Tracking Center button. You may get anther dialog box that states: No Open Tracking Center window were found. Would you like to create one? Go ahead and click Yes. Your Tracking Center should look similar to one in Figure 1.6.
    Click on the Open Position tab and you will see the symbol we are currently testing, current position, entry price, entry time, open profit, and various other statistics. Click on the Active Orders tab and you should see a LE ( Long Entry ) order to Buy 1 at a certain price stop and a SX ( Short Exit ) order to Sell 1 at a certain price stop, if you are currently short.
     
  12. If you are currently Long, you would see a SE( Short Entry ) order to Sell 1 at a certain price stop and a LX ( Long Exit ) order to Buy 1 at a certain price stop. In real life order placement, you would simply place a single order to Buy/Sell 2 at whatever price that was issued on a stop. Reduce this window and the chart of the Japanese Yen with buy and sell signal should now be the only window on the screen. If you like, you can go under the view menu and select Strategy Performance Report and look at how the system performed over the test period. We will go much further in detail concerning the reports that TradeStation creates for the annlysis of Trading Strategies in Chapter 5.
     
  13. 谢谢!
    没有后文了?
     
  14. 辛苦了

    如何下载光碟呢?
     
  15. Microsoft Excel spreadsheet software
    微软 Excel 电子表软件
     
  16. 楼主,加油啊,支持你
     
  17. 建议楼主不要全盘翻译,选比较好的几章翻译即可。