Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Set rolling Stop Loss with Swing Indicator

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

    Set rolling Stop Loss with Swing Indicator

    Hi All,

    I am facing some difficulties on how to set a rolling stop loss using Swing Indicator.
    My idea is to set the Stop Loss at the second last swing low (for Long entry) only when the swing low is higher than the previous swing low.

    On the attachment chart you could see where the SL levels the should be (A,B,C and D) and the position should Stop Out at E point. To explain this further the SL need to change like the following :

    At time 1 the SL is at A
    At time 2 the SL is at B
    At time 3 the SL is at C
    At time 4 the SL is at D
    Stop Out at E

    In addition, I have a part of my code below where I am setting the stop loss(SL). My position is closing at using the the SL level D instead of C. Could you please give me an idea how to code this rolling SL idea.

    Code:

    else if (Position.MarketPosition == MarketPosition.Long)
    {
    if (Close[0]<stopLongPrice
    && Close[0]<SMA(MAFast)[0]
    && Close[1]<SMA(MAFast)[1])

    {
    Click image for larger version

Name:	Swing Stop Loss.png
Views:	1
Size:	36.4 KB
ID:	900310 ExitLong();
    Print("Exit Long trade at " + Close[0] + " at " + Time[0] );
    }

    else if (Swing(SWG).SwingLow[2]>stopLongPrice)
    {
    Print("Actual Low Swing=" +Swing(SWG).SwingLow[0] + " Previous SL="+stopLongPrice);
    stopLongPrice = Swing(SWG).SwingLow[2];
    Print("New Stop loss price : " + stopLongPrice + " at " + Time[0] );
    }

    Thanks in advance

    #2
    Hello Loukas,

    Thank you for your post.

    May I test your full strategy on my end? If so please send your strategy to support[at]ninjatrader[dot]com with 'ATTN: Patrick - 877053' in the subject line and a reference to this thread in the body of your e-mail: http://www.ninjatrader.com/support/f...ad.php?t=59105

    Comment

    Latest Posts

    Collapse

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