Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order doubt

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

    Order doubt

    Hello,

    I would like that my strategy open a position like this:

    protected override void Initialize()
    {
    Add(PeriodType.Tick, 1);
    CalculateOnBarClose = false;

    }

    protected override void OnBarUpdate()
    {
    if (BarsInProgress == 0)

    {
    if (Close[1]>Open[1] && Open [0]>=Close[1])
    EnterShort(1,"");
    }
    if (BarsInProgress == 1)
    {
    return;

    But it doesn't open the position untili the following bar. What I want is that if the open of the current Bar is higher than the Close of the previous bar, it immediately opens a position, but it waits till the following bar.

    What should I do?

    Thanks

    Sincerely

    #2
    dvercher, you need to submit the order to the 1 tick time series. I'm not sure if that's what you're trying to do now with EnterShort(1, ""), but if you change that to EnterShort(1,1,""), everything should work as you want.
    AustinNinjaTrader Customer Service

    Comment


      #3
      It still doesn't work. I attach you a graph with a little text, so it is better to understand.

      Thanks

      Sincerely
      Attached Files

      Comment


        #4
        Sorry, I misread your original question. There isn't really a way to backtest this with 100% accuracy because the backtester works on a bar by bar basis, so it will always submit the order to the open of the next bar to be filled. It isn't currently possible to have the order filled on the same bar that triggered the order.

        When running this strategy in real-time you will be able to do this if you set CalculateOnBarClose = false because it won't wait for the bar to close to submit the order.

        The suggestion I gave above was because I thought you were trying to submit orders to the smaller, one tick timeframe.
        AustinNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by DJ888, 04-16-2024, 06:09 PM
        6 responses
        18 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by Jon17, Today, 04:33 PM
        0 responses
        1 view
        0 likes
        Last Post Jon17
        by Jon17
         
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        6 views
        0 likes
        Last Post Javierw.ok  
        Started by timmbbo, Today, 08:59 AM
        2 responses
        10 views
        0 likes
        Last Post bltdavid  
        Started by alifarahani, Today, 09:40 AM
        6 responses
        41 views
        0 likes
        Last Post alifarahani  
        Working...
        X