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 fx.practic, 10-15-2013, 12:53 AM
    5 responses
    5,404 views
    0 likes
    Last Post Bidder
    by Bidder
     
    Started by Shai Samuel, 07-02-2022, 02:46 PM
    4 responses
    95 views
    0 likes
    Last Post Bidder
    by Bidder
     
    Started by DJ888, Yesterday, 10:57 PM
    0 responses
    7 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by MacDad, 02-25-2024, 11:48 PM
    7 responses
    159 views
    0 likes
    Last Post loganjarosz123  
    Started by Belfortbucks, Yesterday, 09:29 PM
    0 responses
    8 views
    0 likes
    Last Post Belfortbucks  
    Working...
    X