Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Based Stop Reversal on ATR based stop, but only once

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

    Strategy Based Stop Reversal on ATR based stop, but only once

    I have looked everywhere for what I need but can't find it. I need my strategy to perform the following:
    • reverse when the ATR based stop is hit.
    • reversal also has a stop based on the ATR.
    • reverse only the one time until the initial entry criteria is met again.
    • need this reversal order to exit when a certain criteria is hit, say MACD fast length crest/trough breakover.


    Code:
    #region Stoploss reset, ATR Stop set, & Breakeven (BE)
    			// Resets the stop loss to the original value when all positions are closed
    			if (Position.MarketPosition == MarketPosition.Flat)
    			{
    				SetStopLoss(CalculationMode.Ticks, StopLoss);
    				//Set ATR Stop in ticks
    			 	StopLoss = Convert.ToInt32(Math.Round( ATR(ATRStopPeriod)[0] * ATRStopMulti / TickSize));
    			}
    					
    			// If a long position is open, allow for stop loss modification to breakeven
    			else if (Position.MarketPosition == MarketPosition.Long)
    			{
    				// Once the price is greater than entry price +BETrigger ticks, set stop loss to breakeven + 1
    				if (Close[0] > Position.AvgPrice + BETrigger * TickSize)
    					{
    					SetStopLoss(CalculationMode.Price, Position.AvgPrice + 1 * TickSize);
    					}
    			}
    				
    			// If a short position is open, allow for stop loss modification to breakeven
    			else if (Position.MarketPosition == MarketPosition.Short)
    			{
    				// Once the price is greater than entry price +BETrigger ticks, set stop loss to breakeven + 1
    				if (Close[0] < Position.AvgPrice - BETrigger * TickSize)
    					{
    					SetStopLoss(CalculationMode.Price, Position.AvgPrice - 1 * TickSize);
    					}
    			}
    			#endregion
    Thanks!

    #2
    Hello,

    Thank you for the post.

    I am unsure based on what is posted what is not happening correctly, are you saying in addition to what is posted you would like what you listed added? If so I would not be able to assist directly with that but could help with any questions you have related to the syntax used. If you do need it modified for you I can have our business development department provide information on developers.

    If instead you have a specific portion of the syntax that is not working as expected, please share which part of the posted syntax is not working and what tests you have completed, I could provide any incite knowing what the specific problem is.

    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    63 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    40 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    22 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    25 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    51 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X