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

indicator on tick history

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

    indicator on tick history

    hi
    how to express the value of tick in script
    i used
    if (Close[CurrentBar] > Close[CurrentBar-1])
    but it is not correct
    is this certaian price type to express tick value and volume and time

    #2
    nellymnumberingstringseries.Set("m" + m.ToString());
    i need to put this value in the previous place of data string
    can i use
    nellymnumberingstringseries.Set(1,"m" + m.ToString());
    coz i tried this but didnt give value to string series on watch
    also how to add watch to show value of previous slot of data series during debugging

    Comment


      #3
      Originally posted by ahmedallam View Post
      hi
      how to express the value of tick in script
      i used
      if (Close[CurrentBar] > Close[CurrentBar-1])
      but it is not correct
      is this certaian price type to express tick value and volume and time
      If u want process data tick by tick this code is correct for 1 tick chart only.
      On others chart types u should use this code

      Code:
              protected override void Initialize()
              {
                  CalculateOnBarClose = false;
              }
      
              protected override void OnBarUpdate()
              {
                  // Now we got every tick processing
                  if	(Close[CurrentBar] >  Close[CurrentBar-1])             
                  {
                  }
              }

      Comment


        #4
        (Close[CurrentBar] > Close[CurrentBar-1])
        first expression Close[CurrentBar] is just the one understood by script
        but the second one Close[CurrentBar-1] give same result as the first one
        close just work well when i give it numbers only
        close[0].....close[1] respectivly
        strange feature i think

        Comment


          #5
          Hello ahmedallam,

          Thanks for your post.

          As member ren37 advised, using CalculateOnbarClose = false will allow you to process tick by tick but this would be on live data only (From a live data feed or market reply).

          When using Close[] the index reference[] is to "bars ago". So an index of [0] would mean the currently forming bar on the right edge, while [1] refers to the prior bar, [2] the bar before that, etc.

          CurrentBar is a variable that holds the count of bars on the chart. If you have 1000 bars then CurrentBar would hold the value of 1000. If you use Close[CurrentBar] then the close value would be from 1000 bars ago.

          references:

          Paul H.NinjaTrader Customer Service

          Comment


            #6
            thanks for ur reply
            ı benefıted much from ıt
            but new questions arise
            close [the index ref]>>does this reference have to be number only??
            can i use a variable to int or double or float?
            can i use expression like close[a-b]???
            and afterwards can i use certain index to get data from other dataseries on the same bar>>>>>meaning can i make say 4 data ..string..bool..float series and use the index reference in one of them to get to other series and get data at this specefic index????

            Comment


              #7
              Hello ahmedallam,

              Thanks for your reply.

              If you check the Helpguide reference for Close you will see that the BarsAgo is to be an int value. You can perform any math inside the index [] you wish as long as it resolves to a legitimate barsago value. Yes, you can use a variable in the index. Yes, you can use the same reference in other methods, for example:

              int signal = 4;

              int signalHigh = High[signal]; // get high 4 bars ago
              int signalLow = Low[signal - 1]; // get the low 3 bars ago
              int signalRange = Range()[Signal + 1]; Get the range of the bar 5 bars ago
              Paul H.NinjaTrader Customer Service

              Comment


                #8
                thanks alot for ur reply
                ı ll try then ı hope not to bother u

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by knowmad, Today, 03:52 AM
                0 responses
                17 views
                0 likes
                Last Post knowmad
                by knowmad
                 
                Started by tradingnasdaqprueba, Today, 03:42 AM
                0 responses
                13 views
                0 likes
                Last Post tradingnasdaqprueba  
                Started by Haiasi, 04-25-2024, 06:53 PM
                4 responses
                63 views
                0 likes
                Last Post effraenk  
                Started by ccbiasi, 11-23-2017, 06:06 AM
                5 responses
                2,213 views
                0 likes
                Last Post leodavis  
                Started by kujista, Yesterday, 12:39 AM
                2 responses
                14 views
                0 likes
                Last Post kujista
                by kujista
                 
                Working...
                X