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 CaptainJack, 05-29-2026, 05:09 AM
    0 responses
    310 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 05-29-2026, 12:02 AM
    0 responses
    200 views
    0 likes
    Last Post CaptainJack  
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    186 views
    1 like
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    278 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    229 views
    0 likes
    Last Post CarlTrading  
    Working...
    X