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 DayTradingDEMON, Today, 09:28 AM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by cmtjoancolmenero, Yesterday, 03:58 PM
    8 responses
    31 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by helpwanted, Today, 03:06 AM
    2 responses
    22 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by navyguy06, Today, 09:28 AM
    0 responses
    5 views
    0 likes
    Last Post navyguy06  
    Started by rjbtrade1, 11-30-2023, 04:38 PM
    2 responses
    77 views
    0 likes
    Last Post DavidHP
    by DavidHP
     
    Working...
    X