NexusFi: Find Your Edge


Home Menu

 





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


Discussion in NinjaTrader

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




 
Search this Thread
  #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?
Iran Lebanon Problem Kills Switzerland Talks, Brent at $ …
Prediction Markets & Event Contracts
Czechia Live at 52.5% as England Rides 4-2 Wave to Co-Fa …
Prediction Markets & Event Contracts
No book, only a stair: journaling fills where price move …
Cryptocurrency
Trump Media to sell instant access to market-moving soci …
Traders Hideout
Without Pulisic, USA 61.5% Live vs. Australia -- France …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Want your NinjaTrader indicator created, free?
5 thanks
Afternoon-close session
1 thanks
Franks Trading Journey
1 thanks
Denied 20K payouts: Alpha Futures
1 thanks
FootPrintV2 Chart for NT8
1 thanks
  #2 (permalink)
 SamirOfSalem   is a Vendor
 
Posts: 77 since Jan 2020
Thanks Given: 23
Thanks Received: 49


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


© 2026 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 - Downloads - Top
no new posts