Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetAutoTrail()

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

    SetAutoTrail()

    How about support for the AutoTrail ATM function inside a strategy?

    SetAutoTrail(CalculationMode.Ticks, 12,6,6);

    The above would be a great addition to the Strategy development commands.

    Currently I'm writing a few lines of code to support :

    1. Waiting for 6 ticks in profit
    2. Setting StopLoss back 12 ticks
    3. Adjusting every 6 ticks in profit.

    It would be nice to replace that code with the above command.

    Any chance of adding this suggestion to the development work schedule?

    #2
    Hello rcsingleton,
    Thanks for your note.

    You can do it by simply reassigning the SetStopLoss method again and further custom code your strategy. A sample code will be like:

    Code:
    //in variable
    int profitTicks = 6;
    
    //in OnBarUpdate
    if (Position.MarketPosition == MarketPosition.Long && Close[0] >  Position.AvgPrice + profitTicks * TickSize)
    {
    	profitTicks += 6;
    	SetStopLoss(CalculationMode.Price , Close[0] - 12 * TickSize); 
    }
    JoydeepNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    649 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    370 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    109 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    574 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    576 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X