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 argusthome, Yesterday, 10:06 AM
    0 responses
    20 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    18 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    14 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    9 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    40 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X