Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy's buy stop from yesterday's historical data didn't trigger entry today

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

    Strategy's buy stop from yesterday's historical data didn't trigger entry today

    Hi guys,

    I'm nearly finished making my strategy ready for live trading, but I had one odd snag today that I will test and work on, but while I do that I thought I should throw the question out here in case anyone already knew the answer more quickly than I could find it myself -- here goes:

    I have a strategy that starts off by setting a Buy Stop order to enter a position. The stop level to enter at is based on the previous bar's close plus a certain amount of ticks. Then on each new bar, the strategy tests if this new value of close[1] + tickamt is lower or not, and if it is, it updates the buystop to be the new lower number.

    So really, the buy stop is always working from the first moment the strategy is on, and just gets lower and lower as the bars progress.


    Now the thing I noticed is that when I turned on the strategy at about 8am today, there was a pending buy stop on CTRX set for 87.50, based on the close of the last 1hour bar of yesterday's session. I could see the DownArrow draw object that my strategy was supposed to draw at the buystop level and everything. The data so far was only historical data because I opened the chart before the live market had started..

    Then, at 9:30, the first 1hour bar blew up through the entry level, so I was expecting a fill, but nothing happened. Then, I disabled then re-enabled the strategy, and the historical strategy trading did show that the stop was filled historically, now that the first 1 hour of today was historical data..

    sorry for making this a long post, but for those still reading, the question I'm wondering about is, if a strategy submits a "simulated buy stop order on historical data" from enabling a strategy in after-market hours, does that mean that the buy stop is not going to be acted upon when 9:30 hits and live data starts coming in? Do I need to somehow cancel and resubmit the buy stop order on the market open so that it gets recognized?

    Because right now it looks like I'm going to need to turn on my computer and strategy before 4pm each day and leave it on overnight just to make sure that it gets fills the next day if what I think I saw is correct.

    Edit: I have CalculateOnBarClose set to true because it helps my strategy act properly in other ways, but if I have to disable it for this to work better I'll redo my code to accomodate that. But still my suspicion is that because the original buy stop was submitted on historical data, it's not being recognized during live data and thus it's freezing up my buy stop entry logic from working properly - does this seem right?

    Edit 2: Because I'm using calculateonbarclose = true so that onbarupdate is called every close of a bar, I'm starting to think that I need to use another event handler, like OnMarketData() to check if it's 9:30am and there is a working buy stop order, to cancel and resubmit it. Again, if anyone can verify if historically placed, working buy stop orders are not honoured by live market, that will be the answer I'm really looking for - thx!

    Thanks!
    Last edited by RunnrX; 09-06-2012, 08:58 AM.

    #2
    Hello RunnrX,

    Since it was submitted historically you will see the Text and Markers, but you will not see anything inside the Orders, Executions, ect... tab. If you look inside the Strategies tab if your Strategy is highlighted Yellow, meaning that it is waiting until it reaches a flat position to be in sync with the account that means that historically you are in position but will not reflect with Real-Time data positions.

    You can set your strategy to not run historically if you would like by using the following code in the beginning of OnBarUpdate():
    Code:
    if(Historical)
    return;
    Also, you can change the settings of how your strategy runs in the Tools -> Options -> Strategies -> NinjaScript tab. Here is a link to our that goes over the different settings inside the NinjaScript tab that you may view.
    http://www.ninjatrader.com/support/h...tegies_tab.htm

    Let us know if we can be of further assistance.
    JCNinjaTrader Customer Service

    Comment


      #3
      Thanks NinjaTrader_JC for replying. What you're saying is right. I could have sworn that since the position was flat at 8am today, and there was just a working buy order, that the strategy colour was green and not yellow. I'll try to see if this happens again and take note of that.

      Comment


        #4
        Thank you guys for taking time and posting this here. I am quite a newbie to all that so it was really valuable information


        ________________________
        checkers download

        Comment


          #5
          Hello WadeC,

          Welcome to the NinjaTrader Support Forums!

          Glad that we could help. Let us know if any questions come up.
          JCNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by arvidvanstaey, Today, 02:19 PM
          4 responses
          11 views
          0 likes
          Last Post arvidvanstaey  
          Started by samish18, 04-17-2024, 08:57 AM
          16 responses
          60 views
          0 likes
          Last Post samish18  
          Started by jordanq2, Today, 03:10 PM
          2 responses
          9 views
          0 likes
          Last Post jordanq2  
          Started by traderqz, Today, 12:06 AM
          10 responses
          18 views
          0 likes
          Last Post traderqz  
          Started by algospoke, 04-17-2024, 06:40 PM
          5 responses
          47 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X