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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    46 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    22 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    14 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    21 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    23 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X