Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

access to Kagi transition

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

    access to Kagi transition

    Hi

    using Kagi Bartypes, is there a possibility to detect the Kagi transitions (the change of coulors)?
    If not, is that the case in Ninja 8?

    Thanks

    #2
    Hello jakjak74,

    Thank you for your post.

    In NinjaTrader 7 and 8 there is no exposed value that you could call to find out if the color changed. So you would develop code that detects what the Kagi Chart Style detects.

    Below is an example of printing whether the Line is Green or Red (based on just the default values):
    Code:
        public class DetectKagiLineColorChange : Indicator
        {
    		private string KagiColor = "";
    		private double PriorPrice = 0;
    		
            protected override void Initialize()
            {
                CalculateOnBarClose = false;
            }
    		
            protected override void OnBarUpdate()
            {
    			if (CurrentBar < 1) return;
    			
    			if (FirstTickOfBar)
    			{
    				Print("");
    				Print(Time[0]);
    			}
    			
    			if (Close[0] == PriorPrice) return;
    			PriorPrice = Close[0];
    			
                if (Close[0] > Open[0])
    			{
    				if (Close[0] > Math.Max(Close[1], Open[1]))
    				{
    					KagiColor = "Green";
    				}
    			}
    			else if (Close[0] < Math.Min(Open[1], Close[1]))
    			{
    				KagiColor = "Red";
    			}
    			Print(KagiColor);
            }
        }
    You could figure the code by opening the ChartStyle for the KagiLine and following it's logic for changing the lines of the chart.

    In NinjaTrader 7 the Kagi Line Chart Style code is found under Documents\NinjaTrader 7\bin\Custom\Type > @ChartStyles.cs.

    In NinjaTrader 8 you can go to the NinjaTrader Control Center > New > NinjaScript > Editor > ChartStyles > KagiStyle.
    Last edited by NinjaTrader_PatrickH; 12-02-2016, 08:21 AM.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    117 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    166 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    85 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    130 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    88 views
    0 likes
    Last Post PaulMohn  
    Working...
    X