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

Need some help with FirstTickOfBar

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

    Need some help with FirstTickOfBar

    Hello,

    I wrote that code and used it with Market Data replay as of January, 26; although it plots as expected outside the timespan of that particular trading day, it always plots the same colour during the replay.

    I welcome any help.

    Gerard

    Code:
            protected override void Initialize()
            {
                CalculateOnBarClose	= false;
                Overlay				= false;
                PriceTypeSupported	= false;
            }
    
            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
    			if (FirstTickOfBar)
    			{
    			if (Close[0] > Open[0])
    				BackColor = Color.Blue;
    			else
    				BackColor = Color.Yellow;
    			}
    		}
    Attached Files

    #2
    Gerard, are you saying that, when played on a Market Replay, FirstTickOfBar doesn't work correctly? FirstTickOfBar is generally used to reset variables and such, not as a marker to set drawing properties.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Wel, thanks for sharing this.

      I have a 15 minutes candlestick chart which I "backcolour" PaleGreen when the candlestick is green and LightPink when the candlestick is red.
      Having set CalculateOnBarClose to false, I wish to check out on a tick basis whether the previous one or couple of candlesticks were green or red.
      Do you have any clue to do so ?

      Gerard

      Comment


        #4
        Since green = an up candle and red = a down candle, test for that. To test the previous candle:

        if(Close[1] > Open[1]) //if true it was a green candle


        if(Close[1] < Open[1]) //if true it was a red candle


        Then you are left with the doji situation: Close[1] = Open[1]

        I don't understand the tick by tick basis check because previous candles will not change. The only one that will be changing with ticks is the current candle, which can be tested the same way.

        Dan
        Last edited by eDanny; 02-22-2010, 08:22 AM.
        eDanny
        NinjaTrader Ecosystem Vendor - Integrity Traders

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by gravdigaz6, Today, 11:40 PM
        0 responses
        4 views
        0 likes
        Last Post gravdigaz6  
        Started by MarianApalaghiei, Today, 10:49 PM
        3 responses
        9 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by XXtrader, Today, 11:30 PM
        0 responses
        3 views
        0 likes
        Last Post XXtrader  
        Started by love2code2trade, Yesterday, 01:45 PM
        4 responses
        28 views
        0 likes
        Last Post love2code2trade  
        Started by funk10101, Today, 09:43 PM
        0 responses
        9 views
        0 likes
        Last Post funk10101  
        Working...
        X