发表于 2013-12-29 15:05
Top Previous Next
The following is a comprehensive list of the Trading Blox global Simulation Parameters, and an explanation of how each is used. The global Test Parameter values can be viewed and changed using the Global Parameters tab. To reset the parameters to their default values, the following picture shows them.
Set to true to enable earning interest on available cash. Set to false to disable earning interest. The rates are set in the currency rate file for your system base currency. If you are using USD as your system wide base currency, then the rates are in the USD_Rates.txt file in the Forex data directory. The Lending Rate is used when earning interest.
Earned Interest is calculated on the cash balance of the account. Money used to purchase stocks is deducted from this cash balance. Money used as margin for futures trading is not deducted from the cash balance since many brokers will allow T-Bills for margin requirements allowing traders to earn interest on the money that is used for margin.
The frictional cost of trading has two components: commissions, and slippage (sometimes also known as "skid"). In actual trading, slippage is the difference between a trade's entry or exit order price, and the price at which the trade is actually filled. In order to accurately reflect the conditions of real trading, the impact of slippage must be simulated during back testing.
Since slippage can vary dramatically from trade to trade, depending on market conditions at the time an order is executed, Trading Blox employs a slippage assessment technique that is based on market volatility.
The simulated fill price is obtained by calculating a slippage factor, which is added to (or subtracted from), the theoretical entry price.
For a long entry, the slippage factor is calculated by measuring the range from the theoretical entry price to the day's highest price, and multiplying that amount by the Slippage Percent. (For short entries, the slippage factor is calculated by measuring the range from the theoretical entry price to the low). The slippage factor is then added to, or subtracted from the theoretical entry price, to obtain the simulated fill price.
Here's how it works for a buy trade:
Theoretical buy order price
High Price (for the day)
(120 - 100) x 0.25 = (20 x 0.25) = 5
Simulated fill price
Order Price + Slippage Factor = (100 + 5) = 105
The distance between the high price and the order price is multiplied by the slippage factor. In this example, the difference between the high price and the order price is 20 points. The 20 points are multiplied by the 25% slippage to get an estimated slippage of 5 points. The fill price for the order will be 5 points worse than the stop order price of 100 simulating a fill at 105.
Slippage for sell orders is computed using a similar calculation using the distance between the order price and the low of the day.
In historical back testing, failing to accurately estimate slippage can lead to two types of mistakes: Underestimating frictional costs may lead you to trade a system that produces spectacular hypothetical results, but does not hold up well under real trading. Conversely, overestimating frictional costs may dissuade you from trading an otherwise good system.
It is also worth noting that the more frequently a system trades, the more profound the impact of frictional costs will be.
Applies to Futures only. Minimum Slippage is based on a fixed currency value. This parameter works in conjunction with Slippage Percent (above).
If set to a non-zero value, this parameter ensures that some slippage cost is assessed against every trade. Trading Blox will impose Minimum Slippage only if the currency value resulting from the Slippage calculation (based on Slippage Percent, above) is less than the currency value of slippage as calculated by the Minimum Slippage parameter.
Where entry occurs at or near the high or the low of the day, the potential adverse range is practically nonexistent, so the Slippage Percent calculation would be at or near zero. In this case, Minimum Slippage can ensure that some slippage is assessed on the trade.
If Slippage Percent is set to zero, then the slippage for all trades will be the value specified by the Minimum Slippage parameter value.
Notes: Can cause fill price to be outside of daily high low range.
Max Percent Market Volume
Max Percent Market Volume determines the maximum trade size based on a percentage of the current volume. For example, if the volume is 200,000 shares and this parameter is set to 2%, this means that the maximum allowed trade size is 2% of 200,000 or 4,000 shares. If an order is placed for 6,000 shares, it will be reduced to 4,000 shares, and an entry will show in the Filtered Trade Log so that you are aware that the order size was reduced. The volume used is the 5-bar exponential moving average of the volume.
Max Margin/Equity to trade
The default is 100%, in that if a requested trade would require more than 100% of available equity in margin or cash, then the trade will be filtered. This parameter allows you to mofidy this behavior. If you enter 50 here, the system will filter trades if the new total margin required would be greater than 50% of the total available equity.
Trade Always on Tick
When this parameter is set to false, the system will trade with maximum precision. So if the system buys Gold on a stop at the moving average, which is 365.44789, then the system will buy at that exact value. Conversely it will exit the trade at an exact value as well. The trade price as listed in the trade details will only show the digits of precision of the instrument, as set in the Futures Dictionary, so the trade price would look like 36.45. But the trade profit would not match that value exactly.
When this parameter is set to true, the system will always trade on the tick. It will round up to the nearest tick for buy orders, and down for sell orders. So in the above example, if you placed an order to buy on stop at 365.44789, the system would place the order to buy at 365.45.
The fill prices would also be on tick, so a slippage of 10% could become more as the order price and then fill price gets pushed to a tick.
Smart Fill Exit (Smart Exit Fills)
When set to true, this function will only fill the exit stop/limit order closest to the open for any particular unit. This can be helpful when using multiple exit blox that place stop/limit orders. If the open is at 10, (and the high is 12 and the low is 7), and you have an exit stop at 11 and a limit order at 8, the stop exit order will be filled.
Entry Day Retracement
This is used to determine if a new position would have been stopped out on the same day as entry.
The Entry Day Retracement percent is multiplied by the distance from the high to the low of the day.This amount is then added/subtracted from the order fill price. This is the Trigger Price and if this number is beyond the stop price, then the entry is stopped out same day.
For long entries the Trigger Price is the Fill Price - ( High - Low ) * Retracement %
For short entries the Trigger Price is the Fill Price + ( High - Low ) * Retracement %
The Trigger Price is never more than the High, or less than the Low.
The Trigger Price is never more than the close for long entries, or less than the close for short entries.
In this way, a Retracement % of zero will use the default behavior outlined below (aggressive approach). A Retracement % of 100 will use the extreme of the day (conservative approach).
In addition to the above rules, as a default:
· If the position was filled during the day (stop/limit orders), and the close is less than the stop for long entries or more than the stop for short entries, then the position is stopped out
· If the position was filled on the open of the day, and the low is less than the stop for long entries or the high is more than the stop for short entries, then the position is stopped out
Use Broker Positions
Set to true to insert the broker positions, as entered in the Broker Position Editor, into the simulation. These positions will be entered for both testing and order generation.
Ignore All Test Positions
Set to true to ignore all the test generated positions. Use this when the only positions you want in the test, or order generation, are the broker positions. Use Broker Positions must be true for Ignore All Test Positions to have an effect. Often this is used on the very first day of order generation so that you can start with a clean slate and no open positions. If you want a mix of actual positions and theoretical test positions, then leave this box unchecked.
Use Start Date Stepping
Set to true or false to enable or disable the the Increment Test Start option and the Set Test Duration Option.
Increment Test Start ( trading days )
This feature is useful for testing a system's robustness by varying the start date without running multiple tests. This setting will use the initial test start date but will add the number of trading days (weekdays) to it. For instance, if your original test settings are 2005-01-03 and you enter a value of 3 here, your actual trading will start on 2005-01-06. If you step from 0 to 2, you will get results starting in 2005-01-03, 2005-01-04, 2005-01-05.
The new start date cannot be beyond the test end date set by the user.
Set Test Duration ( trading days )
This setting overrides the original test end date setting. It is useful for testing system robustness by varying the test duration without running multiple tests. If you set this value to 100, every test regardless of start date will be 100 days. Note that the maximum test end date is still the date you entered, so be sure to leave room for both the start date stepping and the test duration so every test is the same length.
ie Test Start is 1995-01-01 Test End is 2005-01-01
Increment Test Start from 0 to 250 Step 10 (one year step 2 weeks)
Set Test Duration to 2000 (8 years)
The new test end date ( the test start plus duration ) cannot be beyond the test end date as entered by the user.
Minimum Futures Volume
This parameter applies only to futures. It establishes the minimum daily trading volume, in contracts, required to enter a futures position. It is based on a 5-day exponential moving average of the volume. This value can be viewed by using the instrument.averageVolume property when using the Builder Edition.
Commission per Contract
This parameter indicates the round-trip charge for each futures contract traded. Assuming a Commission per Contract of $12.50, buying and then subsequently selling 1,000 contracts of sugar would result in a total transaction cost of ($12.50 per contract) x (1,000 contracts) = $12,500.
Trade Futures on Lock Day
When this parameter is set to false, the simulation will not fill entry or exit orders on days when the high = low, when the trade is in the direction of the lock. The idea is that in futures this could be a lock limit day, and it would be the most conservative assumption to assume you did not get filled.
If you set this parameter to true, you will be filled on these days. This applies to futures only.
Example: With this parameter set to false, and the high equals the low, so it is considered a lock day. If you want to enter long, or exit a short position, and the close of the lock day is less than the close of yesterday, then it will be allowed. But if the close of the lock day is greater than or equal to the close of yesterday, then the fill will be denied.
Account for Contract Rolls
This parameter applies only to futures, and controls whether or not Trading Blox should account for the increased commission and slippage that would have resulted when rolling contracts when a position is held for a long period of time.
If your data includes the Delivery Month of the futures contract being used on any given day in the backadjusted data, then Trading Blox will use this to determine when to roll. It will account for a roll every time the delivery month changes.
If your data does not include the Delivery Month, Trading Blox will estimate when a roll would occur based on the number of trading months listed in the Futures Dictionary. If you actually roll less often than you have months listed, then you should reduce the list to just the roll months, for most accurate results here.
If there are 4 trading months, then Trading Blox will calculate a contract roll every 3 months. If there are 12 trading months, Trading Blox will calculate a contract roll every month. The first simulated roll will occur in 1/2 the normal roll frequency because, on average, the first contract will be entered with 1/2 its trading life left. This process is based on calendar days and works for intraday, daily, weekly, or monthly data.
Each time a simulated roll occurs, Trading Blox accounts for the roll by deducting slippage and commissions for each contract in the position. The Open Equity is moved to Close Equity. If the futures is non-USD denominated, the currency conversion for the roll date will be used to move profit from open equity to closed. So the profit is locked in at the conversion rate of the roll.
Roll Slippage (% of ATR)
This option is available when Account for Contract Rolls is set to true.
The slippage used is the roll slippage percent of the Wilder 20-day ATR (39 day non SMA primed Exponential Moving Average of the True Range). This is an unprimed value, and can be accessed by the instrument.defaultAverageTrueRange property.
Minimum Stock Volume
This parameter applies only to stocks. It establishes the minimum daily trading volume, in shares, required to enter a stock position. It is based on a 5-day exponential moving average of the volume. This value can be viewed by using the instrument.averageVolume property when using the Builder Edition.
Commission per Trade
This parameter indicates the commission charged on a per trade basis. This type of commission charge is used by some brokers for stock brokerage accounts.
Assuming a theoretical Commission per Trade of $5.00; Buying 100 shares of XYZ stock would count as one trade, and selling that same 100 shares would be a second trade, for a total transaction cost of $10.00.
Commission per Stock Share
This parameter indicates the round-trip charge for each stock share traded. This can be used in place of or in addition to the Commission per Trade. For example, assuming a Commission per Contract of $0.02, buying and then selling 1,000 shares of IBM would result in a total transaction cost of ($0.02 per share) x (1,000 contracts) = $20.00. NOTE: Most stock brokerages charge commission for each one-way trade, once for the entry, once for the exit For Trading Blox, use a Commission per Stock Share of double the per share commission charged by your broker for one-way trades.
Commission by Stock Value
Uses a percent of the stock value as the commission amount.
Convert Profit by Stock Splits
With stocks, when the data is backadjusted for stock splits, the profits made/lost are respectively smaller as the prices get smaller. Take MSFT as an example. The close on Jan 2, 1987 was $47.75, and the close on Feb 2 was $73.00. But your backadjusted data will probably show around $.17 on Jan 2 and $.25 on Feb 2. So if you bought 100 shares at the close on Jan 2 and sold at the close on Feb 3, you would have made $25.25 per share, or $2,525 total. But many simulations would show a profit of just $.08 per share, or $8 total.
If you set this parameter to true, Trading Blox will determine that the real profit for this trade was $25.25 per share. Your simulation will then be accurate even though the data has been adjusted.
Trading Blox will convert the profit on each trade by the stock split ratio between the trade entry and the trade exit, and it will also convert the volume in the data file back to the real volume amount using the stock split ratio. This volume number is only used for the AverageVolume property, which is used for the Max Percent Volume per Trade and Minimum Stock Volume global parameters. You can also access these properties as instrument.adjustedVolume, and instrument.averageVolume.
The stock split ratio is the unadjusted close / close for any given day, so be sure to include the unadjusted close in the data.
Create two MFST files in CSI, one with no adjustements, and one with stock split adjustments. If you look at the volume on 2005-01-03 for MSFT using the unadjusted data, you will see that the volume presented is 39,545,600. (Note that there is a volume multiplier of 100 in play here as well, so the number you see is actually 395456.) The stock split ratio on that day is 16, so the actual volume traded was 2,471,600. If you are trading a max percent of the day's volume, then you would want to use the adjusted volume number rather than the unadjusted number that is provided in the data file.
Likewise, if you use the example above, you want to make sure the profit on a 100 share trade reflects the actual value of that trade in 'todays' dollars. So Trading Blox converts the profit using the stock split ratio as of the trade entry.
In addition, Trading Blox needs to know when the stock split was, in relation to the dividend distribution. So if you purchased 100 shares, the stock had a 2x stock split, and then a $.50/share dividend, that is a different profit than if you purchased 100 shares, the stock had a $.50/share dividend, and then it had a 2x stock split.
This is why it's important to keep the stock splits and dividends separate. The stock splits alter the data in a geometric manner, whereas the dividends are simple unadjusted per share amounts. If you try to stuff proportionally adjusted dividend data into a stock split adjusted series, you will get the wrong P&L everytime.
So, set your CSI UA to adjust the stock data by stock splits only, be sure to include the unadjusted close, and call CSI to get the unencrypted dividend data so Trading Blox can build those files for you. CSI will provide the unencrypted dividend data to all Trading Blox customers free of charge.
Set to true to account for dividends in the test. The dividend files should be setup in the Dividends folder. The dividend file suffix can be changed in the INI file.
Pay Margin on Stocks
This parameter is for stocks only, and defines whether the system will charge margin for excess cash used when buying stocks. The values used are from the system wide base currency rate files. In the case of USD, the file is the USD_Rates.txt file in the forex data directory. The Borrow Rate is used when accounting for margin.
Margin Interest is charged every day when available cash falls below zero.
Forex Trade Size
The inter-bank forex market trades in units of 100,000 base currency. Many retail forex brokers allow trading units of smaller size. This parameter controls the unit size to allow for simulation of trading through retail forex brokers.
Account for Forex Carry
This determines whether or not to account for Forex Carry charges (see Forex Carry Calculations for details).
Use Pip-Based Slippage
Since many retail Forex brokers have fixed spreads per market and guarantee "zero slippage" fills, Trading Blox provides for this using a fixed per-market slippage which is defined by the spread in pips for each market. The spread for each market should be set to the figures your Forex broker uses or a larger number for more conservative testing. See Forex Dictionary for information on changing the Forex market spreads.
When set to TRUE, the parameter Use Pip-Based Slippage overrides the normal Trading Bloxslippage calculations (based on a fixed amount or percentage) for the Forex markets only.
See also the tradingblox.ini file for more settings options.