• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to get Open value on new candle

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

    How to get Open value on new candle

    Hello,

    on this screen http://prntscr.com/obr8hk I need to get value of openning candle on which I place long market order - price is 7775.00

    I use multitimeframe strategy.

    CurrentBars[0] - visible chart 2 minute
    CurrentBars[1] - chart 2 minute
    CurrentBars[2] -1 tick for very smooth trades handing

    I duplicated data [0] to [1] - for testing on tick data and keeping behaviour.
    Problem is when new candle opens -> i wait fort BarsInProgress = 2 a try to get Opens[2][0], also tried Closes[2][0] - and still get no value 7775 but close of previous candle 7774,5

    Am i missing something?

    Thanks for advices
    P. Kujal

    #2
    I use Calculate.OnBarClose and try to get Open on IsFirstTickOfBar which should not do any bad.. should it?

    Comment


      #3
      Hello kujista,

      To confirm, you are wanting the Open of the most recently fully closed bar on another series?

      What are you comparing to know that this is not the value you are getting?

      When Calculate is OnBarClose, IsFirstTickOfBar will always be true because the script is not checking individual ticks of the bar.
      https://ninjatrader.com/support/help...ttickofbar.htm

      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        I am trying to get open of newly opened candle on barsinprogress = 2, which i supposed is close of barsinprogress = 1, see the picture and price i get. It is close of recently closed candle and i need open of actual. I hope i do not have to switch to calculate.oneachtick. I see the isfirsttickofbar is useless when using onbarclose

        Comment


          #5
          Hello kujista,

          If you are wanting values from an open bar, you would need to use Calculate .OnEachTick. In historical TickReplay must also be enabled.

          Below are links to the help guide on Calculate, TickReplay, and how bar information is accessed.
          https://ninjatrader.com/support/help.../calculate.htm
          https://ninjatrader.com/support/help...ick_replay.htm
          https://ninjatrader.com/support/help...ick_replay.htm
          https://ninjatrader.com/support/help...taIsReferenced
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            ok i see that i have to optimize strategy using isfirstickofbar.. to minimize consumption. i also want to minimize cpu load on calculatin indicators inside strategy how does it work? do the indicators in strategy calculate oneachtick and if so how can i force them to calculate onbarclose.. i am still thinking about performance i use multiframes and more indicators and i have to minimize cpu load. thanjs for the tips

            Comment


              #7
              Hello kujista,

              The hosted indicators will use the same Calculate mode as the host strategy.
              This is necessary and should not be changed.

              In the indicator, you can also code for logic to occur only if IsFirstTickOfBar is true.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                thank you for explanation so indicator is called on each incoming tick of dataseries, which indicator uses inside strategy?

                Comment


                  #9
                  Hello kujista,

                  When you mention "which indicator uses inside strategy", are you asking which indicators can be called from a strategy?

                  Pretty much any indicator with plots (or updated public properties) can be called from a strategy.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    i meant, when i add into strategy indicator e. g. trend(inputs[2]), it will calculate indicator value on each incoming tick of inputs[2].. so i have to use if isfirstickofbar in indicator to optimize performance?

                    Comment


                      #11
                      Hello kujista,

                      If the Strategy is using Calculate .OnEachTick, or .OnPriceChange, the indicators will also be using that Calculate setting.

                      If you want actions to only occur on the first tick of a bar in any called indicator, add to the condition for that action IsFirstTickOfBar.
                      Chelsea B.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by dltharpe, Today, 09:17 AM
                      0 responses
                      4 views
                      0 likes
                      Last Post dltharpe  
                      Started by HiddenPhilosopher, Today, 06:45 AM
                      0 responses
                      6 views
                      0 likes
                      Last Post HiddenPhilosopher  
                      Started by PG7940, Today, 04:26 AM
                      0 responses
                      10 views
                      0 likes
                      Last Post PG7940
                      by PG7940
                       
                      Started by marcus2300, Today, 02:25 AM
                      0 responses
                      2 views
                      0 likes
                      Last Post marcus2300  
                      Started by drpapp, 01-24-2019, 06:57 AM
                      5 responses
                      69 views
                      0 likes
                      Last Post pjsmith
                      by pjsmith
                       
                      Working...
                      X