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

Help! How to call the current price value

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

    Help! How to call the current price value

    Hello, please tell me how I can call the current price value and compare it for example with the opening price?

    #2
    Hello Papercut110,

    Thank you for your note.

    Could you please clarify in more detail what you're looking to do so I can better direct you? If you are looking just to reference the values you could use the Market Analyzer to display them under Control Center>New>Market Analyzer. Or you could use the Strategy Wizard to build a condition/strategy under the Control Center>Tools>New NinjaScript>Strategy.

    See Market Analyzer Youtube:
    Download NinjaTrader FREE at http://www.ninjatrader.comThis video is a recording of our live "Market Analyzer" webinar covering the topics:4:59 – Connect to ...


    For the Strategy Wizard:

    In Strategy Wizard, after pressing next you would want to name the strategy and set CalculateOnBarClose to False, so that Close[0] would equal the last price. Click next next, then under Conditions and Actions, "When the following conditions are true"">Add.

    This is where you could compare the Close (Current price) against the Open using the various operators in the middle.

    See Strategy Wizard Youtube:
    Understand the fundamentals of basic strategy creation by developing an actual strategy using the NinjaTrader Strategy Wizard.3:23 Strategy Wizard Overview7:...


    I look forward to you're reply.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      NinjaTrader_AlanP, did I understand you correctly, if I use CalculateOnBarClose = False then "Close[0]" will use the current price, but not the one which closed bar?? I'm sorry, my language is lame

      Comment


        #4
        Hello Papercut110,

        If you set CalculateOnBarClose=False, your conditions are going to be evaluated with each incoming tick and Close[0] is going to represent the current price until the bar closes.

        See CalculateOnBarClose section of our Helpguide:


        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          NinjaTrader_AlanP, many thanks, helped

          Comment


            #6
            What about Calculate.OnBarClose

            How would I access the current price of the instrument if the strategy has been set to Calculate.OnBarClose? Close[0] would only give the price of the close of the completed bar, not of the current bar.

            Comment


              #7
              Hello fisbo,

              If calculate was set to OnBarClose you could access the last price in OnMarketData,


              Please let us know if you need further assistance.
              Alan P.NinjaTrader Customer Service

              Comment


                #8
                GetCurrentAsk and GetCurrentBid

                When OnBarClose is True, I can still access GetCurrentAsk() and GetCurrentBid(). It is surprising for me that both these functions are available but something like: GetCurrentPrice() is not! And I have use OnMarketData() just to get the current price! Anyway, thank you for the earlier answer, it certainly helped

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by tsantospinto, 04-12-2024, 07:04 PM
                4 responses
                61 views
                0 likes
                Last Post aligator  
                Started by michi08, 10-05-2018, 09:31 AM
                3 responses
                740 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by sightcareclickhere, Today, 01:55 PM
                0 responses
                1 view
                0 likes
                Last Post sightcareclickhere  
                Started by Mindset, 05-06-2023, 09:03 PM
                9 responses
                258 views
                0 likes
                Last Post ender_wiggum  
                Started by Mizzouman1, Today, 07:35 AM
                4 responses
                18 views
                0 likes
                Last Post Mizzouman1  
                Working...
                X