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

Where can i find this data ?

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

    Where can i find this data ?

    Hello,
    i need the data of the open price on the start of the new market-day (session). Not the pre-market for ex.
    Also the previous market-day close data.
    Where can i find them on NT ?

    #2
    mate,

    I am happy to assist you.

    You can use CurrentDayOHL() and PriodDayOHLC() to get these values.

    Please find a link to the help guide entries here :

    CurrentDayOHL : http://www.ninjatrader.com/support/h...nt_day_ohl.htm

    PriorDayOHLC : http://www.ninjatrader.com/support/h...r_day_ohlc.htm

    Please let me know if I may assist further.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Thanks AdamP,
      i've got it, was not the problem.
      The problem is to get the LAST price (in the bar) wich could be the currentBid or the currentAsk or any between them.
      Last edited by mate41; 12-09-2011, 10:09 AM.

      Comment


        #4
        mate,

        GetCurrentBid() and GetCurrentAsk() get you the bid and ask for the most current tick. This will not be the open at the start of the market day unless you are checking that you are on the first tick at the beginning of the session.

        GetCurrentBid() Returns a double value representing the current bid price. Note: When accessed during a historical backtest, the close price of the evaluated bar is substituted.
        Adam P.NinjaTrader Customer Service

        Comment


          #5
          Sorry AdamP,
          what i mean exactly is the "last executed price within||begin||end the last bar" .
          This price vary between or at the currentbid or currentask.

          Could it be the "currentprice" ?
          Last edited by mate41; 12-09-2011, 10:23 AM.

          Comment


            #6
            mate,

            GetCurrentBid() and GetCurrentAsk() will get the very most current ask/bid no matter what historical bar its on when calculating the indicator. It is updating every tick.

            Close[0] should be the last executed price of the previous bar. If calculate on bar close is set to false, then Close[1] is it, and Close[0] is the most current price.
            Adam P.NinjaTrader Customer Service

            Comment


              #7
              Thanks, i understood now; the close[0] is of course the last price of every tick.
              I'm stuck with the following code:
              Code:
              if (Close[0]>Open[0] ) dir=" Up";
              sess_Open = PriorDayOHLC().PriorClose[0];
              cur_Ask = GetCurrentAsk();
              cur_Bid = GetCurrentBid(); 
              change_Net = Close[0] - sess_Open;
              change_Per = change_Net * 100 / sess_Open;
              
              [B]// the plotted data is wrong here[/B]
              DrawTextFixed("Str_1","Chg  : "+""+change_Net.ToString("F")+dir +" B="+cur_Bid.ToString("F")+" A="+cur_Ask.ToString("F")+" Chg%: "+change_Per.ToString("F")+"%" , TextPosition.TopRight, Color.Red, textFont1, Color.Black,Color.Yellow,5);
              
              [B]//the plotted data is perfect here[/B]
              DrawTextFixed("Str_1","Chg  : "+"+"+change_Net.ToString("F")+dir+" B="+cur_Bid.ToString("F")+" A="+cur_Ask.ToString("F")+" Chg%: "+change_Per.ToString("F")+"%", TextPosition.TopRight, Color.Green, textFont1, Color.Black,Color.Yellow,5);
              The first DrawTextFixed plot negative numbers, ticker is down.
              Last edited by mate41; 12-09-2011, 12:03 PM.

              Comment


                #8
                mate,

                This line :

                Code:
                change_Net = Close[0] - sess_Open;
                Could generate negative numbers. If you want positive numbers please use the following format.

                Code:
                change_Net = Math.Abs(Close[0] - sess_Open);
                This is the "Absolute value". It takes any negative numbers and makes them positive, and keeps positive numbers positive.

                Please let me know if I may assist further.
                Adam P.NinjaTrader Customer Service

                Comment


                  #9
                  AdamP,
                  i don't know what happen exactly, i have always a difference of 7 points between the real quote and the plotted.
                  Only on the bearish side, not the bullish.
                  For ex. real: -1.30, plotted -1.37.
                  Here is the indicator ( not properly done ).
                  Attached Files

                  Comment


                    #10
                    mate,

                    Im currently unable to replicate this behavior using futures/forex. What instrument are you using?
                    Adam P.NinjaTrader Customer Service

                    Comment


                      #11
                      AdamP,
                      it's a stock, transocean RIG.

                      Comment


                        #12
                        mate41,

                        Which parameter is off? Is it, Chg, B, A, Chg% ?
                        Adam P.NinjaTrader Customer Service

                        Comment


                          #13
                          AdamP,
                          the Chg and the Chg% indication is wrong. There is a difference of 0.07 on the Chg with the real quotation and of course the calculated Chg% is wrong that way.
                          The A and B are as it should be.
                          This occurs only on a bearish trend; on a bullish trend there are no problems and can't be better.
                          That's why i don't understand how this can be possible.
                          Last edited by mate41; 12-10-2011, 07:56 AM.

                          Comment


                            #14
                            accumulated bid vs ask orders in a bar.

                            How can i get the accumulated bid/ask per bar info to show when i press my mouse wheel over the bar and the o/h/l/c/time data box shows?

                            Comment


                              #15
                              mate, I would recommend using the Print() function to print out the values of all your variables to see where the error is occurring:

                              Code:
                              Print("cur_bid: " + cur_bid.ToString() + " cur_ask: " + cur_ask.ToString() + " sess_open: " + sess_Open.ToString())
                              
                              
                              if ( Str_1 == "Bearish" )    // the "F" on .ToString is a format of 2 digits after . ex: 0.00
                                      DrawTextFixed("Str_1","Chg  : "+""+change_Net.ToString("F")+dir +" B="+cur_Bid.ToString("F")+" A="+cur_Ask.ToString("F")+" Chg%: "+change_Per.ToString("F")+"%" , TextPosition.TopRight, Color.Red, textFont1, Color.Black,Color.Yellow,5);
                              else if ( Str_1 == "Bullish" )
                                       DrawTextFixed("Str_1","Chg  : "+"+"+change_Net.ToString("F")+dir+" B="+cur_Bid.ToString("F")+" A="+cur_Ask.ToString("F")+" Chg%: "+change_Per.ToString("F")+"%", TextPosition.TopRight, Color.Green, textFont1, Color.Black,Color.Yellow,5);
                              else 
                                        DrawTextFixed("Str_1", "Chg  : "+change_Net.ToString("F")+dir + cur_Bid.ToString("F") + "\nChg%: "+change_Per.ToString("F")+"%", TextPosition.TopRight, Color.Blue, textFont1, Color.Black,Color.Yellow,5);
                              Tangerine, this would require code that is not supported by NinjaTrader. You would have to write an indicator to keep track of the accumulated bids and asks and then call that using some mouse wheel function.
                              AustinNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Max238, Today, 01:28 AM
                              2 responses
                              26 views
                              0 likes
                              Last Post NinjaTrader_ChristopherJ  
                              Started by Shansen, 08-30-2019, 10:18 PM
                              25 responses
                              949 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by JonesJoker, 04-22-2024, 12:23 PM
                              8 responses
                              41 views
                              0 likes
                              Last Post JonesJoker  
                              Started by timko, Today, 06:45 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post timko
                              by timko
                               
                              Started by Waxavi, 04-19-2024, 02:10 AM
                              2 responses
                              39 views
                              0 likes
                              Last Post poeds
                              by poeds
                               
                              Working...
                              X