Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

How to resert a TrailingStop price

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

    How to resert a TrailingStop price

    Hi all,

    I am trying to set a trailing stop based on a user Variable0, but I don't know how to resert it whe the estrategy is flat

    This is what I have done:

    if (...Several Conditions...)

    {
    EnterLong(DefaultQuantity, "");
    Variable0 = Low[1];

    SetTrailStop("", CalculationMode.Price, Variable0, false);
    }


    Is it possible?

    Thank you,
    Carlos

    #2
    Hello CarlosTTW,

    Thank you for writing in.

    I would highly suggest taking a look at this reference sample on our support forum for details on how to reset your stop: http://ninjatrader.com/support/forum...ead.php?t=3222

    You can see on lines 52 - 55 how the stop loss is reset.

    Code:
    if (Position.MarketPosition == MarketPosition.Flat)
    {
    	SetStopLoss(CalculationMode.Ticks, stoplossticks);
    }
    While this is in regards to SetStopLoss(), you can easily reset SetTrailStop() to whatever default value you wish.

    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 giulyko00, 04-24-2024, 12:03 PM
    9 responses
    43 views
    0 likes
    Last Post giulyko00  
    Started by memonic, Yesterday, 01:23 PM
    2 responses
    24 views
    0 likes
    Last Post memonic
    by memonic
     
    Started by merc410, Today, 03:41 AM
    2 responses
    14 views
    0 likes
    Last Post merc410
    by merc410
     
    Started by sugalt, 04-30-2024, 04:02 AM
    2 responses
    13 views
    0 likes
    Last Post sugalt
    by sugalt
     
    Started by Ndakotan1313, 03-14-2024, 05:02 PM
    2 responses
    64 views
    0 likes
    Last Post blaise_code  
    Working...
    X