NexusFi: Find Your Edge


Home Menu

 





A way to measure the percentage of the wick/candle body?


Discussion in NinjaTrader

Updated
    1. trending_up 836 views
    2. thumb_up 1 thanks given
    3. group 3 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread

A way to measure the percentage of the wick/candle body?

  #1 (permalink)
bsk6969
Dallas + Texas
 
Posts: 2 since Jun 2013
Thanks Given: 4
Thanks Received: 0

I'm looking for an indicator that measures the percentage of the wick of each candle - and if any wick is, say more than 45% of it's own candle body, then either an alert is given or something is printed on the chart at the candle.

I look forward to y'all's feedback!

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
How to apply profiles
Traders Hideout
ZombieSqueeze
Platforms and Indicators
Better Renko Gaps
The Elite Circle
 
  #2 (permalink)
 SamirOfSalem   is a Vendor
 
Posts: 74 since Jan 2020
Thanks Given: 23
Thanks Received: 44


bsk6969 View Post
I'm looking for an indicator that measures the percentage of the wick of each candle - and if any wick is, say more than 45% of it's own candle body, then either an alert is given or something is printed on the chart at the candle.

I look forward to y'all's feedback!

See if this can get you started, but note it considers the "candle body" to be the area between Open and Close, in which case you'll sometimes get a wick that is many times the size of the body (e.g. 10 times or 1000%).

If by body you mean the entire length of a candle (in which case the percentage would always range between -100% and +100%, change this line:
 
Code
double body = Math.Abs(Open[0] - Close[0]);
to
 
Code
double body = Math.Abs(High[0] - Low[0]);
 
Code
//This namespace holds Indicators in this folder and is required. Do not change it. 
namespace NinjaTrader.NinjaScript.Indicators
{
	public class fioWicksPercent : Indicator
	{
		protected override void OnStateChange()
		{
			if (State == State.SetDefaults)
			{
				Description									= @"Upper wick and lower wick as percentage of candle body";
				Name										= "fio Wicks Percent";
				Calculate									= Calculate.OnBarClose;
				IsOverlay									= false;
				DisplayInDataBox							= true;
				DrawOnPricePanel							= true;
				DrawHorizontalGridLines						= true;
				DrawVerticalGridLines						= true;
				PaintPriceMarkers							= true;
				ScaleJustification							= NinjaTrader.Gui.Chart.ScaleJustification.Right;
				//Disable this property if your indicator requires custom values that cumulate with each new market data event. 
				//See Help Guide for additional information.
				IsSuspendedWhileInactive					= true;
				AddPlot(new Stroke(Brushes.Green, 2), PlotStyle.Bar, "UpperWick");
				AddPlot(new Stroke(Brushes.Crimson, 2), PlotStyle.Bar, "LowerWick");
				AddLine(Brushes.Blue, 0, "ZeroLine");
			}
			else if (State == State.Configure)
			{
			}
		}

		protected override void OnBarUpdate()
		{
			if (CurrentBar < BarsRequiredToPlot) return;
			//Add your custom indicator logic here.
			double bodyHi = Math.Max(Open[0], Close[0]);
			double bodyLo = Math.Min(Open[0], Close[0]);
			double body = Math.Abs(Open[0] - Close[0]);

			if (body == 0) return;

			if (High[0] >= bodyHi)
				UpperWick[0] = (High[0] - bodyHi) / body * 100;
			if (Low[0] <= bodyLo)
				LowerWick[0] = (Low[0] - bodyLo) / body * 100;
						
			
		}

		#region Properties

		[Browsable(false)]
		[XmlIgnore]
		public Series<double> UpperWick
		{
			get { return Values[0]; }
		}

		[Browsable(false)]
		[XmlIgnore]
		public Series<double> LowerWick
		{
			get { return Values[1]; }
		}

		#endregion

	}
}

Reply With Quote
Thanked by:
  #3 (permalink)
 HiLatencyTRDR HLT 
Midway florida
 
Posts: 462 since Dec 2018


Change the data duration or candle by 1 second or more and you get massively different candles fyi

Reply With Quote




Last Updated on July 9, 2022


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts