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

Noob Question - Custom Trailing Stop

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

    Noob Question - Custom Trailing Stop

    Hi,

    First off... Total noob here! I've coded in my day, but would be blowing dust off the skills to get into developing stuff for myself here!

    What I'd like to create is a trailing stop that once it goes n1 Ticks, it will trail by a fixed amount. Once it hits n2 Ticks, I want to trail by that same fixed amount plus a percentage of the MFE. As a fine adjustment to this, if the calculated trail lands on a nnnn.0 or nnn.5 price level, I want to give an additional 0.1 (as for 1 Tick on for example the RTY) up or down (depending long or short).

    Seems like this should be doable. If so, would it show up as a stop strategy in the Stop Strategy to choose from? Kinda thinking not.

    If there's a better way to do this, a point in the right direction would be appreciated!

    Thanks.

    #2
    Hi GrumpyDude, thanks for posting and welcome. I first highly recommend making new strategies and new code in NinjaTrader 8 as we are actively developing and updating that version now. The way you set a trail stop is the same between NinjaTrader 7 and 8, but there are fundamental differences between the script structure between the versions.

    Use SetTrailStop() to set a trailing stop for an open position. This method can be called multiple times during a trade to modify the trailing price.

    For position information, use the Position.AvgPrice property and compare it to the Close[0] price to monitor the price relative to the average entry price.

    The MFE of the current trade will also need to be calculated manually in your script. We have statistic definitions defined here.

    Kind regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by fx.practic, 10-15-2013, 12:53 AM
    5 responses
    5,403 views
    0 likes
    Last Post Bidder
    by Bidder
     
    Started by Shai Samuel, 07-02-2022, 02:46 PM
    4 responses
    94 views
    0 likes
    Last Post Bidder
    by Bidder
     
    Started by DJ888, Yesterday, 10:57 PM
    0 responses
    6 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by MacDad, 02-25-2024, 11:48 PM
    7 responses
    158 views
    0 likes
    Last Post loganjarosz123  
    Started by Belfortbucks, Yesterday, 09:29 PM
    0 responses
    8 views
    0 likes
    Last Post Belfortbucks  
    Working...
    X