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

Writing code for stop orders and GTC

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

    Writing code for stop orders and GTC

    What is the best way to type up a script that sets up the BTO at the high of previous day (high[1]) and the STC at the low of the previous day (low[1]) with the type set at "GTC".
    I've been playing around with the built-in indicators, but I figured I should use ninjascript to get exactly what I want.

    #2
    https://ninjatraderecosystem.com/use..._search=profit
    Based on PriorDayOHLC indicator. PriorWeekOHLC will draw lines on your chart: Open, Close, High, Low for the given previous week. You can select on which day the indicator should start calculating from. An example to access the week open value: double priorWeekOpenPrice = PriorWeekOHLC(true,true,true,true,DayOfWeek.Monday ).PriorWeekOpen[0]; Enjoy

    Comment


      #3
      Hello pssumking93,

      Are you looking for a specific indicator with plots that have the names BTO and STC?
      I am personally am not familiar with these.

      This thread will remain open for any community members that may know of indicators with these plot names.

      Below I am providing a link to a forum post with helpful information about getting started with NinjaScript.


      You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our business development follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        I'm not looking for specific indicators that have the names BTO and STC.

        I just want to be able to write for a script that incorporates the "buy to open" based off the high of the previous day and the "sell to close" at the low of the previous day.

        Comment


          #5
          Hello,

          I am understanding you are asking how to use a Time-In-Force code (TIF).

          A NinjaScript Strategy can have all orders with Day, Gtc, Gtd.
          https://ninjatrader.com/support/help...imeinforce.htm

          Submitting orders through the account through addon tools allows for a few more TIF codes such as OPG (on the open).
          https://ninjatrader.com/support/help...reateorder.htm

          I am happy to submit a feature request to use other specific codes if you would like.

          Below I am adding the definitions used by NinjaTrader.
          - DAY (Good for the Day) – good until the end of the regular session.

          - GTC (Good Till Canceled) – good until you cancel the order, stays active a maximum of 60 days.

          - GTD (Good Till Date) – good until a date you specify.

          - EXT (Good for the Day plus Extended Hours) – this order will be good for all the sessions for one day, including the pre-market session, the regular session and the following extended hours session. If the order is submitted during any of these sessions, it will carry through the other sessions for the current day.

          - OPG (On the Open) – order is submitted to fill on the opening price of the market (opening print) or as close as possible to the opening price.

          - CLO (On the Close) - order is submitted to fill on the closing price of the market or as close as possible to the closing price (closing print).

          - IOC (Immediate or Cancel) – order must fill immediately or it is canceled (or the portion unfilled cancelled).

          - FOC (Fill or Kill) – order must be immediately filled in its entirety or it is canceled. This is like a combination of Immediate or Cancel (IOC) with All or None (AON) special handling.
          Last edited by NinjaTrader_ChelseaB; 12-01-2019, 08:02 PM.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Thank you so much!

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Jimmyk, 01-26-2018, 05:19 AM
            6 responses
            835 views
            0 likes
            Last Post emuns
            by emuns
             
            Started by jxs_xrj, 01-12-2020, 09:49 AM
            6 responses
            3,291 views
            1 like
            Last Post jgualdronc  
            Started by Touch-Ups, Today, 10:36 AM
            0 responses
            10 views
            0 likes
            Last Post Touch-Ups  
            Started by geddyisodin, 04-25-2024, 05:20 AM
            11 responses
            62 views
            0 likes
            Last Post halgo_boulder  
            Started by Option Whisperer, Today, 09:55 AM
            0 responses
            9 views
            0 likes
            Last Post Option Whisperer  
            Working...
            X