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

code to detect first day of history of chart

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

    code to detect first day of history of chart

    Hello,

    Could you tell me how I write the following :

    if (first day of history loaded)








    Thank you
    Last edited by SARdynamite; 07-08-2010, 11:40 PM.

    #2
    SARdynamite, there's no real method for this task so here's an idea : with CurrentBar you have access to the bar index, save the date to a variable on the first chart bar (CurrentBar == 0) and then start your conditions if your current chart date is greater than this (first new day since start of the chart).
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Great. Thank you

      Comment


        #4
        Excuse me but how do you get the date of the day of the bar. Can't find it. Thanks

        Comment


          #5
          You can use ToDay() for this task - http://www.ninjatrader-support.com/H...eV6/ToDay.html
          BertrandNinjaTrader Customer Service

          Comment


            #6
            if (CurrentBar==0) d1=ToDay(Time[0]);

            gets me d1=0

            I'm on Range bars. Is that right ?

            Comment


              #7
              Works for me here, how did you define your d1 varilable? An int?
              BertrandNinjaTrader Customer Service

              Comment


                #8
                sorry, I was using if (CurrentBar<1) return; before

                works just fine

                Comment


                  #9
                  Great, should've asked about it firstplace...
                  BertrandNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by mattbsea, Today, 05:44 PM
                  0 responses
                  3 views
                  0 likes
                  Last Post mattbsea  
                  Started by RideMe, 04-07-2024, 04:54 PM
                  6 responses
                  31 views
                  0 likes
                  Last Post RideMe
                  by RideMe
                   
                  Started by tkaboris, Today, 05:13 PM
                  0 responses
                  2 views
                  0 likes
                  Last Post tkaboris  
                  Started by GussJ, 03-04-2020, 03:11 PM
                  16 responses
                  3,282 views
                  0 likes
                  Last Post Leafcutter  
                  Started by WHICKED, Today, 12:45 PM
                  2 responses
                  20 views
                  0 likes
                  Last Post WHICKED
                  by WHICKED
                   
                  Working...
                  X