• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 martyn73, Today, 05:27 PM
    0 responses
    6 views
    0 likes
    Last Post martyn73  
    Started by MichaelAlexander, 02-22-2017, 05:06 AM
    5 responses
    1,402 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by walter739, Today, 11:56 AM
    3 responses
    11 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by kevinfloresz, Today, 09:46 AM
    4 responses
    29 views
    0 likes
    Last Post kevinfloresz  
    Started by digibob, 12-13-2019, 10:01 PM
    7 responses
    20 views
    0 likes
    Last Post NinjaTrader_ChrisL  
    Working...
    X