Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ATR Trail StopLoss again

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

    ATR Trail StopLoss again

    Hi All,

    is a good way to set an ATR Trail Stop Loss this simple way (long side):

    Code:
    protected override void OnBarUpdate()
            {					
    			double distance = ATR(periodATR)[0];
    			double sl;
    			
    			sl = Close[0] - distance;
    			SetStopLoss(CalculationMode.Price, sl);
            }
    Maybe is not efficient.

    Best,
    Vince.
    Last edited by vibarco; 01-10-2013, 02:27 PM.

    #2
    Hello Vince,

    You may want to make sure that the Stop Loss price that you are setting to is a valid tick/price of the instrument by using the Round2TickSize() method. For Example:

    Code:
    double distance = Instrument.MasterInstrument.Round2TickSize(ATR(periodATR)[0]);
    Also, you will want to make sure that it is only called when you would like the Stop Loss to be moved, as it stands now everytime OnBarUpdate() will be called it will set the Stop Loss based upon the ATR would almost make it very hard to be filled as it will go down as the price goes down. You may view the following thread that will give you an example of how to modify your Stop Loss orders.




    Let us know if we can be of further assistance.
    JCNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

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