Both will work. My ay makes sure that the PT or stop loss was filled. Your way does not.
if (atmStrategyId.Length > 0)
{
// You can change the stop price
if (GetAtmStrategyMarketPosition(atmStrategyId) == MarketPosition.Flat)
{
// My Position is flat either my stop loss or PT got hit so I need to now close out my strategy position.
ExitShort(10000, "Ex_SH2", "Short2");
}
NOTE to make sure we are on same page here:
- You cannot combine ATM Strategies and NS Strategy order calls. ExitShot will not close the ATMStrategy. It will only close the NS strategy which remember they are not the same.
- What you are doing here is trying to combine NS strategy with a ATM Strategy. Both will run on the same account and will double your position up. Since the NS strategy is submitting orders and the ATM Strategy is submitting orders.
-If you want to clsoe an ATM Strategy you need to use this instead.
Comment