Profile Picture

Getting a position ID

Posted By treydog999 2 Years Ago
Message
Posted Tuesday October 13 2015
I am trying to get a position ID but am unclear on how to do it. I am trying to use OtherSymbols["BND"].PositionManager.GetPosition.ID  but i get an error.

I am trying to rebalance another symbol in this case BND and reduce it to give capital to another position. However I am unable to use RemoveFromPosition without an ID. this ID may be from another symbol or from the current one. thanks in advance
Posted Sunday October 18 2015
With RightEdge, there can be more than one position open per symbol.  Assuming your system only opens one position per symbol, you can do the following:


IList<Symbol> bndPositions = PositionManager.GetOpenPositions(SystemData.GetSymbolByName("BND"));
if (bndPositions.Count > 0)
{
    Position bndPosition = bndPositions[0];
    string bndId = bndPosition.ID;

    //  Rebalance using bndId
}


Thanks,
Daniel

Edited: Sunday October 18 2015 by dplaisted


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems