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

Adopt Account Position and Trail Stop

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

    Adopt Account Position and Trail Stop

    Hello,

    Quick question... I'm working on an Adopt Position strategy.

    Basically, whatever the long position is that I have... when I enable the strategy, I just have it looking for an exit point.

    When that exit point triggers, I start a SetTrailStop(CalculationMode.Percent, .01);

    When I run the strategy, it gets the position and average position price just fine, that works great. It calculates the profit target properly so the only thing left is the SetTrailStop as above. When that SetTrailStop triggers, a real order isn't placed, I'm getting this message:

    Code:
    Entered internal SetStopTarget() method: Type=TrailStop FromEntrySignal='' Mode=Percent Value=0.01 IsSimulatedStop=False IsMarketIfTouched=False
    But, no order shows up on the chart, and no order is sent to the broker (Interactive Brokers).

    Is there a way to trigger a trailstop on an order that has been placed prior to the strategy being enabled?

    Thank you
    Jeff

    #2
    Hello Jeff, thanks for your post.

    I tested a strategy and got the same behavior. It should be possible to initiate a trailing stop from an adopted position so I will submit a report to fix the issue.

    Kind regards.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hello Jeff, I spoke too soon. I tested again, waited for the next bar to close and the trailing stop is working.

      I tested a simple strategy that only submits the trailing stop on the first real time bar and the trailing stop is submitted. Can you test this strategy that I have posted and confirm it works for you? To test: Open a 10 second chart>Ppen a long position on the sim101 account>Add "teststrategy">Set Adopt Account Position> Enable> wait for the next real time bar, the trailing stop will update on each bar close. Note* the trailing stop will update based on the Calculate property, so if the script is Calculate.OnBarClose the trail stop will update once on every bar close.

      Best regards,
      -ChrisL
      Attached Files
      Chris L.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by rhyminkevin, Today, 04:58 PM
      3 responses
      47 views
      0 likes
      Last Post Anfedport  
      Started by iceman2018, Today, 05:07 PM
      0 responses
      5 views
      0 likes
      Last Post iceman2018  
      Started by lightsun47, Today, 03:51 PM
      0 responses
      7 views
      0 likes
      Last Post lightsun47  
      Started by 00nevest, Today, 02:27 PM
      1 response
      14 views
      0 likes
      Last Post 00nevest  
      Started by futtrader, 04-21-2024, 01:50 AM
      4 responses
      50 views
      0 likes
      Last Post futtrader  
      Working...
      X