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 rbeckmann05, Yesterday, 06:48 PM
    1 response
    12 views
    0 likes
    Last Post bltdavid  
    Started by llanqui, Today, 03:53 AM
    0 responses
    6 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Started by burtoninlondon, Today, 12:38 AM
    0 responses
    10 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    15 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Working...
    X