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

Stop Loss for Long/Short

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

    Stop Loss for Long/Short

    You need a seperate TrailStop and ProfitTarget for the long and short but does the short and long use the same StopLoss seeing the stop is calculated from a flat position? And does it matter where in the strategy code I place the below code, does it have to be before the long and short entry?

    if ((BarsInProgress == 0) && (Position.MarketPosition == MarketPosition.Flat))
    {
    SetStopLoss(CalculationMode.Percent, stoppercent);
    }

    #2
    Zach, is this for a dynamic or static stop loss? For a static I would just put the set call in Initialize(), if dynamic then you would want to set the stop before entry, as it's directly attached to the incoming execution.
    BertrandNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by JGriff5646, Today, 10:02 PM
    0 responses
    1 view
    0 likes
    Last Post JGriff5646  
    Started by AdamDJ8, Today, 09:18 PM
    0 responses
    2 views
    0 likes
    Last Post AdamDJ8
    by AdamDJ8
     
    Started by knowmad, Today, 03:52 AM
    2 responses
    27 views
    0 likes
    Last Post knowmad
    by knowmad
     
    Started by ETFVoyageur, Today, 07:05 PM
    0 responses
    10 views
    0 likes
    Last Post ETFVoyageur  
    Started by Orion815, 05-02-2024, 08:39 AM
    2 responses
    18 views
    0 likes
    Last Post Orion815  
    Working...
    X