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 sjsj2732, 03-23-2026, 04:31 AM
    0 responses
    63 views
    0 likes
    Last Post sjsj2732  
    Started by NullPointStrategies, 03-13-2026, 05:17 AM
    0 responses
    307 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    300 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    143 views
    1 like
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    103 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Working...
    X