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 funk10101, Today, 09:43 PM
    0 responses
    3 views
    0 likes
    Last Post funk10101  
    Started by pkefal, 04-11-2024, 07:39 AM
    11 responses
    36 views
    0 likes
    Last Post jeronymite  
    Started by bill2023, Yesterday, 08:51 AM
    8 responses
    44 views
    0 likes
    Last Post bill2023  
    Started by yertle, Today, 08:38 AM
    6 responses
    26 views
    0 likes
    Last Post ryjoga
    by ryjoga
     
    Started by algospoke, Yesterday, 06:40 PM
    2 responses
    24 views
    0 likes
    Last Post algospoke  
    Working...
    X