Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Set StopLoss as SenkouSpanB

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

    Set StopLoss as SenkouSpanB

    Hello,

    I want to set the stoploss as the Ichimoku Line SenkouSpanB, after some bars; maintein the original StopLoss, and then change it into the new SenkouSpanB. When I do it doesn't work, or if it works, the original stoploss dissapear.

    I have this logic:

    if (Bars.FirstBarOfSession == true)

    Variable1 = IchiCloud(8, 22, 44).SenkouSpanB[0];

    if (Position.MarketPosition == MarketPosition.Flat
    && Close[1] > SMA(SMALengh)[1]
    && Close[0] < SMA(SMALengh)[0]
    && Close[0] < IchiCloud(8, 22, 44).SenkouSpanA[0]
    && Close[0] < IchiCloud(8, 22, 44).SenkouSpanB[0])
    {
    EnterShort(1, "");
    SetStopLoss("", CalculationMode.Ticks, 5, false);
    SetProfitTarget("", CalculationMode.Ticks, ProfitTarget);


    }
    if (Position.MarketPosition == MarketPosition.Short)

    SetStopLoss("", CalculationMode.Price, Variable1, false);

    #2
    Hello josefo,

    Thank you for your inquiry.

    The code you have provided will immediately change your original stop loss to a price set in Variable1 once you are in a short position.

    When your if condition to EnterShort becomes true, the strategy submits a short order and sets the initial stop loss and profit target. But, it'll be modified soon after because of the next if condition. When the strategy is in a short position, the stop loss will be modified to move to a price set in Variable1.

    If you wish to maintain the original stop loss after n amount of bars, you can utilize BarsSinceEntry(): http://ninjatrader.com/support/helpG...sinceentry.htm

    Please, let us know if we may be of further assistance.
    Zachary G.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by mattbsea, Today, 05:44 PM
    0 responses
    5 views
    0 likes
    Last Post mattbsea  
    Started by RideMe, 04-07-2024, 04:54 PM
    6 responses
    31 views
    0 likes
    Last Post RideMe
    by RideMe
     
    Started by tkaboris, Today, 05:13 PM
    0 responses
    2 views
    0 likes
    Last Post tkaboris  
    Started by GussJ, 03-04-2020, 03:11 PM
    16 responses
    3,282 views
    0 likes
    Last Post Leafcutter  
    Started by WHICKED, Today, 12:45 PM
    2 responses
    20 views
    0 likes
    Last Post WHICKED
    by WHICKED
     
    Working...
    X