Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Modify stop/target price order manually under Managed Approach

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

    Modify stop/target price order manually under Managed Approach

    Hello guys,

    I'm submitting entry orders using managed approach. After the entry order is filled I tried to move the stop order manually, but the order goes back to the same original price. Is there some way to be able to disable this behavior and be able to modify price of an order (stop or target) under managed approach?

    Thank you!

    #2
    Hello facuevasm,

    Thanks for your post.

    The SetStopLoss(), SetProfitTarget() and SetTrailStop() methods will all use internal rules that will update the stop or target to the assigned level after each bar closure.

    It is possible to use the Exit methods to serve as your profit target and stop loss with the isLiveUntilCancelled overload so the orders can then be adjusted manually.

    Note that the isLiveUntilCancelled overload cannot be used in the Strategy Builder so you would need to unlock the script from the Strategy Builder using the 'Unlock code' button.

    Please see the help guide link below regarding Exit methods and the isLiveUntilCanceled property.
    https://ninjatrader.com/support/help...gstoplimit.htm

    Also, see this reference sample from the help guide demonstrating this: https://ninjatrader.com/support/help...ders_alive.htm

    Let us know if we may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Thank you Brandon! I finally decide to move to use ATM. The problem I'm facing now is that after I move the stop or target, and that order got filled, the position does not close, and I get this error on the Log:

      Error in realtime market data handling: System.NullReferenceException: Object reference not set to an instance of an object. at NinjaTrader.NinjaScript.TimeSeries.get_Item(Int32 barsAgo) at NinjaTrader.NinjaScript.Strategies.XXXXTraderV34.O nExecutionUpdate(Object sender, ExecutionEventArgs e) at System.EventHandler`1.Invoke(Object sender, TEventArgs e) at NinjaTrader.Cbi.Account.RaiseExecutionUpdate(Execu tionEventArgs e) at NinjaTrader.Cbi.Account.ExecutionUpdateCallback(In strument instrument, String executionId, Exchange exchange, DateTime time, MarketPosition marketPosition, String orderId, Int32 quantity, Double price, Double commission, Double fee, Boolean isSod, DateTime statementDate, Operation operation) at NinjaTrader.Cbi.Simulator.Fill(Int32 maxFillQuantity, Double price) at NinjaTrader.Cbi.Simulator.OnMarketData(Object sender, MarketDataEventArgs e) at NinjaTrader.Cbi.Instrument.<>c__DisplayClass155_0. <OnRealtimeDataTimerElapsed>b__1(SubscribedThrea d[] threads, Int32 i, RealtimeEvents evts)

      Comment


        #4
        Hello facuevasm,

        Thanks for your note.

        To clarify, are you using ATM Strategy Methods to handle the stops and targets in your script?

        If so, please review the SampleAtmStrategy script that comes default with NinjaTrader for an example of how to use ATM Strategy Methods in a NinjaScript strategy. To view the script, open a New > NinjaScript Editor window, open the Strategies folder, and select the SampleAtmStrategy file.

        ATM Strategy Methods: https://ninjatrader.com/support/help...gy_methods.htm

        "Object reference not set to an instance of an object"

        The error message "Object reference not set to the instance of an object" means that something in the script is returning null at the time you are accessing it. Debugging steps would need to be taken to determine what exactly is returning null in the indicator.

        Below is a link to a forum post that demonstrates using debugging prints to understand the behavior of a script.
        https://ninjatrader.com/support/foru...121#post791121

        Let us know if we may assist further.
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        44 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        124 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        65 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        42 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X