In this thread I present a basic concept how to design a class (DataTransfer) maintaining basic informations transfered from multiple strategy instantiations.
[SIZE=2][SIZE=2][FONT=Courier New][Description([/FONT][/SIZE][/SIZE][FONT=Courier New][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]"Data transfer base class."[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2])][/SIZE][/SIZE][/FONT] [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][FONT=Courier New]public [/FONT][/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][FONT=Courier New][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]class[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] DataTransfer[/SIZE][/FONT] [SIZE=2][FONT=Courier New][FONT=Courier New]{...}[/FONT][/FONT][/SIZE][/SIZE][/FONT]
[SIZE=2][SIZE=2][FONT=Courier New][Description([/FONT][/SIZE][/SIZE][FONT=Courier New][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]"Data transfer application class - Profit/Loss."[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2])][/SIZE][/SIZE][/FONT] [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][FONT=Courier New]public [/FONT][/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][FONT=Courier New][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]class[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] DataTransferPL : DataTransfer[/SIZE][/FONT] [SIZE=2][FONT=Courier New][FONT=Courier New]{...}[/FONT][/FONT][/SIZE][/SIZE][/FONT]
[SIZE=2][SIZE=2][FONT=Courier New][Description([/FONT][/SIZE][/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"Test strategy for the DataTransfer class."[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2][FONT=Courier New])][/FONT][/SIZE][/SIZE][FONT=Courier New][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][/FONT] [FONT=Courier New][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]public [/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]class[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] DataTransferTest : Strategy[/SIZE][/FONT] [SIZE=2][FONT=Courier New][FONT=Courier New]{...}[/FONT][/FONT][/SIZE][/SIZE][/FONT]
[FONT=Courier New]...[/FONT][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000][FONT=Courier New]// Retrieve the total profit/loss until now[/FONT][/COLOR][/SIZE] [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2][FONT=Courier New]doubleValue = dataTransferPL.TotalProfitLoss(Time[[/FONT][/SIZE][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2][FONT=Courier New]]);[/FONT][/SIZE] [SIZE=2][FONT=Courier New]Print([/FONT][/SIZE][/SIZE][FONT=Courier New][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]"# Startegy: "[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2] + strategyName + [/SIZE][/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]" Total PnL until "[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2] + Time[[/SIZE][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2]] + [/SIZE][/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]": "[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2] + doubleValue);[/SIZE][/SIZE][/FONT] [FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]...[/SIZE][/FONT] [/SIZE][/FONT]
[SIZE=2][FONT=Courier New][COLOR=#008000][SIZE=2][FONT=Courier New][COLOR=#008000][SIZE=2][FONT=Courier New][COLOR=#008000][FONT=Courier New]//#define DEBUG[/FONT][/COLOR][/FONT][/SIZE] [FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New]...[/FONT][/COLOR][/SIZE] [SIZE=2][COLOR=#008000][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]public[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2][FONT=Courier New] DataTransfer()[/FONT][/SIZE] [SIZE=2][FONT=Courier New]{[/FONT][/SIZE] [SIZE=2][FONT=Courier New] memberID = memberCount++;[/FONT][/SIZE] [SIZE=2][FONT=Courier New] memberDict.Add(memberID, [/FONT][/SIZE][/SIZE][FONT=Courier New][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2] MemberData([/SIZE][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]string[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2].Empty, DateTime.MinValue));[/SIZE][/SIZE][/FONT] [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][FONT=Courier New]#if[/FONT][/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2][FONT=Courier New][COLOR=#000000] DEBUG[/COLOR][/FONT][/SIZE] [/SIZE][FONT=Courier New][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff] if[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2] (memberInstance != [/SIZE][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]null[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2]) memberInstance.Print([/SIZE][/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]"DataTransfer.DataTransfer memberID: "[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2] + memberID + [/SIZE][/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]" new member count: "[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2] + memberDict.Count);[/SIZE][/SIZE][/FONT] [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][FONT=Courier New]#endif[/FONT][/COLOR][/SIZE] [SIZE=2][COLOR=#0000ff][FONT=Courier New]...[/FONT][/COLOR][/SIZE] [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][FONT=Courier New][SIZE=2]}[/SIZE][/FONT] [/SIZE][/COLOR][/SIZE][/FONT][/COLOR][/FONT][/SIZE][/COLOR][/FONT][/SIZE]
Have fun
Ralph
Comment