Serializing Position
Author: mikhmv
Creation Date: 7/16/2008 8:22 PM
profile picture

mikhmv

#1
Hi,
Does it possible to serialize Position?
profile picture

Cone

#2
Probably. What do you mean by serializing a Position? Provide a concrete example.
profile picture

mikhmv

#3
Sorry Robert,
I would like to have possibility save Position (object) in file like binary after backtesting. It can make possible to analise trades later and faster by loading them from file, deserializing and using Positions.Add(Deserialized Position). Of course exist possibility to save separately EntryDate, ExitDate, PriceEntry, PriceExit and later place on this dates limit order. But I hope that exist another way to do it.
I tried [Serialize] and implement :ISerializable interface but received error that object Position not serializable. I tried used unsafe methods Marshal but received error when used SizeOf (Size can not be determined).

Thank you advance.
profile picture

Eugene

#4
WealthLab.Position is not marked as serializable, at least what it says in runtime...
profile picture

mikhmv

#5
Hi Eugene,
Yes I received this message and ask you (Welthlab developing team): Does exist other ways to save positions or send them between computers?
Does exist possibility to make inherent serilizable class for saving?
Probably not all field need to serialize or copy. You have available (public) constractor in Position. I Can create new position (Position pos = new Position(Bars, PositionType)) but for other properties only readable (only get). It will be great to have possibility to set this parameters from strategy without functions BuyAtLimit and other....

I performing testing on a lot of symbols (by cycling dataset) and in result can see trades from all symbols in the list. Idea is to save this trades and load without symbol cycling.

thanks
profile picture

Cone

#6
This would be a good question (actually request) for "Ask Glitch". It's a pretty common request to use Wealth-Lab for trade processing, so maybe Glitch can make it easier to do with .NET methods in Version 5.
profile picture

mikhmv

#7
Thanks a lot.
I will make this request.