Tyche Trading

Wicks Percent

Bar Info

Debugging

Derivatives

Matrix Handling

Price Rounding

Regression Lines

Statistics

User Tracking

Example Strategies

Wicks Percent

Description:

Calculate the percentage of a bar that is made up by the high or low wicks of that bar.

 

Syntax:

HighWicksPercent(int bar);

 

Arguments:

bar: The bar that occured X number of bars ago

				
					/// <summary>
/// Calculates the percent of the bar that the upper wick makes up.
/// </summary>
/// <param name="bar"> The desired bar. </param>
/// <returns> The percent of the bar that the upper wick makes up. </returns>
private double HighWicksPercent(int bar)
{
	double wicksHigh;

    if (Close[bar] > Open[bar])											// bull bar
		wicksHigh = (High[bar] - Close[bar]) / (High[bar] - Low[bar]);
	else if (Open[bar] > Close[bar])									// bear bar
		wicksHigh = (High[bar] - Open[bar]) / (High[bar] - Low[bar]);
    else																// doji bar
		wicksHigh = (High[bar] - Open[bar]) / (High[bar] - Low[bar]);

	return wicksHigh;
}

/// <summary>
/// Calculates the percent of the bar that the lower wick makes up.
/// </summary>
/// <param name="bar"> The desired bar. </param>
/// <returns> The percent of the bar that the lower wick makes up. </returns>
private double LowWicksPercent(int bar)
{
	double wicksLow;

    if (Close[bar] > Open[bar])											// bull bar
		wicksLow = (Open[bar] - Low[bar]) / (High[bar] - Low[bar]);
	else if (Open[bar] > Close[bar])									// bear bar
		wicksLow = (Close[bar] - Low[bar]) / (High[bar] - Low[bar]);
    else																// doji bar
		wicksLow = (Open[bar] - Low[bar]) / (High[bar] - Low[bar]);

	return wicksLow;
}