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 GussJ, 03-04-2020, 03:11 PM
    15 responses
    3,268 views
    0 likes
    Last Post xiinteractive  
    Started by Tim-c, Today, 02:10 PM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by Taddypole, Today, 02:47 PM
    0 responses
    2 views
    0 likes
    Last Post Taddypole  
    Started by chbruno, 04-24-2024, 04:10 PM
    4 responses
    50 views
    0 likes
    Last Post chbruno
    by chbruno
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    10 responses
    401 views
    1 like
    Last Post beobast
    by beobast
     
    Working...
    X