Version 5, last updated by pracplay-support2 at November 10, 2011 14:49 UTC
BridgeExampleEsignal
These examples are provided as a help but are not comprehensive examples, nor are they guaranteed to work on every machine.
If you have problems, you should still consult the BridgeGettingStarted, BridgeReference and BridgeTroubleshooting guides.
ESIGNAL
var bridgedll = null;
var OrderID = 0;
var tst_position_size = 0;
var tst_position_entry = 0;
var Initial_Position = 0;
var aFPArray = new Array();
function preMain()
{
var x;
Load_bridgedll();
x = 0;
aFPArray[x] = new FunctionParameter( "EntryType", FunctionParameter.STRING);
with( aFPArray[x] )
{
addOption( "Enter_NLST_L_100sh" );
addOption( "Exit_NLST_L_100sh" );
addOption( "DoNothing" );
setDefault( "DoNothing" );
}
askForInput();
}
function main(EntryType)
{
if ((getBarState() == BARSTATE_NEWBAR)&&(isLastBarOnChart() == true))
{
if (EntryType == "Enter_NLST_L_100sh")
{
tst_position_size = getCurrentPos();
if (tst_position_size == 0)
{
tst_position_entry =
bridgedll.call("TSL_SENDORDER","NLST",1,100,0,0,0,"DEMO195","ARCA");
}
}
if (EntryType == "Exit_NLST_L_100sh")
{
tst_position_size = getCurrentPos();
if (tst_position_size > 0)
{
tst_position_entry =
bridgedll.call("TSL_SENDORDER","NLST",0,100,0,0,0,"DEMO195","ARCA");
}
}
if (EntryType == "DoNothing")
{
}
}
}
function Load_bridgedll() {
if (bridgedll == null) {
bridgedll = new DLL("C:/Program
Files/Bridge/BridgeHelper.dll");
bridgedll.addFunction("TSL_POSSIZE", DLL.INT,
DLL.STDCALL, "TSL_POSSIZE", DLL.STRING);
bridgedll.addFunction("TSL_NEXTORDERID", DLL.INT,
DLL.STDCALL, "TSL_NEXTORDERID");
bridgedll.addFunction("TSL_SENDORDER",
DLL.INT,
DLL.STDCALL,
"TSL_SENDORDER",
DLL.STRING,
DLL.INT,
DLL.INT,
DLL.DOUBLE,
DLL.DOUBLE,
DLL.INT,
DLL.STRING,
DLL.STRING);
}
}
function getCurrentPos()
{
return bridgedll.call("TSL_POSSIZE","NLST") - Initial_Position;
}