Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Display the pips between high and low within a specific period

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

    Display the pips between high and low within a specific period

    I want to display the pips between high and low within a specific period.

    For example trying to display the pips for Forex from 8PM to 10PM EST. And have this number display on the chart within that period for everyday.

    Any idea on how to do it?

    thanks.

    #2
    Hi, have you already checked into this reference sample? > http://www.ninjatrader-support2.com/...ead.php?t=8600
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Yes i took a look at it just now.

      Are they already inside the current build or they are new indicator as of now since its 1 year ago?

      Comment


        #4
        These are reference samples not in the default installation. You can see all of them here - http://www.ninjatrader-support2.com/...splay.php?f=30

        Our NinjaScript tips are located here - http://www.ninjatrader-support2.com/...splay.php?f=31
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Pips only

          Did you manage to display the pips by themselves? How did you get it working in the end?

          Sp

          Comment


            #6
            Sp, did you check into the reference sample below ? You could for example take the difference of the found HighestHigh / LowestLow for the Period and then use DrawTextFixed to display it -

            BertrandNinjaTrader Customer Service

            Comment


              #7
              just the pips for a point in time

              Thanks Bertrand, although I was more after how to capture just the pips at a point in time, and how to evaluate if it is between a range?

              for triggering a buy action if the price hits 90pips, at multiple price levels,

              so it would buy at 1.4890, 1.4990, 1.5090

              Is there anyway to reference the absolute pip value directly?

              maybe like this?

              if (CrossAbove(Close[1], 90 * Ticksize, 1))
              EnterLong();




              Thanks,

              Sp
              Last edited by sparhawk; 02-05-2010, 11:19 AM.

              Comment


                #8
                I think I've found it.

                Bars.TickCount

                Print("The tick count of the current bar is " + Bars.TickCount.ToString());

                I want to buy if the current bar tickcount (value) is above 90

                if (CrossAbove(bars.tickcount, 90, 1))
                EnterLong();

                Could you please confirm that this is correct?

                while searching I also found
                getTickValue on google - I couldnt find it in Ninjascript documentation, is this function present in NT?

                Comment


                  #9
                  sparhawk, unfortunately not aware of how the getTickValue function you found on Google relates to NinjaScript.

                  I don't think the tickcount is what you need, as this will just give you the ticks counted of the developing bar - http://www.ninjatrader-support.com/H...TickCount.html
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    ticks/pips?

                    thanks for the reply Bertrand.

                    I'm getting confused, by ticks, do you mean pips? i.e. for a stock, a value between 0 & 100, and for a currency pair between 0 & 1000 (depending on ticksize)

                    if bars.tickcount won't work, I've tried the following:

                    p.s. I'm using this to develop a strategy for backtesting:

                    The following code is not working, any idea why?

                    // Condition set 1
                    if (CrossAbove(TickCounter(), 90, 1))
                    {
                    EnterLong(DefaultQuantity, "");
                    }

                    // Condition set 2
                    if (CrossAbove(TickCounter(), 10, 1))
                    {
                    EnterShort(DefaultQuantity, "");
                    }

                    Ive tried increasing the lookback period, using the tickcounter as a function of the close price - offset, tried == and >= instead of crossabove.

                    The data i'm testing is fine and works when backtesting against SampleMAcrossover on tick and minute timeframes...

                    Comment


                      #11
                      sparhawk, this will not work, as it the tickCount and tickCounter do not isolate the last 2 digits of price as you think....you would need to convert the price into a string and then use the various string manipluation techniques available to isolate those out to be able to trigger signals on that.

                      BertrandNinjaTrader Customer Service

                      Comment


                        #12
                        Parameter variables?

                        Thanks, I've managed to cobble something together, how do I add the variables as parameters?

                        I'd like to be able to choose them when backtesting and also be able to optimise them?

                        // This namespace holds all strategies and is required. Do not change it.
                        namespace NinjaTrader.Strategy
                        {
                        /// <summary>
                        /// Simple Tick Based Entry & Exit strategy.
                        /// </summary>
                        [Description("Simple Tick Based Entry & Exit strategy.")]
                        public class TickCount4 : Strategy
                        {
                        #region Variables
                        private int Entrylevel = 7;
                        private int Exitlevel = 2;


                        #endregion

                        /// <summary>
                        /// This method is used to configure the strategy and is called once before any strategy method is called.
                        /// </summary>
                        protected override void Initialize()
                        {

                        CalculateOnBarClose = true;
                        }

                        /// <summary>
                        /// Called on each bar update event (incoming tick).
                        /// </summary>
                        protected override void OnBarUpdate()
                        {


                        System.Text.StringBuilder pricestr = new //Creates a buffered variable
                        System.Text.StringBuilder(); //"


                        pricestr.Append(Close[0].ToString()); //inserts the price of current bar in the string
                        Print(pricestr.ToString()); // Prints the price

                        string ts = TickSize.ToString(); //Creates a string called ts and puts the ticksize into it
                        int tsl = ts.Length-2; //Measures & Re-calibrates the ticksize length
                        int pricelen = pricestr.Length -tsl; // pricelen is the no. of characters to start in from the pricestr,
                        // in order to capture the last two digits (ticks)

                        //Print(tsl.ToString()); // Gives the ticksize length.
                        //Print(pricestr.Substring(pricelen, tsl)); //Prints the tick value

                        int ticks = int.Parse(pricestr.ToString(pricelen, tsl)); //changes the price string to a 2 digit integer which are the ticks
                        Print(ticks.ToString("F2")); //Shows the tick value.
                        if (ticks > Entrylevel)
                        {
                        EnterLong(DefaultQuantity, "");
                        Print("BUYBUYBUYBUYBUBYBUBYBU");
                        }

                        if (ticks < Exitlevel)
                        {
                        EnterShort(DefaultQuantity, "");
                        }
                        }


                        }
                        }

                        Comment


                          #13
                          sparhawk, to have variables accessable from the backtester, there are a few steps you must take. You already have the variables declared in the variables section and the next step is to create a bit of code in the Properties section of your NinjaScript like this (assuming your variable name is fast):
                          Code:
                          // somewhere in the variables section
                          private int fast = 11;
                          
                          // down below in the properties section
                          [Description("Period for fast MA")]
                          [Category("Parameters")]
                          public int Fast
                          {
                              get { return fast; }
                              set { fast = Math.Max(1, value); }
                          }
                          That will make the private variable "fast" public so you can use it and set it in other parts of the application.
                          AustinNinjaTrader Customer Service

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by RookieTrader, Today, 09:37 AM
                          3 responses
                          15 views
                          0 likes
                          Last Post NinjaTrader_ChelseaB  
                          Started by kulwinder73, Today, 10:31 AM
                          0 responses
                          6 views
                          0 likes
                          Last Post kulwinder73  
                          Started by terofs, Yesterday, 04:18 PM
                          1 response
                          24 views
                          0 likes
                          Last Post terofs
                          by terofs
                           
                          Started by CommonWhale, Today, 09:55 AM
                          1 response
                          4 views
                          0 likes
                          Last Post NinjaTrader_Erick  
                          Started by Gerik, Today, 09:40 AM
                          2 responses
                          7 views
                          0 likes
                          Last Post Gerik
                          by Gerik
                           
                          Working...
                          X