• 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

CalculateonBarClose False and True Same Indicator

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

    CalculateonBarClose False and True Same Indicator

    Hey guys, a few questions:

    1. Is there a way to calculate on bar close and calculate every tick on same Indicator?

    IF NOT:

    Reason: I'm trying to make indicator Alert me when price "crosses below something" in real time, but then after it crosses --> I don't want it to do anything until a "Reversal Bar" Closes ----> Then after it closes, I want to be alerted when the High or Low of Reversal Bar is Broken.

    The way I have it setup, it simply Alerts when the Reversal bar begins to reverse before it even closes
    Example of Code
    Code:
    if (Close[0] > Open[0])  	//If it's an UPBar after price returns from OverSold 
    				{
    					//Hold the reversal Bar's Values
    					rHigh = High[0];
    					rLow = Low[0];
    					
    					//Alert user of Potential Reversal
    					DrawArrowUp("My UP arrow" + CurrentBar, false, 0, Low[1] - 4 * TickSize, Color.DarkCyan);

    Anyway to do this while keeping CalculateonBarCLose Set to False?

    #2
    Originally posted by ginx10k View Post
    Hey guys, a few questions:

    1. Is there a way to calculate on bar close and calculate every tick on same Indicator?

    IF NOT:

    Reason: I'm trying to make indicator Alert me when price "crosses below something" in real time, but then after it crosses --> I don't want it to do anything until a "Reversal Bar" Closes ----> Then after it closes, I want to be alerted when the High or Low of Reversal Bar is Broken.

    The way I have it setup, it simply Alerts when the Reversal bar begins to reverse before it even closes
    Example of Code
    Code:
    if (Close[0] > Open[0])      //If it's an UPBar after price returns from OverSold 
                    {
                        //Hold the reversal Bar's Values
                        rHigh = High[0];
                        rLow = Low[0];
                        
                        //Alert user of Potential Reversal
                        DrawArrowUp("My UP arrow" + CurrentBar, false, 0, Low[1] - 4 * TickSize, Color.DarkCyan);
    Anyway to do this while keeping CalculateonBarCLose Set to False?
    Yes. Use the FirstTickOfBar property and check on the index of the previous bar.
    Code:
    if (FirstTickOfBar)
    {
    rHigh = High[1]; //etc
    }
    ref: http://www.ninjatrader.com/support/h...ttickofbar.htm

    Comment


      #3
      Hello ginx10k,

      Yes, you may use what koganam has suggested for this.

      We have a reference sample that you may view how to do something like this as well at the following link.
      http://www.ninjatrader.com/support/f...ad.php?t=19387
      JCNinjaTrader Customer Service

      Comment


        #4
        Originally posted by ginx10k
        First I want to say Thanks for those references, totally awesome. However, when I placed the code
        Code:
        if(FirstTickofBar) { Do something...etc }
        It says FirstTickofBar does not exist.

        Remember I'm trying to make an indicator use this, how come It won't let me use it? is it only strategy? if so, how do I use it on Indicator Code??
        Yes, it does not exist, because C# is cAsE sEnSiTiVe. FirstTickofBar != FirstTickOfBar.
        Last edited by koganam; 05-15-2014, 08:01 PM.

        Comment


          #5
          Got it. thank you so much!!

          Comment


            #6
            Not Gettings RESULTS

            I'm just NOT getting the results I was hoping for. I've attached the indicator.
            I want an Arrow to appear when price returns from Overbought and Oversold conditions. But only if the bar that it returns on is a Reversal Bar at Close.

            So I used the if(FirstTickOfBar), and I won't get them unless I refresh the chart. What am I doing wrong?

            Please Help.

            Anyone


            Thank YOU
            Attached Files

            Comment


              #7
              Hello ginx10k,

              Taking a quick look at your code I see that you have another condition before you are drawing your arrows in you code. You are checking to see if the Close is greater than less than the Open. This is going to be evaluated different when processing real-time vs historical.

              On real-time data with CalculateOnBarClose set to false I would expect the Close price to be the same as the Open price since it is the first tick of data.

              On Historical Data, it will be a snap shot of data so it could evaluate to true. For example on a 1 Minute Chart historical data will have that 1 minute time period to evaluate to true.

              You may want to change or take out this condition when running in real-time to see if it runs more like what you would expect.

              For example you can check the previous bar for a Up or Down bar like if (Close[1] > Open[1]).
              JCNinjaTrader Customer Service

              Comment


                #8
                Okay, but what about the FirstTickOfBar function, where would I place that so that I can hold the value of the Closed Reversal bar. Or am I still not getting it? Here I'll say it in english hopefully u or someone can help translate it into Code.

                1. After the RSI Crosses Back from Overbought/OverSold, How do I make Indicator Wait until a Reversal Bar Closes before holding the Values of the High or Low of that Reversal Bar.

                2. Then I want an Entry when the Next Bar Breaks The Low/High of that Closed Reversal Bar.


                If I place the if (Close[1] > Open[1]), it'll look at the previous bar when RSI broke, but what if the Previous bar was an Upbar. I'm still interested in the Reversal bar that appears after.

                Any thoughts???

                Comment


                  #9
                  Hello ginx10k,

                  Could you give me an example of this so that I can understand it better?
                  JCNinjaTrader Customer Service

                  Comment


                    #10
                    The example is in the Indicator, I tried to make it as simple to understand as possible, u can see in the comments area. I think it's all there.

                    Comment


                      #11
                      Hello ginx10k,

                      Yes, I see the comments but I still do not fully understand what you are looking for based on what you have given me and the code/comments in your Indicator.

                      So we have covered the DrawArrow object. It is not being drawn in real-time because of the FirstTickOfBar is checked the current open (Open[0]) and close (Close[0]) which most likely are going to be the same.

                      The issue lies in what bars we are checking on the FirstTickOfBar. This is what I am not sure you are trying to check. Are you wanting to get the value of the Bar that the reversal happened on but on the first tick after the bar has closed?
                      JCNinjaTrader Customer Service

                      Comment


                        #12
                        Yes. I'm trying to get the Reversal bar AFTER it CLOSES. so I guess it'd be the Firsttick of the bar After Reversal. but Just can't get my condition written properly.

                        Basically, RSI crosses back into Average area --> Look for a Reversal Bar to Close --> Save the High and Low of the Reversal Bar in some kind of Variable --> Wait for next bar to Break Beyond the Variable --> Signal Draw Arrow and Alert User.

                        Thoughts??
                        Last edited by ginx10k; 05-16-2014, 03:32 PM.

                        Comment


                          #13
                          Figured it out!!

                          Once I finally understood what you were saying about the Calculates the Open and Close as the same thing when calculateonbarclose = false;

                          I managed to simply set a separate condition that allowed me to do what I wanted.

                          Thanks for the Help Guys!!!

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Emma1, Today, 02:42 PM
                          1 response
                          16 views
                          0 likes
                          Last Post NinjaTrader_DrewO  
                          Started by fx.practic, Today, 03:10 PM
                          1 response
                          5 views
                          0 likes
                          Last Post NinjaTrader_Jesse  
                          Started by jertrade, Today, 02:50 PM
                          2 responses
                          11 views
                          0 likes
                          Last Post jertrade  
                          Started by RedDuke, Today, 01:59 PM
                          1 response
                          19 views
                          0 likes
                          Last Post NinjaTrader_Kate  
                          Started by MarianApalaghiei, Today, 01:18 PM
                          1 response
                          16 views
                          0 likes
                          Last Post NinjaTrader_PatrickG  
                          Working...
                          X