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

Renko Bars

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

    #46
    Hi astra,

    Unfortunately I could not figure out how Roonius added a PeriodType.Renko. I tried to add a PeriodType but cannot. Maybe PeriodType has Renko hidden somewhere... Any PeriodType I used gets replaced like PeriodType.Tick, so I'll just leave it at PeroidType.Renko.

    Hi Wuolong,

    I didn't realize I needed to export, and then change the folder from indicator to type. So the file accidently went to the custom/indicator folder instead. I have uploaded a new archive file, please re-import using the steps below.

    Please delete edsrenko.cs from the custom/indicator folder, and perhaps in the custom/type folder. Then open any indicator and press F5, then reimport the new archive file.

    To remove, go to:
    My Documents\NinjaTrader 6.5\bin\Custom\Type
    then delete EdsRenko.cs, then go open (edit) any indicator, and press F5 to recompile. Last, restart ninjatrader and it should be removed.

    Comment


      #47
      Yes, I got it this time. Thank you very much, edsfreedom!

      Comment


        #48
        Unfortunately I could not figure out how Roonius added a PeriodType.Renko. I tried to add a PeriodType but cannot.

        ************************************************** *************
        I have some code here. I think it is from roonius, if you want me to post it?

        Comment


          #49
          Originally posted by stephenszpak View Post
          Unfortunately I could not figure out how Roonius added a PeriodType.Renko. I tried to add a PeriodType but cannot.

          ************************************************** *************
          I have some code here. I think it is from roonius, if you want me to post it?
          Hi stephenszpak, if you have something, please do. However, I dived into Renko.cs from Roonius, and MyRenko.cs from NewShues and cannot find anything in the code that creates a new base PeriodType. My guess is that PeriodType.Renko was a ninja stealthed original base, or that somehow some other file/process created that base.

          If anyone wants both Renko, and EdsRenko to work together, than a workaround is to replace another PeriodType that you don't use:
          1. Edit EdsRenko.cs, search for PeriodType.Renko, and replace it with something like PeriodType.Tick, PeriodType.Volume, or PeriodType.Range. You will lose that type of chart though.
          2. Open (Edit) any indicator and press F5 to compile (recompiles everything)
          3. Restart NinjaTrader

          Comment


            #50
            This is what I have. I can't make heads ner tails of it.
            ================================================== ======

            //
            // Copyright (C) 2006, NinjaTrader LLC <[email protected]>.
            //
            #region Using declarations
            using System;
            using System.Collections;
            using System.Text;
            #endregion

            // This namespace holds all bars types. Do not change it.
            namespace NinjaTrader.Data
            {


            /// <summary>
            /// </summary>
            public class RenkoBarsType : BarsType
            {
            private static bool registered = Data.BarsType.Register(new RenkoBarsType());

            /// <summary>
            /// </summary>
            /// <param name="bars"></param>
            /// <param name="open"></param>
            /// <param name="high"></param>
            /// <param name="low"></param>
            /// <param name="close"></param>
            /// <param name="time"></param>
            /// <param name="volume"></param>
            /// <param name="isRealtime"></param>
            public override void Add(Data.Bars bars, double open, double high, double low, double close, DateTime time, int volume, bool isRealtime)
            {
            if (bars.Count == 0)
            AddBar(bars, open, high, low, close, time, volume);
            else
            {
            Data.Bar bar = (Bar) bars.Get(bars.Count - 1);
            double tickSize = bars.Instrument.MasterInstrument.TickSize;
            double rangeValue = Math.Floor(10000000.0 * (double) bars.Period.Value * tickSize) / 10000000.0;

            if (bars.Instrument.MasterInstrument.Compare(close, bar.High + rangeValue) >= 0)
            {
            bool isFirstNewBar = true;
            double newBarOpen = bar.High;
            double newClose = bar.High + rangeValue;

            UpdateBar(bars, bar.Open, bar.High, bar.Low, bar.Close, time, 0);

            do
            {
            AddBar(bars, newBarOpen, newClose, newBarOpen, newClose, time, isFirstNewBar ? volume : 0);
            // UpdateBar(bars, newBarOpen, newClose, newBarOpen, newClose, time, isFirstNewBar ? volume : 0);
            newBarOpen = newClose;
            newClose += rangeValue;
            isFirstNewBar = false;
            }
            while (bars.Instrument.MasterInstrument.Compare(close, newClose) >= 0);
            }
            else
            if (bars.Instrument.MasterInstrument.Compare(bar.Low - rangeValue, close) >= 0)
            {
            bool isFirstNewBar = true;
            double newClose = bar.Low - rangeValue;
            double newBarOpen = bar.Low;
            // if (open == bar.Low) UpdateBar(bars, bar.Low, bar.Low + rangeValue, bar.Low, bar.Low + rangeValue, time, 0);
            UpdateBar(bars, bar.Open, bar.High, bar.Low, bar.Close, time, 0);

            do
            {
            newClose = newBarOpen - rangeValue;
            AddBar(bars, newBarOpen, newBarOpen, newClose, newClose, time, isFirstNewBar ? volume : 0);
            newBarOpen = newClose;
            newClose -= rangeValue;
            isFirstNewBar = false;
            }
            while (bars.Instrument.MasterInstrument.Compare(newClose , close) >= 0);
            }
            else
            {
            UpdateBar(bars, bar.Open, bar.High, bar.Low, bar.Close, time, volume);
            }
            }
            }

            /// <summary>
            /// </summary>
            public override PeriodType BuiltFrom
            {
            get { return PeriodType.Tick; }
            }

            /// <summary>
            /// </summary>
            /// <param name="time"></param>
            /// <returns></returns>
            public override string ChartDataBoxDate(DateTime time)
            {
            return time.ToString(Cbi.Globals.CurrentCulture.DateTimeF ormat.ShortDatePattern);
            }

            /// <summary>
            /// </summary>
            /// <param name="chartControl"></param>
            /// <param name="time"></param>
            /// <returns></returns>
            public override string ChartLabel(NinjaTrader.Gui.Chart.ChartControl chartControl, DateTime time)
            {
            return time.ToString(chartControl.LabelFormatTick, Cbi.Globals.CurrentCulture);
            }

            /// <summary>
            /// </summary>
            /// <returns></returns>
            public override object Clone()
            {
            return new RenkoBarsType();
            }

            /// <summary>
            /// </summary>
            public override int DaysBack
            {
            get { return Gui.Chart.ChartData.DaysBackTick; }
            }

            /// <summary>
            /// </summary>
            public override int DefaultValue
            {
            get { return 4; }
            }

            /// <summary>
            /// </summary>
            public override string DisplayName
            {
            get { return PeriodType.ToString(); }
            }

            /// <summary>
            /// </summary>
            public override bool IsIntraday
            {
            get { return true; }
            }

            /// <summary>
            /// </summary>
            public override bool IsTimeBased
            {
            get { return false; }
            }

            /// <summary>
            /// </summary>
            public override int MaxLookBackDays
            {
            get { return 10;}
            }

            /// <summary>
            /// </summary>
            public override int MaxValue
            {
            get { return -1; }
            }

            /// <summary>
            /// </summary>
            public override double GetPercentComplete(Data.Bars bars, DateTime now)
            {
            throw new ApplicationException("GetPercentComplete not supported in " + DisplayName);
            }

            /// <summary>
            /// </summary>
            public RenkoBarsType() : base(PeriodType.Renko)
            {
            }

            /// <summary>
            /// </summary>
            public override int SortOrder
            {
            get { return 13000; }
            }

            /// <summary>
            /// </summary>
            /// <param name="period"></param>
            /// <returns></returns>
            public override string ToString(Period period)
            {
            return "Renko " + period.Value.ToString() + " Ticks";
            }
            }
            }

            Comment


              #51
              Originally posted by stephenszpak View Post
              Unfortunately I could not figure out how Roonius added a PeriodType.Renko. I tried to add a PeriodType but cannot.

              ************************************************** *************
              I have some code here. I think it is from roonius, if you want me to post it?
              Try using PeriodType.Custom9

              Comment


                #52
                Hi Stephen,

                Welcome to the secrets of NT. I pulled my hair out for weeks trying to add new chart types to NT.

                If you want to add a new type, change the following:

                Inside NT editor...

                -----------------------------------------------------------------------

                Save existing chart with a new name.

                -----------------------------------------------------------------------

                replace all old chart name occurances inside chart program with new chart name.

                ----------------------------------------------------------------------

                Next, change

                get { return 13000; }

                This must be a unique number. It places your entry in numeric order in the bar pulldown selection menu.

                change it to this:

                get { return 13550; }

                --------------------------------------------------------------

                next, is the hard part, defining a unique NT reconisable chart type. I have located several that NT let their venders use.

                Change the following.

                public RenkoBarsType() : base(PeriodType.Renko)

                to

                public RenkoBarsType() : base(PeriodType.Custom1)

                ----------------------------------------------------------------

                Next,

                Update the titlebar on chart.

                Change

                return "Renko " + period.Value.ToString() + " Ticks";

                to what ever you want the chart title to be.

                Ex.

                return "NewRenko " + period.Value.ToString() + " Ticks";

                ---------------------------------------------------------------------

                Finally, change the display name in the selection pulldown list for bar types:


                public override string DisplayName
                {
                get { return PeriodType.ToString(); }
                }


                to this:

                Ex.

                publicoverridestring DisplayName
                {
                // get { return PeriodType.ToString(); }
                get { return"NewRenko"; }
                }

                ---------------------------------------------------------------------

                Compile, Save, Done!!!

                --------------------------------------------------------------

                Intellisense cache must be reloaded before new chart will be selectable.

                Simply import any indicator or strategy. This will flag an Intellisense cache reload.

                Edit open any indicator, compile and save.

                Exit and reopen NT.

                --------------------------------------------------------------

                See how easy that was.

                I think I burned out several thousand brain cells figuring that out.

                let me know how it works out.


                RJay
                RJay
                NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

                Comment


                  #53
                  This does work!! Thanks!

                  Originally posted by roonius View Post
                  Try using PeriodType.Custom9

                  Comment


                    #54
                    RJay

                    I just tried to write the most simple strategy
                    possible. Could not. Had to take NT's
                    "SampleMACrossOver" and change some of the
                    parameters. I appreciate your consideration
                    however, but I think edsfreedom will get more
                    out of your post. (nice to hear from you again)

                    Comment


                      #55
                      Thanks RJay and Roonius, very informative. I changed/uploaded the new archive that uses Custom9, and unique sort number 13332.

                      Comment


                        #56
                        Originally posted by stephenszpak View Post
                        RJay

                        I just tried to write the most simple strategy
                        possible. Could not. Had to take NT's
                        "SampleMACrossOver" and change some of the
                        parameters. I appreciate your consideration
                        however, but I think edsfreedom will get more
                        out of your post. (nice to hear from you again)
                        Doing a SampleMACrossOver is easy and backtesting renkos will give you amazing results, and I mean amazing!

                        however, in real time, you WILL lose money, and I mean HUGE amounts of money.

                        I think the only way to use renkos is using it as a guide for S/R.

                        I might be wrong?

                        Comment


                          #57
                          Originally posted by ninjamouse View Post
                          Doing a SampleMACrossOver is easy and backtesting renkos will give you amazing results, and I mean amazing!

                          however, in real time, you WILL lose money, and I mean HUGE amounts of money.

                          I think the only way to use renkos is using it as a guide for S/R.

                          I might be wrong?
                          Why do you think the real time results will be poor? I've been spending
                          quite a bit of time with Renkos. Hopefully not wasted time.
                          Last edited by stephenszpak; 07-04-2009, 11:08 PM.

                          Comment


                            #58
                            Originally posted by ninjamouse View Post
                            Doing a SampleMACrossOver is easy and backtesting renkos will give you amazing results, and I mean amazing!

                            however, in real time, you WILL lose money, and I mean HUGE amounts of money.

                            I think the only way to use renkos is using it as a guide for S/R.

                            I might be wrong?
                            Are you using market orders in realtime? Maybe limit orders will perform better.

                            Comment


                              #59
                              Originally posted by mon4not View Post
                              Are you using market orders in realtime? Maybe limit orders will perform better.
                              i've tried both Limit orders and Market orders, they both prove to be disastrous in real time.

                              Backtesting is amazing, totally amazing, realtime, not good

                              Comment


                                #60
                                Originally posted by ninjamouse View Post
                                i've tried both Limit orders and Market orders, they both prove to be disastrous in real time.

                                Backtesting is amazing, totally amazing, realtime, not good
                                I completely agree with ninjamouse. Test any strategy using Renko bars with market replay first. It could save you in more ways than one.

                                RJay
                                RJay
                                NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by algospoke, Yesterday, 06:40 PM
                                2 responses
                                19 views
                                0 likes
                                Last Post algospoke  
                                Started by ghoul, Today, 06:02 PM
                                3 responses
                                14 views
                                0 likes
                                Last Post NinjaTrader_Manfred  
                                Started by jeronymite, 04-12-2024, 04:26 PM
                                3 responses
                                45 views
                                0 likes
                                Last Post jeronymite  
                                Started by Barry Milan, Yesterday, 10:35 PM
                                7 responses
                                20 views
                                0 likes
                                Last Post NinjaTrader_Manfred  
                                Started by AttiM, 02-14-2024, 05:20 PM
                                10 responses
                                181 views
                                0 likes
                                Last Post jeronymite  
                                Working...
                                X