• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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 Aporshnev, Yesterday, 05:56 PM
                  1 response
                  11 views
                  0 likes
                  Last Post NinjaTrader_PaulH  
                  Started by aguison, Today, 06:20 AM
                  1 response
                  9 views
                  0 likes
                  Last Post Eric M.
                  by Eric M.
                   
                  Started by srganesh, Yesterday, 07:04 PM
                  1 response
                  18 views
                  0 likes
                  Last Post NinjaTrader_PaulH  
                  Started by afoschini, Today, 02:26 AM
                  1 response
                  11 views
                  0 likes
                  Last Post NinjaTrader_Marco  
                  Started by daveace, Yesterday, 11:01 PM
                  1 response
                  10 views
                  0 likes
                  Last Post NinjaTrader_ChrisSch  
                  Working...
                  X