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

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 Stanfillirenfro, Yesterday, 09:19 AM
            7 responses
            51 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by TraderCro, 04-12-2024, 11:36 AM
            4 responses
            69 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Mindset, Yesterday, 02:04 AM
            1 response
            15 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by agclub, 04-21-2024, 08:57 PM
            4 responses
            18 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by Irukandji, Today, 04:58 AM
            0 responses
            6 views
            0 likes
            Last Post Irukandji  
            Working...
            X