Profile Picture

Duplicate fills reported in Paper Broker

Posted By BigBerner 10 Years Ago
Message
Posted Tuesday May 01 2007
If you set PositionManager.SetProfitTarget and PositionManager.SetStopLoss at the same time in the Paper Broker and then one of the orders is hit, you get a duplicate notification in the Closed Positions tab. Here is example code.

Public Overrides Sub OnPositionTrade(ByVal trade As RightEdge.Common.Trade, ByVal pos As RightEdge.Common.Position, ByVal state As RightEdge.Common.Position.State)

MyBase.OnPositionTrade(trade, pos, state)

Dim OnePoint As Double = pos.Symbol.SymbolInformation.TickSize

Dim LongProfitTarget As Double = trade.Price + (3 * OnePoint)

Dim LongStopLevel As Double = trade.Price - (3 * OnePoint)

'Set Profit Target

If pos.PositionType = PositionType.Long And state = Position.State.Open Then

PositionManager.SetProfitTarget(pos.PosID, LongProfitTarget, False)

End If

'Set Stop Loss

If pos.PositionType = PositionType.Long And state = Position.State.Open Then

PositionManager.SetStopLoss(pos.PosID, LongStopLevel, False)

End If

End Sub

Posted Wednesday May 02 2007
Whistling
Posted Wednesday May 02 2007
Added as bug 974.
Posted Thursday May 24 2007
This bug has been fixed.

Thanks,
Daniel



Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems