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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    47 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    22 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    15 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    21 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    23 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X