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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    647 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    368 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    108 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    571 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    573 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X