Profile Picture

How to close the Long positions for just the current symbol

Posted By Samjd7777 6 Months Ago

How to close the Long positions for just the current symbol

Message
Posted Tuesday May 09 2017
Does this close all my positions or just for the current symbol?

public override void NewBar()
{
     foreach (Position p in OpenPositions)
     {
         if (p.Type == PositionType.Long)
        {
                p.CloseAtMarket();
        }
    }
}

I only want to close the Long positions for the current symbol…
Do you have a code example?
Thanks,
Sam



Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems