public void ReportPositionClosed(Messaging.Protobuf.Position position) { PositionsClosedCount++; PipsTotal += position.Pips; ProfitTotal += position.GrossProfit; StateManager.SetInitialStateAsync(new Dictionary <string, object> { { RuleConfiguration.PIPSTOTAL, PipsTotal }, { RuleConfiguration.PROFITTOTAL, ProfitTotal }, { RuleConfiguration.POSITIONCLOSEDCOUNT, ProfitTotal } } ); StrategyExecutionReport.Add(position.CloseTime + "," + position.Label + "," + "*" + "," + "OnPositionClosed"); //Add the Rules to the TradeResult report to see which rules executed prior to a position closing TradeExecutionReport.Add(position.Label + "," + position.SymbolCode + "," + position.EntryTime + "," + position.CloseTime + "," + position.EntryPrice + "," + position.ClosePrice + "," + position.Pips + "," + position.StopLossPrice + "," + position.TakeProfitPrice + "," + position.GrossProfit); }
public static bool ParseOpenPosition(cAlgo.API.Position p, out Messaging.Protobuf.Position position, Messaging.Protobuf.Position.Types.StateChange stateChange = Messaging.Protobuf.Position.Types.StateChange.None) { try { position = new Messaging.Protobuf.Position() { Id = p.Id, Label = p.Label, Pips = p.Pips, EntryTime = p.EntryTime.ToBinary(), SymbolCode = p.SymbolCode, StopLossPrice = (double)p.StopLoss, TakeProfitPrice = (double)p.TakeProfit, Volume = p.Volume, TradeType = ParsePositionTradeType(p.TradeType), GrossProfit = p.GrossProfit, StateChange = stateChange }; } catch (Exception e) { Console.WriteLine("FAILED to parse Position: " + e.ToString()); position = null; return(false); } return(true); }
public void ReportPositionOpened(Messaging.Protobuf.Position position) { PositionsOpenedCount++; StateManager.SetInitialStateAsync(new Dictionary <string, object> { { RuleConfiguration.POSITIONSOPENEDCOUNT, PipsTotal } } ); StrategyExecutionReport.Add(position.EntryTime + "," + position.Label + "," + "*" + "," + "OnPositionOpened"); }
public void ReportPositionClosed(Messaging.Protobuf.Position position) { PipsTotal += position.Pips; ProfitTotal += position.GrossProfit; StrategyExecutionReport.Add(position.CloseTime + "," + position.Label + "," + "*" + "," + "OnPositionClosed"); //Add the Rules to the TradeResult report to see which rules executed prior to a position closing TradeExecutionReport.Add(position.Label + "," + position.SymbolCode + "," + position.EntryTime + "," + position.CloseTime + "," + position.EntryPrice + "," + position.ClosePrice + "," + position.Pips + "," + position.StopLossPrice + "," + position.TakeProfitPrice + "," + position.GrossProfit); }
public void ReportPositionModified(Messaging.Protobuf.Position position, string timestamp) { StrategyExecutionReport.Add(timestamp + "," + position.Label + "," + "*" + "," + "OnPositionModified"); }
public void ReportPositionOpened(Messaging.Protobuf.Position position) { PositionsOpenedCount++; StrategyExecutionReport.Add(position.EntryTime + "," + position.Label + "," + "*" + "," + "OnPositionOpened"); }
public static bool ParseClosedPosition(cAlgo.API.Position _position, double closePrice, DateTime closeTime, out Messaging.Protobuf.Position position) { if (ParseOpenPosition(_position, out position, Messaging.Protobuf.Position.Types.StateChange.Closed)) { position.ClosePrice = closePrice; position.CloseTime = closeTime.ToBinary(); return(true); } return(false); }