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

Getting Real Entry price

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

    Getting Real Entry price

    This is likely really simple.
    Primary question:
    How do I set a stop loss off of a dynamic entry price (not really a "Close" or "open")?

    Secondary Question:
    Is there an index of methods and such that I can browse through to find information like this?

    Tertiary Question:
    When you set a stop loss through Ninjascript, is it set as OCO so it cancels out if the position fills?

    #2
    Hello alphatango,

    Thank you for your post.

    You could use SetStopLoss() to create a stop loss order:


    The calculation mode will determine whether the price of the stop loss order is an offset from the average entry price or an absolute price point.

    You may view all methods available in the Managed Approach here:


    The stop loss quantity will be represented by the entry if a fromEntrySignal value is used in the call of SetStopLoss(). Otherwise, the stop loss is tied to all entries and if the position becomes flat/fills then the stop loss iwll automatically be canceled.

    Something that is helpful to understand how certain conditions/actions would be set up programmatically in a strategy is to use the Strategy Builder to define different conditions/actions, and then click the "View Code" button to view the code in the NinjaScript Editor. Here are some examples of common conditions and actions in the Strategy Builder:Stops and Targets that use the Set() methods of the unmanaged approach may be configured via the Stops and Targets screen in the Strategy Builder, then they will also show up in the logic when the "View Code" button is clicked.

    Please let us know if we may be of further assistance.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      Is there a way to reference the "fromEntrySignal"? I see that in the SetStopLoss and SetProfitTarget. That would be a valuable thing to have stored as a Position note.

      (I can use them for "if" statements; if ("mylongentry") ... else if ("myshortentry"), etc)

      Comment


        #4
        Originally posted by alphatango View Post
        Is there a way to reference the "fromEntrySignal"? I see that in the SetStopLoss and SetProfitTarget. That would be a valuable thing to have stored as a Position note.

        (I can use them for "if" statements; if ("mylongentry") ... else if ("myshortentry"), etc)
        Yes, the FromEnrySignal is a property of the Order object:


        Please let us know if we may be of further assistance.
        Emily C.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by jxs_xrj, 01-12-2020, 09:49 AM
        6 responses
        3,290 views
        1 like
        Last Post jgualdronc  
        Started by Touch-Ups, Today, 10:36 AM
        0 responses
        8 views
        0 likes
        Last Post Touch-Ups  
        Started by geddyisodin, 04-25-2024, 05:20 AM
        8 responses
        61 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by Option Whisperer, Today, 09:55 AM
        0 responses
        8 views
        0 likes
        Last Post Option Whisperer  
        Started by halgo_boulder, 04-20-2024, 08:44 AM
        2 responses
        24 views
        0 likes
        Last Post halgo_boulder  
        Working...
        X