Currently, what pips is the candle? I want to display this on the chart!
Hello. This is Chobi-to FX.
Well, as the title suggests,EA Createbased on the source code output by it, I made something that shows how many pips the current candlestick has moved.
It’s convenient for checking data display when you want to avoid misreading it at a glance.
In rough terms,EA Createuses the “candle structure: wick” in its condition settings.
EA Createuses the following function found in a file created under certain conditions with it.
//--------------------------------------------------------------------------------------------------------+
// Candlestick components (wicks) calculation process
// Purpose: Calculate the components of the given candlestick
// Arguments: currency pair, timeframe, candlestick position, candlestick components (0: upper wick, 1: body, 2: lower wick, 3: range)
// Return: pips calculated from the specified candlestick components
//--------------------------------------------------------------------------------------------------------+
double getCandleStickPips(string symbol, int period, int shift, int hige)
{
int digits = (int)MarketInfo(symbol, MODE_DIGITS);
double open = iOpen(symbol,period,shift);
double close = iClose(symbol,period,shift);
double high = iHigh(symbol,period,shift);
double low = iLow(symbol,period,shift);
// If bullish
if (open < close) {
if (hige == 0) {
return (NormalizeDouble(PriceToPips(MathAbs(high - close)), digits));
}
else if (hige == 1) {
return (NormalizeDouble(PriceToPips(MathAbs(close - open)), digits));
}
else if (hige == 2) {
return (NormalizeDouble(PriceToPips(MathAbs(open - low)), digits));
}
else if (hige == 3) {
return (NormalizeDouble(PriceToPips(MathAbs(high - low)), digits));
}
else {
return (NormalizeDouble(PriceToPips(MathAbs(high - close)), digits));
}
}
// If bearish
else {
if (hige == 0) {
return (NormalizeDouble(PriceToPips(MathAbs(high - open)), digits));
}
else if (hige == 1) {
return (NormalizeDouble(PriceToPips(MathAbs(open - close)), digits));
}
else if (hige == 2) {
return (NormalizeDouble(PriceToPips(MathAbs(close - low)), digits));
}
else if (hige == 3) {
return (NormalizeDouble(PriceToPips(MathAbs(high - low)), digits));
}
else {
return (NormalizeDouble(PriceToPips(MathAbs(high - open)), digits));
}
}
return 0;
}
Since I want to display it on the chart, insideOnTick(),Comment
void OnTick()
{
Comment(
"\n",
"\n Current candlestick: ", getCandleStickPips(Symbol(), 0, 0, 3),
"\n 1 candlestick ago: ", getCandleStickPips(Symbol(), 0, 1, 3),
"\n"
);
}That's it.
How about that? Pretty simple, right.
EA Create’s engine really provides wonderful functions.
See you next time.
Downloads are available from below.
× ![]()