Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Close - 1 sec

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

    Close - 1 sec

    How to get the "close" price 1 second ago for 5 min bar?

    #2
    Hello Alexpl,

    Thank you for your post.

    You will need to add an additional data series to your script and pull the Close[0] from this data series.

    For example:
    Code:
    Add(PeriodType.Second, 1);
    Then you would call that information with 'Closes[1][1]', which will pull the previous bar for the second data series.

    For information on using multiple instruments and intervals in your script please visit the following link: http://www.ninjatrader.com/support/h...nstruments.htm

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

    Comment


      #3
      Thanks!

      And else one, how to get best ask/bid from last bar? Can you post the example?

      Comment


        #4
        Hello Alexpl,

        Thank you for your response.

        You will use GetCurrentAsk() and GetCurrentBid().

        If you want the Ask of the 1 Second PeriodType added to your strategy you would use GetCurrentAsk(1) and GetCurrentBid(1) for the last Bid price.

        For information on Bid and Ask Methods please visit the following links:

        GetCurrentAsk(): http://www.ninjatrader.com/support/h...currentask.htm
        GetCurrentBid(): http://www.ninjatrader.com/support/h...currentbid.htm
        GetCurrentAskVolume(): http://www.ninjatrader.com/support/h...taskvolume.htm
        GetCurrentBidVolume(): http://www.ninjatrader.com/support/h...tbidvolume.htm

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

        Comment


          #5
          Originally posted by Alexpl View Post
          Thanks!

          And else one, how to get best ask/bid from last bar? Can you post the example?
          Code:
          private double AskPrice = 0;
          private double BidPrice = 0;
          Code:
          if (FirstTickOfBar)
          {
          AskPrice = GetCurrentAsk();
          BidPrice = GetCurrentBid();
          }

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          663 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          376 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          110 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          575 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          580 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X