Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ATM strategy closing position prematurely

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

    ATM strategy closing position prematurely

    Hi guys I have an odd one and would appreciate some help. I am using an ATM strategy and changing the stops and targets. The stop is an ATR stop which works fine.

    The problem is if I take say a long trade and add the second part of the code that changes the target it changes the target to below the price where the ATR stop is located and closes out target1 leaving target 2 still working, Any idea on what I'm doing wrong here? It should reset the target to +70 ticks over the entry price so no idea why it is changing it to where the ATR stop is located. Thanks. DJ


    if (atmStrategyId1.Length > 0 && GetAtmStrategyMarketPosition(atmStrategyId1) != Cbi.MarketPosition.Flat)
    {
    AtmStrategyChangeStopTarget(0, ATR, "STOP1", atmStrategyId1);
    AtmStrategyChangeStopTarget(Position.AvgPrice+70*T ickSize,0, "TARGET1", atmStrategyId1);

    }

    #2
    Hello,

    Can you please provide more of the code? I'd like to see the values you are using for ATMStrategyCreate and where this is to relation in OnBarUpdate to your ATMStrategyChange.

    I'd also suggest adding some Print() statements or DrawLine() for some of the values you are using for the stops and targets to help determine where these are being placed.

    Click here for more information on Debugging NinjaScript Code
    MatthewNinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, Yesterday, 09:41 PM
    1 response
    21 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, Today, 02:41 AM
    0 responses
    8 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, Yesterday, 11:44 PM
    0 responses
    20 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    36 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    34 views
    0 likes
    Last Post CarlTrading  
    Working...
    X