Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Post market order

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

    Post market order

    Hi, I'm trying to figure out how Ninja could put a buy market order in the spain post market.

    Spain´s post market starts at 17:30 (spain time) and ends 17:35.

    The price traded at post market it's the close price of session.

    For any condition, for example if lastest Close at time 17:29 (just before the post market) cross above SMA(20) enter long and send a market order in the post market.

    Ninja could do that? I'm losting my life traying to get work out, but since Ninja calcs prices with bar close, and during the post market there´s no incoomming ticks sounds impossible (the last tick will be at 17:35 when final price is fixed during the 5 minutes post market ).

    And CalculateOnBarClose = false, the order will be sent anytime when an incomming tick arrives during 17:29 and 17:30 but not at post market.

    Any idea?

    Thanks.

    #2
    Hi fercho,

    You could work with custom events like a timer to submit orders outside of OnBarUpdate(). This sample can help you work with timer objects.


    Keep in mind that if there is no bar update received, the simulator (Sim101 account) can't fill the order.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      so, if there's no incomming tick (like the post trade sessions) ninja could however send a market order for example:

      If (ToTime(Time[0]) == ToTime(17, 30, 01))

      EnterLong(1000,"Long");

      just using a time condition?

      or Ninja must receive a tick to understand the current time?

      Thanks

      Comment


        #4
        For the current time, you'd want to use your computer clock instead of the bar time stamp. That's available with DateTime.Now

        If there's no trades, then you'd need to add a custom event that submits orders outside of OnBarUpdate(). You can use the timer object from that reference sample to raise an event every second that checks DateTime.Now for an order condition.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Sorry It's very advanced code for me. Could just paste an example on how to do it?

          It will simplify a lot my learning. Thanks in advance.

          Comment


            #6
            Yes, I understand it can be tricky, but the sample linked is the best way to see a working example of it with all the parts integrated within one script.

            If you have do not have the programming experience required to integrate the sample concepts into your own strategy, you can always consider contacting one of our 3rd party NinjaScript consultants:
            Ryan M.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by kempotrader, Today, 08:56 AM
            0 responses
            7 views
            0 likes
            Last Post kempotrader  
            Started by kempotrader, Today, 08:54 AM
            0 responses
            4 views
            0 likes
            Last Post kempotrader  
            Started by mmenigma, Today, 08:54 AM
            0 responses
            2 views
            0 likes
            Last Post mmenigma  
            Started by halgo_boulder, Today, 08:44 AM
            0 responses
            1 view
            0 likes
            Last Post halgo_boulder  
            Started by drewski1980, Today, 08:24 AM
            0 responses
            4 views
            0 likes
            Last Post drewski1980  
            Working...
            X