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

Buy Sell Pressure Indicator Used with OnBarUpdate

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

    Buy Sell Pressure Indicator Used with OnBarUpdate

    I am developing a strategy using the Buy/Sell Pressure indicator which is an ontickupdate indicator. I want the strategy to place an order at the end of bar. Can you give/point me to me a snippet of code to show how to use both ontickupdate and onbarupdate at the same time?

    Thanks

    #2
    Hello cpabiz20k,

    This can be done by triggering the order in a condition that requires IsFirstTickOfBar to be true.

    The help guide has example code.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks Chelsea - I am not quite sure what to do with this...I think the main issue is that the indicator always shows 50 at the beginning of every bar. We tested and it also shows 50 for the previous bar's value. Our strategy needs to track the value of the buy sell pressure from the prior candle. Is there a way to get the true value of the buy sell pressure indicator from the previous candle?

      Comment


        #4
        Hello cpabiz20k,

        By using a barsAgo value?
        BuySellPressure().BuyPressure[1]

        Are you talking historical or real-time?

        Is TickReplay on?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          I checked and I do have the TickReplay on...I have tried both market replay and live. Can I send you the sample code and ask you to look at it for me?
          Thanks

          Comment


            #6
            Hello cpabiz20k,

            Add the indicator to the chart with AddChartIndicator().

            Are you seeing the values you are printing do not match the indicator that appears on the chart?

            Are you calling Update() to ensure the values are up to date in the indicator?

            I am not able to reproduce this behavior.

            Attached is the test script and a screenshot of the output on my end compared with the DataBox from the chart with the mouse over that particular bar.
            Attached Files
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              That worked perfectly. I was missing several small things related to isfirsttick. Thanks - Your help is much appreciated!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by The_Sec, Yesterday, 03:37 PM
              1 response
              11 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by vecnopus, Today, 06:15 AM
              0 responses
              1 view
              0 likes
              Last Post vecnopus  
              Started by Aviram Y, Today, 05:29 AM
              0 responses
              5 views
              0 likes
              Last Post Aviram Y  
              Started by quantismo, 04-17-2024, 05:13 PM
              3 responses
              27 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by ScottWalsh, 04-16-2024, 04:29 PM
              7 responses
              36 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Working...
              X