Event for new position (manual trade)
Created at 09 Feb 2015, 21:02
US
Event for new position (manual trade)
09 Feb 2015, 21:02
Good evening,
I haven't touched C# or the API in a good while, and I am searching around but currently stuck.
I would like an event to fire when I open a trade manually, as opposed to algorithmically.
namespace cAlgo { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class U1PositionManager : Robot { [Parameter(DefaultValue = 0.0)] public double Parameter { get; set; } protected override void OnStart() { Positions.Opened += PositionsOnOpened; } //protected override void OnPositionOpened(Position openedPosition) private void PositionsOnOpened(PositionOpenedEventArgs args) positionShell positionInstance; positionInstance = new positionShell(); Print("this executes when I first manually create a new position"); positionInstance.xxx1 = args.Position.Id; Print("This never executes"); } } class positionShell { public int xxx1 { get { return xxx1; } set { xxx1 = value; } } public int xxx2 { get { return xxx2; } set { xxx2 = value; } } } }
I have been playing about with "OnPositionOpened" and "PositionsOnOpened" and neither seems to be working.
Any help would be appreciated
Thanks
username101
09 Feb 2015, 23:28
This is a problem that I have now sorted, the formatting of the GET and SET in the class was incorrect.
Shame there's no 'delete thread'
@username101