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

How to call the daily open ES

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

    How to call the daily open ES

    Hi,

    i know that the S&P 500 future (ES) is quoting 24/24h, when i look at the chart on daily from my provider (CQG) i have the daily chart with the quotation of the NY's pit (from 9 am to 6 pm or something like that)

    if a want a daily chart 24/24h i put the chart on 1440 minutes.

    My question is :
    in my script, i would like to call the daily open of today.

    if i call CurrentDayOHL().CurrentOpen[0] i get the open of midnight of the current day, not the one of 9am NY times.

    If i call Bars.GetDayBar(0).Open it is not working (i think the code is wrong).

    If i call Opens[1][0] (with Add (PeriodType.Day,1); on the Initialize) it call the open of yesterday.

    So, how to call the daily open of NY pit sent by CQG that i see on daily chart ?

    I you can help.
    Thx

    #2
    Hello Thomas79,

    Thank you for your post.

    You can use ToTime and check for the 9 AM bar and it's open:
    Code:
    			if(ToTime(Time[0]) == ToTime(9,0,0))
    				Print(Open[0]);
    For information on ToTime() please visit the following link: http://www.ninjatrader.com/support/h...nt7/totime.htm

    Please let me know if I may be of further assistance.

    Comment


      #3
      Thx for the reply but, when i call the Open[0] in my condition like that

      if (Open[0] < Closes[1][0] - 10*TickSize) it takes all the Open[0] below the Closes[1][0] - 10*TickSize from the beginning of the day (midnight), like if the time condition doesn't work... if on the time condition i write if (ToTime(Time[0]) == ToTime(25,0,0)) on hour does not exist, the script do the same thing.

      Basically i'm in Paris and the ES opens at 15:30, so i tryed if (ToTime(Time[0]) == ToTime(15,30,0)) but nothing changed

      Comment


        #4
        Hello Thomas79,

        May I review the full script? If so, please attach the file to your response or to an e-mail to support[at]ninajtrader[dot]com with 'ATTN: Patrick - 1052699' in the subject line and a reference to this thread int eh body of the e-mail: http://www.ninjatrader.com/support/f...ad.php?t=65237

        You will find the script in the following directory on your PC: (My) Documents\NinjaTrader 7\bin\Custom\Indicator or Strategy.

        Comment


          #5
          HI Patrick, please find enclosed my script, i run it in 5 minutes and on the ES Future

          my problem is to call the open of 15:30:00 in my condition (i run the script on ES future and this is the open time from Paris where i am), i want to verify that the open at 15:30:00 is below the yesterday close - 0.50* ATR(BarArray[1],10)[0], the second line of my condition...

          i write Open[0] < Closes[1][0] - 0.50 * ATR(BarsArray[1], 10)[0] but i don't want to call all the Open[0], only the Open of 15:30:00, not before and not after

          can you help ?
          thx

          Attached Files

          Comment


            #6
            Hello Thomas79,

            Thank you for your response.

            The Time condition and your condition need to be together:
            Code:
            			if(ToTime(Time[0]) == 153000 && RSI(BarsArray [1], 14, 3).Avg[0] > 50
            				&& Opens[0][0] < Closes[1][0] - 0.50 * ATR(BarsArray[1], 10)[0])			
            				
            								
            				{
            					entryOrder = EnterLongStop(0,true, 1, Closes[1][0], "Testpage15");	
            					
            					DrawLine("Open" + CurrentBar.ToString(),false, 10, Open[0], 0, Open[0], Color.Blue, DashStyle.Solid,2);
            				}

            Comment


              #7
              Thx for the reply, but this is not perfect.

              For example, if i have signal and my buying order is filled at 16:30 (one hour after the open at 15:30) and i'm stopped out at 17:00, the buying order is not send a second time (but the conditions are still here, the 15:30 open is still below the yesterday close), this is possible when a use the CurrentDayOHL().CurrentOpen[0]; for a market that not quote 24/24h like the FESX, this is why i put a script to limit the number of trade per days.

              i just want a solution to call the open of a specific bar time during the session... but look like impossible.

              Comment


                #8
                ok i found a solution !

                thx for your help !

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by f.saeidi, Today, 10:19 AM
                0 responses
                1 view
                0 likes
                Last Post f.saeidi  
                Started by kujista, Today, 06:23 AM
                4 responses
                14 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by traderqz, Yesterday, 09:06 AM
                2 responses
                16 views
                0 likes
                Last Post traderqz  
                Started by traderqz, Today, 12:06 AM
                3 responses
                6 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by RideMe, 04-07-2024, 04:54 PM
                5 responses
                28 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Working...
                X