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

Order methods, use of 2 timesframes - (stop price is greater than or equal ...)

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

    Order methods, use of 2 timesframes - (stop price is greater than or equal ...)

    Hello,


    I'm using a strategy with 2 Data Series.
    1. M3 chart
    2. 5 Seconds Chart (in the background / should only be for trade)
    I want to get a smaller stop.
    When testing with "historical" state, I always get an error message.

    PHP Code:

    int index 
    1// for the 5 second chart
    bool isLiveUntilCancelled true;
    double price 1733.2// Low Price of 5 Seconds Chart
    string name "example";

    // Entry: 16.06.2020 21:03:25 (GC)
    EnterLongLimit(indexisLiveUntilCancelled1pricename); 
    So far it works wonderfully.

    PHP Code:
    // in the M3 chart, the stop is below the low
    // Stop Time 16.06.2020 21:03:35 (GC)
    double price 1733
    ExitLongStopLimit(indexisLiveUntilCancelled1priceprice"Stop " namename); 

    This stop loss also works.
    but

    PHP Code:
    // in the 5 second chart, the stop is below the low.
    double price 1733.1
    // Stop Time 16.06.2020 21:03:35 (GC)
    ExitLongStopLimit(indexisLiveUntilCancelled1priceprice"Stop " namename); 
    error message

    A Sell stop order placed at '16.06.2020 21:03:00' has been ignored since the stop price is greater than or equal to the close price of the current bar. This is an invalid order and subsequent orders may also be ignored. Please fix your strategy.


    Why is that?
    Should you use the small timeframe as the primary chart and the larger timeframe in the background?
    I want the orders to be executed on the 5 second chart, but it seems like the bars from the M3 are taken into account. Or am I doing something wrong?


    #2
    Hello 1001111,

    Thanks for your post.

    Standard Fill Resolution uses the next bar in the data series that the order is submitted to to estimate where the order will fill. There is no intrabar movement with historical processing. If the price range of the bar that is used to fill the order would not allow the stop to be accepted/filled, we would see this error.

    For single instrument/timeframe strategies, High Order Fill Resolution can be used to have orders filled against a single tick data series and this can be used to have the orders filled with intrabar granularity instead of using the price range of the next bar.

    For Multi Time Frame strategies, you may add a single tick data series and submit orders to that data series.

    Backtesting with intrabar granularity - https://ninjatrader.com/support/help...ipt_strate.htm

    Below is a link to thread which describes these errors and how debugging steps can be taken to see how the error is received.

    I am coding a strategy and am receiving numerous instances of the following error message: A Buy order placed at '[time]' has been ignored since the stop price is less than or equal to the close price of the current bar. I have searched the NinjaTrader forums and have read many posts related to this error message, but none


    I look forward to assisting.
    JimNinjaTrader Customer Service

    Comment


      #3
      Many thanks. That will definitely help me a bit.

      I will probably write a test strategy, where I can test it exactly first.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by kujista, Today, 06:23 AM
      4 responses
      13 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by traderqz, Yesterday, 09:06 AM
      2 responses
      15 views
      0 likes
      Last Post traderqz  
      Started by traderqz, Today, 12:06 AM
      3 responses
      6 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by RideMe, 04-07-2024, 04:54 PM
      5 responses
      28 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by f.saeidi, Today, 08:13 AM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X