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