Thank you for your patience.
The two Synchronize executions are to sync the account position to the strategy position, the close Position executions close the current position of the strategy, the Sell Short and Buy are entries for their respective sides.
If you need to determine which execution belongs to which strategy you can use the Signal Names of the order functions to set a string for the orders. Then you could assign a variable to the string as well for the instance of the strategy.
For example:
protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Enter the description for your new custom Strategy here."; Name = "ExampleInstanceEntrySignalNameString"; Calculate = Calculate.OnEachTick; Instance = 1; } } protected override void OnBarUpdate() { if (State == State.Historical) return; EnterLong("entry " + Instance.ToString()); } [Range(1, int.MaxValue), NinjaScriptProperty] [Display(ResourceType = typeof(Custom.Resource), Name = "Instance", GroupName = "NinjaScriptParameters", Order = 0)] public int Instance { get; set; }
Leave a comment: