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

Price information of the first bar in time filtered session (Grid Trading Automation)

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

    Price information of the first bar in time filtered session (Grid Trading Automation)

    Hi, I am currently running into several challenges during strategy development of a grid trading strategy.

    General Strategy Discription:

    I am using UniRenko to pain a flat baseline chart with 40/1/1 setup. The idea is that at 9:30am EST, I calculate a price (median or close) and enter 3 buy orders and 3 sell orders above and below the first bar price (close or median) by X ticks. These orders would have each equal targets (Y) and stop (Z) in value, placed at 1 * X, 2 * X, and 3 * X above and below the calculated price. For example, if the median price of the first bar on NQ at 9:30am 14010 and Level X=50, Target Y=40, Stop Z=20, then a 3 buy orders are placed at 14060, 14110, and 14160, and 3 sell orders at 13960, 13910, and 13860. Each order would stay live until fulfilled, and when fulfilled, it either reaches profit (Y) or stop (Z). Since other orders are further away, they will only trigger when the first order is entered and exited for profit or loss. I can do this manually with different ATMs placed before the open, but that's very painful to do everyday without automation.

    Click image for larger version

Name:	203100904_490383172037804_3690221563272456003_n.png
Views:	295
Size:	46.8 KB
ID:	1160614

    During any given day, there will only be a total of 6 orders. No more no less.

    Order Entry Settings:
    • To achieve the above, it seems that "Entry Handling" needs to be set to "Unique Entries" so that Strategy Profit (Y) and Loss (Z) are set once, but triggered when each order is fulfilled. Can you confirm?

    Time filter and price of first bar close/median after start time
    • I have two inputs EntryTime, StopTime of type time. I want to get the price information of the first bar. It doesn't seem that FirstBarOfSession respected the time filter condition, but rather is the true first bar of the session (6PM EST)
    • How do I check for time filter first and that the current bar is the first bar at or after the StartTime? I am using Times[Default Input][0].TimeOfDay >= EntryTime.TimeOfDay, but it seems calculate the event on each bar and attempts to enter and order on each event being true. using = instead of >= doesn't trigger the condition.
    • I just want to get the Current[0].Close once at or after EntryTime, which will be the basis I use to place the orders.
    Order Entry:
    • In "Do The Following: I have 3 EnterLong, and 3 EnterShort, but the strategy enters many in very rapid succession. How to I limit the orders to 3 only?
    Profit/Loss:
    • Is it sufficient to set profit and loss to Y and Z with one profit and one loss setup? Or do I need to name the entry signal and setup separate profit and losses?

    That is probably enough for one post, but I may have follow questions.

    Thanks in advance.

    #2
    Hello mgalal,

    You can use a counter, that increments each time the condition is true, and require that counter to be less than 3.


    You can require the Position.Quantity to be less than 3 to allow for a new entry.


    You can use EntriesPerDirection as 3 with each order having a quantity of 1.


    With multiple entries, each order should have a unique signal name. Exit orders should have unique signal names or no signal name. Calling a order method with the same signal name with update that existing order and not create a new order.

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you so much. I will try these approaches and reply back with results!

      Comment


        #4
        Are you suggesting using these approaches to address my questions or are these alternatives? Thank you.

        Comment


          #5
          Hello mgalal,

          These are suggestions for how you can achieve your goals. If you want to limit to 3 entries, then count 3 entries..
          Chelsea B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by junkone, Today, 11:37 AM
          2 responses
          12 views
          0 likes
          Last Post junkone
          by junkone
           
          Started by frankthearm, Yesterday, 09:08 AM
          12 responses
          43 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by quantismo, 04-17-2024, 05:13 PM
          5 responses
          35 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by proptrade13, Today, 11:06 AM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by love2code2trade, 04-17-2024, 01:45 PM
          4 responses
          35 views
          0 likes
          Last Post love2code2trade  
          Working...
          X