Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Data series type range

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

    Data series type range

    Hi,

    I'm programming a strategy that the entry comes at the end of the bar.
    The peculiarity of this strategy is that the bars must be set Date series type range at a certain value.
    The problem is that even if I set CalculateOnBarClose = true; when the strategy run on live in OnBareUnpade method seems don't take care of the end the bar. That seems entry every ticks.

    Could you help me understand the problem?

    Thank,

    Michel

    #2
    elechim,

    Could you possible post your Intialize() and OnBarUpdate() code sections?

    Is this run on Range bars?
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Here you are the Initialize() and OnBarUpdate()

      Comment


        #4
        elechim,

        Looks like it didn't post. Could you try again please?
        Adam P.NinjaTrader Customer Service

        Comment


          #5
          Sorry,

          protected override void Initialize()
          {
          SetProfitTarget("", CalculationMode.Ticks, ProfitTarget);
          SetStopLoss("", CalculationMode.Ticks, StopLoss, false);

          CalculateOnBarClose = true;
          }

          protected override void OnBarUpdate()
          {
          Print(CurrentBar);
          if (myEntryOrder != null)
          {
          CancelOrder(myEntryOrder);
          myEntryOrder = null;

          }
          if (myEntryOrder == null)
          {
          myEntryOrder = EnterLongLimit(DefaultQuantity, Low[0] + -1 * TickSize, "Entry LONG Limit");
          }
          }



          I set Type Range on the period type of data series.

          Comment


            #6
            elechim,

            This code would leave limit pending limit orders open during the duration of a bar. With COBC = true, it would submit a new order every time a bar closes.

            What are you wanting it to do? Could you explain further?
            Adam P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            558 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            324 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            545 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            547 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X