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 geddyisodin, 04-25-2024, 05:20 AM
    8 responses
    61 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by jxs_xrj, 01-12-2020, 09:49 AM
    4 responses
    3,288 views
    1 like
    Last Post jgualdronc  
    Started by Option Whisperer, Today, 09:55 AM
    0 responses
    5 views
    0 likes
    Last Post Option Whisperer  
    Started by halgo_boulder, 04-20-2024, 08:44 AM
    2 responses
    22 views
    0 likes
    Last Post halgo_boulder  
    Started by mishhh, 05-25-2010, 08:54 AM
    19 responses
    6,189 views
    0 likes
    Last Post rene69851  
    Working...
    X