Readme File for TradeSim.DLL Metastock Plugin

For Metastock End of Day and Professional Version 7 and above.

Last updated May 23, 2012

Copyright © 2000-2006 by Compuvision Australia P/L. All Rights Reserved.


This document contains important information that was not included in the User Manual for the current release. Please read this information carefully for last minute updates and inclusions.

Contents

  1. Release Notes
  2. Important Issues regarding the TradeSim.dll External Plug-In
  3. TradeSim.dll External Plug-In Revision History

Release Notes


Important Issues regarding the TradeSim.DLL External Plug-In

The TradeSim user manual now contains a new section which deals with some common problems and issues when using the TradeSim.DLL External Plug-In with Metastock. You should read this section before using the TradeSim External Plug-In.

TradeSim.DLL External Plug-In Revision History

Version Status
Release Date
Changes, Updates and Fixes Additions
8.4.6.243
Final
23-May-2012
  • Disabled re-seeding the random number generator each time the Rand() function was called which would have the effect of generating the same random number sequence.
8.4.5.242
Final
20-May-2011
  • Fixed problem using pyramid trades with SetVariableProfitStop and SetExitPriceToProfitStop which would attempt to exit on the same bar at different prices where only the base trade would exit on the correct price.
8.4.4.241
Final
9-Mar-2011
  • Added ExtFml("TradeSim,AssignValue",Risk,"symbol",xxx)
  • Added ExtFml("TradeSim,AssignValue",Reward,"symbol",xxx)

You can specify the reward and risk which corresponds to the profit stop and initial stop.

For long trades

reward = ExitPrice - EntryPrice
risk = EntryPrice - InitialStop

For short trades

reward = -(ExitPrice - EntryPrice)
risk = -(EntryPrice - InitialStop)


to exit exactly at the stops you need to add

ExtFml( "TradeSim.SetExitPriceToInitialStop");
ExtFml( "TradeSim.SetExitPriceToProfitStop");

8.4.3.240
Final
16-Mar-2010
  • Fixed problem when using SetTimeStop with -days parameter and UseAllSignals.
  • Fixed problem calculating Trade Highest/Lowest dates.
8.4.2.239
Final
4-Jul-2009
  • Fixed problem where the plugin would not automatically load TradeSim when MetaStock was launched.
8.4.1.238
Final
4-Jul-2009
  • Profit Stop's now have higher priority over Normal Exits. Previously when there was a profit stop and a normal exit on the same bar then the trade would exit at the price specified by the ExitPrice array even if SetExitPriceToProfitStop was called. Now when there is a Profit Stop and Normal Exit on the same bar and SetExitPriceToProfitStop has been called, the trade now exits at the Profit Stop price and not at the price specified by ExitPrice array.
8.4.0.237
Final
28-May-2009
  • Removed volume from Invalid array index checking. This allows index securities to be used without triggering an error since they usually contain no volume information.
  • Added SetAltPyramidEntryTrigger function which allows pyramid trades to be re-entered at a trigger that is different to the EntryTrigger.
8.3.1.236
Final
26-Apr-2009
  • Fixed problem where SetTimeStop NBARS would stop out after half the number of specified bars but would display the specified number of bars in the trade database manager but the number of days would actually reflect half the specified number of bars. Versions prior to 8.3.0.235 worked correctly.
8.3.0.235
Final
29-Mar-2009
  • Fixed compatibility issues with Metastock Version 7.22 and 8.
  • Fixed some resource leakage issues.
8.2.4.234
Beta
19-Mar-2009
  • Removed the "Security rejected because of Survivorship Bias Filter" message from the report log but is now displayed on the report log status bar in red type font.
8.2.3.233
Beta
13-Mar-2009
  • Fixed problem where the confirm entry(CE) flag for each trade would not be written to the trade database properly if EnableDelayOfEntryByOneBar was set.
8.2.2.232
Beta
14-Feb-2009
  • Added IncludeAllSignals function which includes all trades for every entry trigger. Previously when a trade was pending additional entry triggers from the same security would be ignored and not included in the trade database. Enabling this will generate a trade for every entry trigger.
  • Added CE(Confirm Entry) bit for each trade to faciltate Provisional Trades. When the EntryTrigger is a positive non zero value then CE is set to true. If EntryTrigger is a non zero negative number than CE is set to false.
  • Add Survivorship Bias Filter function ApplySBFTable which faciltates creating survivorship bias free trade databases.
8.2.1.231
Beta
TBA
  •  Removed index checking for volume data which was casuing problems on some index security data which did not use volume.
8.2.0.230
Beta
TBA
 
  • Added support for intraday data with time stamp.
8.1.0.227
Final
 31-Aug-2008
  • Fixed problem where SetVariableVolatility would remain sticky even after a call to Initialize.
  • Fixed problem where UseVariableVolume would remain sticky even after a call to Initialize.
8.1.0.224
Final
 9-Jun-2008
  •  Fixed problem where DLL version information would sometimes not be correctly displayed.
  • Fixed problem where security data with dates less than Jan 1970 would cause erratic behaviour when a trade database exploration was run.
8.0.0.223
Final
 28-Mar-2009
 
  • Added Trade High and Trade Low Date information to the Trade Database
7.1.0.222
Final
26-Jun-2007
  • Initialize TimeStop Delay variable was not being set to zero.
  • Added SetVariableVolume function to allow user to assign traded valume using a Metastock formula rather than the predefined values.
7.0.2.221
Beta
17-Apr-2007
  • SuppressFileProcessing has been disabled. For debugging use the ShowTrades function.
  • Added warning when trades are appended to an existing trade database using the AppendTrades function.
7.0.1.220
Beta
3-Apr-2007
  • Changed function naming of ShowChart to ShowTrades.
  • On our Version of Metastock 7.0.2 using the exploration with "Minimum records" in the exploration options can cause some unusual side effects so it is not recommended. Use the appropriate number of records according to the total duration of the test interval.
7.0.0.219
Beta
21-Jan-2007
 
  • Added User Volatility field to the binary database which allows a user to set a volatility parameter from a Metastock data array. This volatility variable is used in two new position size models in Tradesim.
  • Added the ability to assign a value from a table file which consists of a list of symbol value pairs. To do this just insert the full filename of the table file where the symbol name is expect in the AssignValue function but prefix it with the @ character. For example ExtFml( "TradeSim.AssignValue",MarginReq,"@C:\TradeSimData\Table Files\CFD Margin Table ASX.txt",0);
  • On our Version of Metastock 7.0.2 using the exploration with "Minimum records" in the exploration options can cause some unusual side effects so it is not recommended. Use the appropriate number of records according to the total duration of the test interval.
6.1.7.216
Beta
22-Oct-2006
  • Change the precedence of the TimeStop so that it is lower than the protective and profit stop.
  • Fixed problem when using SetVariableProfitStop along with SetExitPriceToProfitStop would always force a profit stop to exit on the Opening price. This should only happen when the target stop lies below the low of the day (LONG trades) and above the high of the day (SHORT trades).
 
6.1.6.215
Beta
13-Sep-2006
  • The DelayAllExitsByOneBar now works with the Protective Stop when the stop is breached in the normal way. Previously if EnableProtectiveStop was only called with DelayAllExitsByOneBar and the stop was breached the trade would exit on the current bar and not the following bar.
 
6.1.5.213
Beta
5-Sep-2006

 

  • Fixed problem when using ShowRejectedTradeDetails to show details of rejected trades which wasn't being displayed properly in the Report Log.
  • Added SetVariableTradeRank function which allows variable rank to be assigned for each trade from a Metastock formula. Previously you could only assign a fixed value of rank for a given symbol.
  • Added SetVariableProfitStop function which allows variable profit stop threshold to be used from from a Metastock formula instead of the the fixed value that was used with the SetProfitStop function.
  • Fixed problem where percentage profit re-entry would not be assigned correctly for PercentProfitAndTrigger and PercentProfitOrTrigger.
6.1.3.199
Beta
20-Jun-2006
  • Fixed problem when using closing price as the stop threshold (UseClosingPriceAsStopThreshold) which would not exit on the next bar when the stop was breached with the closing price.
  • Added DisableClosingStopDelay function to enable the breach of stop using the closing price (UseClosingPriceAsStopThreshold) to exit on the same bar instead of the following bar.
6.1.2.191
Beta
10-May-2006
 
  • Added DisablePriceFilter function since price filter is now enabled by default after call to Initialize it can be switched of with this function to emulate plugin before build 181.
6.1.1.191
Beta
TBA
  • In some cases of non standard user directory structure the plugin could not find TradeSim. This has now been corrected using the registry.
  • The TradeSim data directory is also now located using the registry.
 
6.1.1.189
Beta
20-Apr-2006
  • Eliminated the dependence on the Borland VCL. This may have been causing some problems with some Metastock installations.
  • Sent DLL Process Detach message to TradeSim to notify of its termination. This allows TradeSim to determine if the DLL is still in use.
 
6.0.1.181
Beta
2-Apr-2006
  • The price filter is now always enabled by default unless AllowInvalidPrice data has been called which will negate the price filter. If there are price discrepancies these will flagged as warnings. This corrects an inherent problem when using pyramid trades along with entry delay and the re-entry criteria is by profit which falls outside the daily range of the proceeding bar.
 
6.0.0.180
Beta
7-Mar-2006
  • Moved the Report Log and Signal Chart windowed components to the main TradeSim application.
  • Added pyramid group information to each trade.
  • Added function to allow rejected trade information to be displayed in the Report Log.
5.3.1.165
Beta
TBA
 
  • Added AllowInvalidPriceData function to allow outside daily range prices to be included in the trade database. Normally any data which lies outside the daily range is excluded from the trade database unless the price filter has been enabled. When AllowInvalidPriceData has been called the check is still made and reported but any outside daily range data is now written to the trade database. It should be noted that doing this may cause unexpected results. To allow TradeSim to accept invalid price data you have to enable the reciprocal option in the global preferences in TradeSim otherwise invalid price data will be rejected.
  • Added Periodicity information to each trade in the trade database.
5.3.0.155
Beta
TBA
  • The ErrorLog.txt file is no longer generated and has been replaced by an itegrated Report Log.
  • Enabling the price filter will now produce a warning in the Report Log if there are any price violations, describing the price violation and the action taken.
  • To avoid confusion the time stop now exits on the actual Nth bar/day rather than one bar/day after.
  • Some users were experiencing problems when running multiple system trade database exploration. Previously if an unrecoverable error occurred in a call to the RecordTrades function this would stop Metastock running any proceeding code including further calls to additional RecordTrades functions. If there were price errors or anything that would cause the RecordTrades function to report an error back to Metastock, this would hault any further Metastock formula language processing until a new security was read in. The new reporting system overcomes most of these issues by correctly identifying any errors that may cease the processing of any proceeding formula. However unrecoverable file errors will still cause Metastock to stop any further processing. The user will be alerted to this via the new Report Log.
  • Added EnableUserExitEncoding function which enables encoding of a maximum of 16 User Exit Types.
  • Added UseSymbolName function which is used to replace the Symbol name with the Security name.
  • A brand new Integrated Report Log has been added which also has context sensitive help.
  • Added day specification to the time stop to the SetTimeStop function. Specifying days can be done by using negative time value.i.e, -10 specifies a time stop of 10 days where as a +10 specifies a time stop of 10 bars. Also to avoid confusion the time stop now exits on the actual Nth bar/day rather than one bar/day after.
  • Added new enhanced Report Log Window which replaces the ErrorLog.txt file.
  • Added Debug Chart Window aid which displays signals and trades for one security overlaid on its respective price/volume chart, whilst a trade datbase exploration is run. Example ExtFml("TradeSim.ShowChart","ANZ");
  • Added function NormalExitIfProfit which exits on a valid exit trigger only if there is a profit condition with respect to the entry price.
5.2.3
Final
7-Jan-2005
  • The EnableDelayOfEntryByOneBar no longer applies to pyramid trades ie trades where level>0.
  • The Re-entry type was not correctly flagged for the corresponding pyramid trade.This has now been corrected.
 
5.2.2
Final
15-Dec-2004
  • Previously the SetProfitStop function would not have any effect on exiting a Pyramid Trade with level > 0. This has now been corrected to work properly.
 
5.2.1
Final
21-Nov-2004
  • Changed the way that the EnableDelayOfAllExitsByOneBar is handled. There are situations when the one-bar delay is forced on or off irrespective whether or not the delay has been activated or not. (See the TradeSim User Manual for more information).

    These are (in order of precedence):-

    1. When EnableProtectiveStop and UseClosingPriceAsThreshold have been called and a protective stop has been breeched then the trade will exit on the next bar at the opening price.
    2. When EnableProtectiveStop and SetExitPriceToInitialStop have been called and a protective stop has been breeched then the trade will exit on the current bar at the InitialStop price.
    3. When SetProfitStop and SetExitPriceToProfitStop have been called and the profit threshold has been exceeded then the trade will exit on the current bar at the profit threshold price.
  • When SetExitPriceToProfitStop is called the high and low of the daily range is used to make a comparison with profit threshold for long and short trades respectively. The trade is exited at the profit threshold price if the threshold is met or exceeded. (See the TradeSim User Manual for more information).
  • Added SetPyramidProfitThresholdDetection function. This function is used to determine the way that the profit threshold detection is measured when any profit threshold trigger type is used to re-enter a pyramid trade.
5.2.0
Final
16-Nov-2004
  • Exit Price violations are now reported in the Error Log file with the Exit Date and not the Entry Date as was done previously.
  • When SetExitPriceToInitialStop was used with EnableDelayOfAllExitsByOneBar in some circumstances the ExitPrice (from the previous bar) would lie outside the daily range (on the delayed bar) so that the trade was rejected.
  • Fixed problem which would cause bogus trades to be generated when EnableDelayOfAllExitsByOneBar. For example if a delayed profit stop was followed by an entry trigger the trade would exit on the same day irrespective of whether or not the profit threshold was met.
 
5.1.0
Final
14-Oct-2004
 
  • Added four more trigger types to the "EnableTradePyramidding" function. See document AN-3 for more details.

  • Added Pyramid Re-entry Status to the trade database.

5.0.5
Final
11-Oct-2004
  • Added "AppendTrades" function which appends trades to an existing trade database.

 
5.0.4
Final
29-Sep-2004
 
  • Added "InitializeValues" function which initializes the extended values to a default set of values.

5.0.3
Final
1-Sep-2004
  • Fixed problem where Protective Stops along with pyramid trades would produce duplicate trades.
 
5.0.2
Final
31-Aug-2004
  • When pyramid trades are enabled and protective stops are enabled if a stop is breached then the trade pyramid is automatically closed. Previously when pyramids were enabled and stops were breached the stop would be ignored and the pyramid would continue until a valid exit trigger was detected.
  • Changed the way protective stops are handled. When enabling UseClosePriceAsThreshold and the closing price breaches stop the trade will exit at the opening of the following bar. See the User Manual for a detailed explanation as to how the protective stop works.
 
5.0.1
Final
14-Aug-2004
  • 'Trade ID' has been redesignated as as 'System ID' and the TradeID attribute has been replaced by SystemID in the SetValue function.
  • The SetValue function did not work and has now been corrected.
 
5.0.0
Final
5-Aug-2004
  • Added Point Value field to trade database.
  • Added Initial Margin field to trade database.
  • Added Max Loss field to trade database.
  • Added Transaction Cost field to trade database.
  • Added Trade Rank field to trade database.
  • Added Trade ID field to trade database.
  • Added Trade Low field to trade database.
  • Added Trade High field to trade database.
  • Added Margin Requirement field to the trade database.
  • Added external function ExtFml( "TradeSim.SetValue",ATTRIBUTE,VALUE);
    • ATTRIBUTE={ PointValue, InitialMargin, MaxLoss, TransactionCost, TradeID, MarginReq, TradeRank }
  • Added external function ExtFml( "TradeSim.AssignValue",ATTRIBUTE,SYMBOL,VALUE);
    • ATTRIBUTE={ PointValue, InitialMargin, MaxLoss, TransactionCost, TradeID, MarginReq }
4.2.2
Final
23-Feb-2004
  • Added inactivity delay to the ProfitStop function to delay the time when a profit comparison is made. By default this is set to zero which means that a profit comparison is made on the entry bar. To set a profitstop inactivity delay use the following calling convention ExtFml( "TradeSim.SetProfitStopInactivityDelay",DELAY). If you don't wish to make a profit comparison on the entry bar then DELAY should be made greater or equal to one.
  • Added SetExitPriceToProfitStop function which when used with ProfitStops forces all profit stops to exit at the profit threshold rather than the price specified by the ExitPrice parameter in the RecordTrades function. This is useful for intraday exits. ExtFml( "TradeSim.SetExitPriceToProfitStop").
4.2.1
Final
6-Feb-2004
  • Using EnableProtectiveStop or SetProfitStop with EnableTradePyramiding were causing pyramid trades to be incorrectly generated. When EnableTradePyramiding is called the EnableProtectiveStop and SetProfitStop do not have any effect on the exit strategy. If you need a protective stop with your pyramid trading strategy then you should use a trailing stop as your exit trigger.
  • The SetStopGapPriceToOpen function no longer has any effect. If Protective Stops are enabled and the InitialSop is breached then stops are handled according to the following pseudo code (long side example)

If UseClosePriceAsThreshold then

ExitPrice=Close

else

if Open < InitialStop then

ExitPrice = Open

else

if ExitAtStop then

ExitPrice = InitialStop

else

ExitPrice = UserExitPrice

4.2.0
Final
17-Dec-2003
  • Added function to disable OpenTrades when the trade database is generated. You disable open trades by calling ExtFml( "TradeSim.DisableOpenTrades").
4.1.0
Final
24-Oct-2003
  • Added an optional price conditioning filter to the RecordTrades function to force entry and exit prices to be constrained within the daily range of the entry and exit points respectively. You enabled it by calling ExtFml( "TradeSim.EnablePriceFilter").
  • Multiple calls to the RecordTrades function using the CONTINUE control word no longer requires the filename to be respecified each time a call to the RecordTrades function is made.
4.0.0
Final
6-Apr-2003
  • Previously when Protective stops were enabled and and exit trigger coincided with a stopped out condition the trade would be flagged as a 'Normal' exit when it was recorded to the trade database. In version 4.0.0 this condition now flags the trade as 'Stopped Out' when the trade is recorded to the trade database.
  • Previously when the protective stops were enabled and SetExitPriceToInitialStop was used to set the exit price to the initial stop price an exit trigger which coincided with a breech of the InitialStop the trade would be recorded to the trade database at the price determined by the ExitPrice (and not the InitialStop) array and flagged as normal exit status even though the InitialStop was breeched and the trade should have been flagged as "Stopped Out". This operation has now been corrected so that the trade is now flagged as 'Stopped Out' and recorded to the trade database at a price determined by the InitialStop price array.
  • Added function SetStopGapPriceToOpen function which used in conjunction with the EnableProtectiveStop and SetExitPriceToInitialStop functions to exit the trade at the opening price if the price gaps away from the InitialStop.
  • Added function EnableTradePyramiding to allow the generation of trade pyramids.
  • Added function SetProfitStop to generate profit stops in the RecordTrades function.
  • Added function SetReturnInfoType to change the information returned from the RecordTrades function.
  • Added function SuppressFileProcessing to supress file processing in the RecordTrades function. This facilitates debugging or creating experts and indicators without generating a trade database file.
  • Added function SetVolumeInfoType to control the way the traded volume information is calculated.
  • Added function SetVolumeMultiplier to scale volume information. This allows all volume values to be multiplied by a constant amount before they are written to the trade database .
3.3.0
Final
30-Oct-2002
  • The security symbol length has been increased from 7 characters to the maximum of 14 characters allowable according to the Metastock specification. This was done to avoid truncating long symbols.
  • Added a currency multiplier function SetCurrencyMultipler to the TradeSim function libarry. This allows all currency values to be multiplied by a constant amount before they are written to the trade database.
  • Previously if a stop was breeched due to the price bar gapping below or above the Initial Stop for long and short trades respectively then the trade would automatically be rejected since the Initial Stop price could never be reached on the day of exit. This operation has been modified so that when a stop has been breeched the trade exits at the highest and lowest price of the day for long and short trades respectively.
3.2.0
Final
14-Sep-2002
  • Fixed problem where open trades would not be written to the trade database when EnableDelayOfAllExitsByOneBar function was called before the RecordTrades function.
  • Added SetExitPriceToInitialStop function to the library which forces the trade to at the InitialStop price when the stop is breached and the protective stops are enabled.
  • Added extra Threshold parameter to the Fast Trailing Stop function to control the point at which the stop is triggered and the trailing stop band is reset.
3.1.0
Final
16-Jul-2002
  • Fixed problem causing duplicate trades to be added to the trade database. Duplicate trades are trades which have the same symbol name and entry date.
  • In previous versions of the plugin, invalid security data would force a fatal error and the RecordTrades function would terminate so any subsequent trades in the particular security would be ignored and not written to the trade database. In version 3.1.0 of the external plugin, invalid security data errors now cause recoverable errors whereby the RecordTrades function is forced to skip any invalid data.
  • If you enabled protective stops in V3.0.0 you would always be stopped out on the short side after the inactivity delay even if the high did not breach the stop.
3.0.0
Final
19-Jun-2002
  • Each trade entry in the trade database now includes trade volume. The trade volume is the minimum of the trade volume at the time of the entry and exit triggers. TradeSim can now use this information to determine whether or not there was enough traded volume for the trade to be taken.
  • Added extra error checking and reporting to the Error Log file.
  • Considerably extended and enhanced the error checking and reporting capability of the RecordTrades function thus allowing the user to quickly pinpoint and correct problems with the trade data.
  • The ErrorLog.txt file is now rewritten every time a new trade database is generated. The ErrorLog.txt file now includes enhanced and detailed error reporting.
  • Added a function library which includes many additonal functions to control the behaviour of the RecordTrades function.
  • To enable the protective money management stop you now call a function rather than negate the InitialStop parameter as was done previously. Negative InitialStop values will now flag an error condition which will be reported back to Metastock and to the Error Log file.
  • Added an additional filter used for generating Metastock security lists containing securities with a certain number of characters in the symbol name.
  • Added extra error checking to the "FilterSecurity" function.
2.0.2
Final
4-Feb-2002
  • The RecordTrades function now closes and records open trades to the trade database. TradeSim can now include open trades in a simulation (see documentation for more information)..
  • Added documentation to the User Manual for using the Fast Trailing Stop external function.
2.0.1
Final
6-Jan-2002
  • Fixed problem which caused the RecordTrades external function to generate an "Invalid Initial Stop Data" exception error when the Initial Stop parameter was set to 0 and the Trade Position parameter was set to SHORT.
2.0.0
Final
14-Nov-2002
  • Added exception handling for invalid trade data when using the RecordTrades external function. An Invalid Data exception will be thrown under the following conditions.
      1. If any of the price data EntryPrice or ExitPrice is zero or negative an internal exception is thrown and an error is returned to the calling function in Metastock.
      2. If the InitialStop parameter is used (ie not zero) then an exception will be thrown if the EntryPrice is less than or equal to the InitialStop for long trades or the InitialStop is greater than or equal to the EntryPrice at the point of trade entry ie when the EntryTrigger parameter is equal to 1.

 

TradeSim® is a registered trademark of Compuvision Australia Pty Ltd. Metastock® is a registered trademark of Equis International. Windows® is a registered trademark of Microsoft Corporation.

Copyright © 2000-2009 by Compuvision Australia P/L

ABN 86 006 574 090

Web http:\\www.compuvision.com.au

Email enquiries@compuvision.com.au

Last Modified February 19, 2002