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 nicthe, Today, 09:24 AM
    1 response
    5 views
    0 likes
    Last Post nicthe
    by nicthe
     
    Started by samish18, Today, 10:13 AM
    0 responses
    4 views
    0 likes
    Last Post samish18  
    Started by kenz987, Yesterday, 10:20 AM
    2 responses
    13 views
    0 likes
    Last Post kenz987
    by kenz987
     
    Started by nicthe, 08-23-2023, 07:53 AM
    7 responses
    197 views
    0 likes
    Last Post nicthe
    by nicthe
     
    Started by stalt, 12-28-2015, 01:36 PM
    6 responses
    1,536 views
    0 likes
    Last Post giulyko00  
    Working...
    X