Announcement

Collapse
No announcement yet.

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 Hwop38, 05-04-2026, 07:02 PM
        0 responses
        164 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        318 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        246 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        350 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        179 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X