One of the first tasks any new MTS user will want to accomplish is to add the DLL function definitions to their existing applications. This can be accomplished simply by following the example esignal EFS script below.
In this example, we've provided the "doMTSInit()" function which defines all the MTS DLL functions. Simply call this function from within your "preMain()" and you can start using the MTS functions within your code.
//------------------------------- Example eSignal Code ----------------------------------------------------
//----[ Define the new MTS dll ]-----------------------------------------------------------------------------
var mentts = new DLL("mentts.dll");
//----------------------------------------------------------------------------------------------------------------------
function preMain() {
setStudyTitle("My New Trading System V1.0");
// Define the MTS DLL function calls
doMTSInit();
}
function doMTSInit()
{
mentts.addFunction("PlaceOrder",DLL.INT,DLL.STDCALL,"placeorder",DLL.STRING,DLL.STRING,DLL.STRING,DLL.STRING,DLL.INT,DLL.DOUBLE,DLL.STRING,DLL.STRING,DLL.STRING,DLL.STRING,DLL.DOUBLE,DLL.STRING);
mentts.addFunction("IBPlaceOrder",DLL.INT,DLL.STDCALL,"ibplaceorder",DLL.STRING,DLL.STRING,DLL.STRING,DLL.INT,DLL.DOUBLE,DLL.STRING,DLL.STRING,DLL.STRING,DLL.STRING,DLL.DOUBLE,DLL.DOUBLE,DLL.INT,DLL.STRING,DLL.STRING,DLL.STRING,DLL.STRING,DLL.STRING,DLL.STRING,DLL.STRING);
mentts.addFunction("PlaceOrderAssoc",DLL.INT,DLL.STDCALL,"placeorderassoc",DLL.STRING,DLL.STRING,DLL.STRING,DLL.DOUBLE);
mentts.addFunction("ModifyOrderAssoc",DLL.INT,DLL.STDCALL,"modifyorderassoc",DLL.STRING,DLL.INT,DLL.STRING,DLL.DOUBLE);
mentts.addFunction("Cancel",DLL.INT,DLL.STDCALL,"cancel",DLL.STRING,DLL.INT);
mentts.addFunction("GetOrderStatus",DLL.STRING,DLL.STDCALL,"getorderstatus",DLL.STRING,DLL.INT);
mentts.addFunction("GetFillAmount",DLL.INT,DLL.STDCALL,"getfillamount",DLL.STRING,DLL.INT);
mentts.addFunction("GetFillPrice",DLL.DOUBLE,DLL.STDCALL,"getfillprice",DLL.STRING,DLL.INT);
mentts.addFunction("GetCurrentPosition",DLL.INT,DLL.STDCALL,"getcurrentposition",DLL.STRING,DLL.STRING,DLL.STRING,DLL.STRING,DLL.STRING);
mentts.addFunction("GetAccountInfo",DLL.STRING,DLL.STDCALL,"getaccountinfo",DLL.STRING,DLL.STRING);
mentts.addFunction("GetBrokerStatus",DLL.INT,DLL.STDCALL,"getbrokerstatus",DLL.STRING);
}
//----------------------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------
// TradeStation Definition Example..
// DLL Definitions for TradeStation
8.xx
external : "mentts.dll",
int, "placeorder", string, string, string, string, int, double, string,
string, string, string, double, string ;
external : "mentts.dll",
int, "ibplaceorder", string, string, string, int, double, string,
string, string, string, double, double, int, string, string, string, string,
string, string, string ;
external : "mentts.dll", int, "placeorderassoc", string,
string, string, double ;
external : "mentts.dll", int, "modifyorderassoc", string,
string, doublet ;
external : "mentts.dll", int, "cancel", string, int ;
external : "mentts.dll", string, "getorderstatus", string,
int ;
external : "mentts.dll", int, "getfillamount", string, int
;
external : "mentts.dll", double, "getfillprice", string,
int ;
external : "mentts.dll", int, "getbrokerstatus", string
;
external : "mentts.dll", int, "getcurrentposition", string,
string, string, string, string ;
external : "mentts.dll", int, "getaccountinfo", string, string ;
//----------------------------------------------------------------------------------------------------------------------