Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Limit trail stop

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

    Limit trail stop

    While trading forex I want to set a trailing stop with a specific amount of ticks. However, it cannot pass a specific price.
    For example, suppose I'm entering long at current price of 1.50000 with a trailing stop of 100 ticks which will set the first S.L to 1.49900. However, although I want the trailing stop to be 100 ticks (for example, if the price changes to 1.50200, the S.L will be 1.50100), I don't want the S.L ever to be below 1.49950. As seen above, the first S.L will be 1.49900 which is below 1.49950.
    Is there a way to have a trail stop loss which never cross a specific price?

    Thanks

    #2
    Hello kiss987,

    Thank you for your post.

    Yes, this is possible by checking the current price level of the market and then checking that against the specific price level you do not wish to cross below with your trailing stop. This requires placing the SetTrailStop() command in the OnBarUpdate() method. For example:
    Code:
    			if (Position.MarketPosition == MarketPosition.Flat)
    				SetTrailStop(CalculationMode.Ticks, 500); // reset trailing stop when flat
    			
    			if (Close[0] - 500*TickSize <= 1.49950)
    			{
    				int tStop = Convert.ToInt32(Math.Abs((1.49950 - Close[0])/(Instrument.MasterInstrument.PointValue * TickSize)));
    				SetTrailStop(CalculationMode.Ticks, tStop);
    			}
    Please let me know if you have any questions.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    56 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    143 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    160 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    96 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    276 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X