{******************************************************************* Name: TS.Link.LOGTRADE Analysis Type: System Description : Example System for TS Link DLL Used: tslink.dll Provided By : Trade Smart Research (c) Copyright 2001 - 2005 www.tsresearchgroup.com ********************************************************************} Inputs: SetSheet(1), SetBeginRow(2), SetColum(2), ExcelFileName("TSLinkExample.xls"), ExcelFilePath("C:\Program Files\TradeSmart\TS Link\TSLinkExample.xls"); Var: StartValue(0), BeginRow(0), SetValue(0),StrName(""),Num(100), Flag1(0), Flag2(0); {Declaration functions} defineDLLFunc: "tslink.dll", int, "TS_StartExcel",LPSTR,LPSTR; {initalisation excel file 1 - Short BookName, 2 - full path bookname} defineDLLFunc: "tslink.dll", int, "TS_SetValue",float,int,int,int,int; {value,sheet number, row, column, spleep milisekonds} defineDLLFunc: "tslink.dll", int, "TS_SetString",lpstr,int,int,int,int; {text,sheet number, row, column, spleep milisekonds} if currentbar = 1 then begin StartValue = TS_StartExcel(ExcelFileName,ExcelFilePath); BeginRow = SetBeginRow; end; {Call Dll and send to it of the value } If MarketPosition =1 And Flag1 = 1 Then Begin StrName = "Buy"; TS_SetString(StrName,SetSheet,BeginRow,SetColum+1,10); SetValue = TS_SetValue(EntryDate(0),SetSheet,BeginRow,SetColum+2,10); SetValue = TS_SetValue(EntryTime(0),SetSheet,BeginRow,SetColum+3,10); StrName = "Long Entry"; TS_SetString(StrName,SetSheet,BeginRow,SetColum+4,10); SetValue = TS_SetValue(EntryPrice(0),SetSheet,BeginRow,SetColum+5,10); SetValue = TS_SetValue(CurrentShares,SetSheet,BeginRow,SetColum+6,10); SetValue = TS_SetValue(NetProfit,SetSheet,BeginRow,SetColum+7,10); BeginRow = BeginRow +1; Flag1 = 0; End; If MarketPosition = 0 and Close > Open Then Begin Buy Num Shares This Bar on Close; Flag1 = 1; End; If MarketPosition =0 And Flag2 = 1 Then Begin SetValue = TS_SetValue(TotalTrades,SetSheet,BeginRow,SetColum,10); StrName = "Sell"; TS_SetString(StrName,SetSheet,BeginRow,SetColum+1,10); SetValue = TS_SetValue(ExitDate(1),SetSheet,BeginRow,SetColum+2,10); SetValue = TS_SetValue(ExitTime(1),SetSheet,BeginRow,SetColum+3,10); StrName = "Exit Long"; TS_SetString(StrName,SetSheet,BeginRow,SetColum+4,10); SetValue = TS_SetValue(ExitPrice(1),SetSheet,BeginRow,SetColum+5,10); SetValue = TS_SetValue(PositionProfit(1),SetSheet,BeginRow,SetColum+6,10); SetValue = TS_SetValue(NetProfit,SetSheet,BeginRow,SetColum+7,10); BeginRow = BeginRow +1; Flag2 = 0; End; If MarketPosition = 1 and Close < Open Then Begin Sell Num Shares This Bar on Close; Flag2 = 1; End; {***** Copyright (c) 2001-2005 Trade Smart Research, Ltd. All rights reserved. www.tsresearchgroup.com ***** ***** Trade Smart Research reserves the right to modify or overwrite this analysis technique with each release. *****}
|