Esempio n. 1
0
 void addTrade(Position position, Trade trade)
 {
     if (position.isEntry(trade))
     {
         positions.Add(position);
         positionsInfo.add(position);
         Action <Bar> onNewBar = bar => positionsInfo.get(position).add(simulator.pnlForPosition(position, 0.0));
         simulator.addNewBarListener(position.symbol, onNewBar);
         position.onPositionClosed += () => {
             simulator.removeNewBarListener(position.symbol, onNewBar);
             positionsInfo.get(position).add(position.pnl(true, simulator.runInNativeCurrency()));
         };
     }
     trades.Add(trade);
 }