Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Determining Market Position

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Determining Market Position

    It seems there are two different ways to determine market position when using NScript launched ATM Strategies:

    protected override void OnBarUpdate()
    {
    // Check if flat
    if (GetAtmStrategyMarketPosition("id") == MarketPosition.Flat)
    Print("ATM Strategy position is currently flat");
    }


    or

    protected override void OnBarUpdate()
    {
    // If not flat print our open PnL
    if (Position.MarketPosition != MarketPosition.Flat)
    Print("Open PnL: " + Position.GetProfitLoss(Close[0], PerformanceUnit.Points));
    }


    I can't seem to get the first approach to work although other "get AtmStrategy...." commands are working.

    Is there a preference for one over the other and are there limitations in using one over the other that need to be taken into account?

    Also, in the if (GetAtmStrategyMarketPosition("id") == MarketPosition.Flat)
    is the "id" element the unique id assigned to the atm strategy or "orderId" from the AtmStategyCreate command or "atmstrategyId" also from the AtmStrategyCreate Command?
    daven

    #2
    If you are working with ATM strategies from within a NinjaScript strategy, then you *must* use GetAtmMarketPosition(). Please see the SampleAtmStrategy that installs with NT for proper use of this method. The sample works.

    "id" is the "amtStrategyId" value passed into the AtmStrategyCreate() method.
    RayNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    111 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    156 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    76 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    125 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    79 views
    0 likes
    Last Post PaulMohn  
    Working...
    X