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 CarlTrading, 03-31-2026, 09:41 PM
            1 response
            152 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            89 views
            1 like
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            133 views
            2 likes
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            127 views
            1 like
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            107 views
            0 likes
            Last Post CarlTrading  
            Working...
            X