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 llanqui, Today, 03:53 AM
    0 responses
    6 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Started by burtoninlondon, Today, 12:38 AM
    0 responses
    10 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    15 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Yesterday, 07:51 PM
    0 responses
    14 views
    0 likes
    Last Post strategist007  
    Working...
    X