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

Adjusting SL and TP after entering a position by Strategy

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

    Adjusting SL and TP after entering a position by Strategy

    Hi team,

    I set target profit and stop loss on Strategy script. After entering a position with SL/TP, they are not adjusted by manually or any.
    How can I make them flexible even if it was executed by Strategy?

    Thanks,

    #2
    Hello rocketman7,

    Thank you for your post.

    It’s possible to manually modify stops and targets submitted by a NinjaScript Strategy by using exit methods, such as ExitLongStopMarket(), with isLiveUntilCancelled set to true.

    ExitLongStopMarket(int barsInProgressIndex, bool isLiveUntilCancelled, int quantity, double stopPrice, string signalName, string fromEntrySignal)

    Help Guide: NinjaScript > Language Reference > Strategy > Order Methods > Managed Approach > ExitLongStopMarket()

    Using isLiveUntilCancelled set to true allows the orders to be submitted once without being updated again from the script. This will allow you to manually modify the orders without them moving back to the original price from the strategy. We suggest submitting the orders from OnExecutionUpdate() when the entry order fills.

    Please note that this cannot be accomplished with the Strategy Builder. In the Strategy Builder, orders are submitted without using the isLiveUntilCancelled bool, meaning the bool will be set to false and the order will be automatically cancelled if not resubmitted on each new bar. If the orders are resubmitted, this would cause the manually adjusted order to revert back to the strategy assigned price.

    ManuallyModifiableStopTargetExample_NT8 demonstrates placing an exit stop and limit order which can be manually modified.

    Developer example: ManuallyModifiableStopTargetExample_NT8

    Please let us know if you have any further questions.
    Gaby V.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by ETFVoyageur, Today, 08:39 AM
    7 responses
    13 views
    0 likes
    Last Post ETFVoyageur  
    Started by tkaboris, Yesterday, 07:53 PM
    5 responses
    17 views
    0 likes
    Last Post tkaboris  
    Started by GLFX005, Today, 09:31 AM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Started by tgn55, Today, 09:15 AM
    1 response
    4 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by grebow25, Today, 09:20 AM
    0 responses
    3 views
    0 likes
    Last Post grebow25  
    Working...
    X