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

Using input from higher timeframe

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

    Using input from higher timeframe

    Hi.

    I have put together a simple indicator for me that colors a 1min candle when the LinReg4 of a higher time frame is rising or falling. It works but unfortunately too late. With that I mean the 1min candle seems to read the 5min LinReg4 condition only when the 5minutes are up and not when it is in progress. Hope this makes sense. To illustrate this point I have attached a chart image and circled the candles where I would expect a colored candle. Also included in the image is the code I use.

    Perhaps someone could review this simple code and advise what I need to change to produce the result I want.

    sandman
    Attached Files

    #2
    Hello sandman,

    With CalculateOnBarClose (COBC) set to false your indicator will run while the bars are being formed but one thing to keep in mind is that when you first apply the indicator when all of your calculations are done Historically it will be processed like COBC is set to true since Historical we will only know the Open, High, Low, Close and not any intrabar data.

    With that said, since you are calling this within BarsInProgress == 0, you may get this late since the BarsInProgres 1 is not going to be updated yet Historically.

    Do you get what you expect while running your Indicator in real time?

    Happy to be of further assistance.
    JCNinjaTrader Customer Service

    Comment


      #3
      Thanks JC. I do not get what I expect when running this indicator in real time, which is when I need it the most .

      So is there anything I could twist with the BarsInProgress != 0 that would get me what I want?
      Or did I misread what you stated and you in fact are already suggesting to change it to
      BarsInProgress == 0

      NB: I am not a coding wizzard - yet!
      sandman

      Comment


        #4
        Hello sandman,

        This means that either the logic needs to be changed or you may not be getting the values that you expect.

        Could you clarify what you are looking for your indicator to do?

        From the image it appears that you are looking for a the Close to be greater than the Open of the 1 Minute Bar and the LinReg of a 4 period 5 Minute chart is Rising before changing the bar color to Lime.

        Happy to be of further assistance.
        JCNinjaTrader Customer Service

        Comment


          #5
          Hello JC.

          Thks. Yes, what you said is what I am looking for the indicator to do:
          "From the image it appears that you are looking for a the Close to be greater than the Open of the 1 Minute Bar and the LinReg of a 4 period 5 Minute chart is Rising before changing the bar color to Lime."

          Or in my words, I want the indicator (loaded on a 1Min DataSeries) to check if the LinReg of a period 4 5Minute DataSeries to be rising and then also if the Close is greater than the Open of the 1Min Bar, then go ahead and color the bar Lime. If that is not the case do not color the bar.

          Do you have any further suggestion?

          sandman

          Comment


            #6
            Hello sandman,

            All of your conditions are being hit correctly as far as I can tell. I have attached a sample indicator of your conditions and Print out some values that may help show how things are being processed.

            If Close > Open and LinReg is rising it will change the bar color to purple and when Close > Open but LinReg is not rising it will change the bar color to Black.

            To see all of the Print() variables you may open up the Output Window by going to Tools menu.

            Let me know if this helps clear things up.
            Attached Files
            JCNinjaTrader Customer Service

            Comment


              #7
              JC - thanks for your work on this and help. I will use it during tomorrow's real live market moves to see if it reacts the way I would like it. It's a bit too late now. Will let you know.

              sandman

              Comment


                #8
                JC.

                I watched the indicator in Friday's live market and it worked just fine. But when using it on historic data it does not always show. That was the big difference - as you had already pointed out and which I had not understood then but do now.

                Thanks for your help!

                sandman

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by inanazsocial, Today, 01:15 AM
                0 responses
                1 view
                0 likes
                Last Post inanazsocial  
                Started by trilliantrader, 04-18-2024, 08:16 AM
                5 responses
                22 views
                0 likes
                Last Post trilliantrader  
                Started by Davidtowleii, Today, 12:15 AM
                0 responses
                3 views
                0 likes
                Last Post Davidtowleii  
                Started by guillembm, Yesterday, 11:25 AM
                2 responses
                9 views
                0 likes
                Last Post guillembm  
                Started by junkone, 04-21-2024, 07:17 AM
                9 responses
                70 views
                0 likes
                Last Post jeronymite  
                Working...
                X