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 f.saeidi, Today, 11:02 AM
    0 responses
    0 views
    0 likes
    Last Post f.saeidi  
    Started by geotrades1, Today, 10:02 AM
    3 responses
    10 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by rajendrasubedi2023, Today, 09:50 AM
    3 responses
    15 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by lorem, Today, 09:18 AM
    2 responses
    11 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by geddyisodin, Today, 05:20 AM
    4 responses
    30 views
    0 likes
    Last Post geddyisodin  
    Working...
    X