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

bars required to trade on eachtick

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

    bars required to trade on eachtick

    Hi.

    My strategy uses Calculate on each tick.i obtain an average data of price of the last 500 ticks and store on a Tseries.

    My problem is due thar primary data series is a 20 tick renko bars. I Need to load at least 501 ticks. If i use bars required to trade=501 bars(20 renko) i need a large historical data.

    It is possible to avoid this issue?

    regards

    #2
    Hi memonic,
    Did you try to add a secondary data series (type ticks) for your 500 tick average calcs, perhaps even a 500 tick data series?
    NT-Roland

    Comment


      #3
      Thanks NT-Roland
      but i use tickreplay and adding dataseries of 1tick, increase the computational time exponentially
      regards

      Comment


        #4
        Hi memonic,
        Why do you need 1ticks, if you only want the average price of 500 Ticks? Perhaps, this is enough?

        Strategy:
        private Series<double> my500TickSeries;

        State.Configure:
        AddDatasSeries(Data.BarsPeriodType.Tick, 500, Data.MarketDataType.Last);

        State.DataLoaded:
        my500TickSeries = new Series<double>(this);

        OnBarUpdate:
        If (CurrentBars[1] >= 1)
        {my500TickSeries[0] = Medians[1][0];}

        NT-Roland

        Comment


          #5
          Hello memonic, thanks for your post.

          It looks like adding a 500 tick series would be the best option to avoid loading many bars of the primary series. If your strategy runs OnEahTick, the OnBarUpdate method will run for each tick of the 500 tick bar anyway, so no need for a 1 tick series.

          Please let me know if this does not resolve your inquiry.
          Chris L.NinjaTrader Customer Service

          Comment


            #6
            Thanks NT-Roland and ChrisL
            My problem is that im using parabolic stop. how can filter 500 ticks data series to employ parabolic stop in 20 tick renko bars?
            regards

            Comment


              #7
              Hi.
              The following sintax not works in my strategy

              protected override void OnBarUpdate()
              {
              if (BarsInProgress == 1)
              {
              SetParabolicStop("long", CalculationMode.Ticks, 10, true, 0.2, 0.02, 0.2);
              }


              removing the BarsInProgress == 1, the strategy works correctly
              regards

              Comment


                #8
                I need to use parabolic stop, not in the primary series, but in the secondary series. It´s possible

                Comment


                  #9
                  Hello memonic,

                  Thanks for your question.

                  Set methods will update based on the Calculate property and will update for each added data series.

                  For example, if we have a script using SetTrailStop() or SetParabolicStop(), the script adds a 5 second data series and it is applied to a 10 second data series with Calculate set to OnBarClose, the stop loss will be updated on the 5 second bar closure and the 10 second bar close.

                  If you would like to only update the stop loss based off of updates to your added data series, I recommend using Exit methods instead of Set methods for your stop loss, and then you can call your Exit methods when BarsInProgress == 1 to update the stop to a new level.

                  I have attached a script that will update a stop loss based on the secondary series updates.

                  Reference for Multi Time frame scripts can be found here - https://ninjatrader.com/support/help...nstruments.htm

                  Please let me know if I can be of further assistance.
                  Attached Files
                  JimNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by algospoke, Today, 06:40 PM
                  0 responses
                  10 views
                  0 likes
                  Last Post algospoke  
                  Started by maybeimnotrader, Today, 05:46 PM
                  0 responses
                  8 views
                  0 likes
                  Last Post maybeimnotrader  
                  Started by quantismo, Today, 05:13 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post quantismo  
                  Started by AttiM, 02-14-2024, 05:20 PM
                  8 responses
                  168 views
                  0 likes
                  Last Post jeronymite  
                  Started by cre8able, Today, 04:22 PM
                  0 responses
                  10 views
                  0 likes
                  Last Post cre8able  
                  Working...
                  X