Bar Info
Menu
Debugging
Menu
Derivatives
Menu
Matrix Handling
Menu
Price Rounding
Menu
Regression Lines
Menu
Statistics
Menu
User Tracking
Menu
Example Strategies
Menu
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
///
/// Calculates the percent of the bar that the upper wick makes up.
///
/// The desired bar.
/// The percent of the bar that the upper wick makes up.
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;
}
///
/// Calculates the percent of the bar that the lower wick makes up.
///
/// The desired bar.
/// The percent of the bar that the lower wick makes up.
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;
}