指标名称:浮动波动指标
版本:MT4-MT5 ver. 1.16
浮动波动指标(Float Indicator)用于衡量市场的波动强度,结合了趋势强度、成交量、斐波那契回调水平以及迪纳波利水平。这些工具共同作用,帮助交易者识别市场的转折点和波动趋势,从而提供更具前瞻性的交易信号。
功能特点
-
趋势强度:利用一段时间内的最高和最低价计算市场的波动强度。
-
成交量分析:根据成交量的累积情况计算市场的浮动量(Float),这有助于揭示市场参与者的活跃度和潜在的价格反转信号。
-
斐波那契回调:绘制基于最高价和最低价的斐波那契回调水平,帮助识别可能的支撑和阻力区域。
-
迪纳波利水平:提供额外的参考线,基于斐波那契水平的细分,进一步细化市场的潜在支撑和阻力位置。
使用方法
- Float Histogram(浮动柱状图):该柱状图表示市场的浮动量,它根据历史成交量和价格波动计算得到。柱状图的大小可以帮助识别市场的强弱以及潜在的反转点。
- Float Line(浮动线):该线代表了一段时间内的累计浮动量,用红色显示,便于观察整体市场的浮动趋势。
- 斐波那契和迪纳波利线:指标会根据设定的价格范围自动绘制斐波那契回调线和迪纳波利水平线,用于辅助判断价格的支撑和阻力区域。
设置说明
- –
Float
:设置计算浮动的时间周期,通常为200(即200根K线)。 - –
ObjectPrefix
:用于绘制对象的前缀,默认设置为”FI-“,可以根据需要更改。 - –
DisableDinapoli
:是否禁用迪纳波利水平线的绘制。 - –
DisableFibonacci
:是否禁用斐波那契回调水平的绘制。 - –
SwingBorderColor
:设置Swing线的颜色。 - –
SwingBorderWidth
:设置Swing线的宽度。 - –
FiboColor
:设置斐波那契回调线的颜色。 - –
DinapoliColor
:设置迪纳波利线的颜色。
使用技巧
- 多周期分析:可以将该指标应用于多个时间周期,以便获得更全面的市场趋势分析。
2.结合其他指标:推荐将该指标与其他趋势跟踪或震荡指标(如MACD、RSI等)结合使用,进一步提高交易策略的有效性。
部分代码展示:
//+——————————————————————+
//| Float波动指标 .mq4 |
//| Copyright © 2009-2024, http://www.QChaos.com |
//| https://www.qchaos.com/ |
//+——————————————————————+
property copyright "Copyright © 量化混沌, http://www.qchaos.com"
property link "https://www.qchaos.com"
property version "2.01"
property strict
property description "———————————————"
property description "EA、指标公式分享"
property description "EA、指标编写业务承接"
property description "———————————————"
property description "更多资源,关注公众号:量化程序"
property description "微 信:QChaos001"
property description "手机号:134-8068-5281"
property description "———————————————"
property description "浮动波动指标 – 包括趋势强度、成交量、斐波那契回调和迪纳波利水平。"
property indicator_separate_window
property indicator_buffers 2
property indicator_color1 clrBlue
property indicator_width1 1
property indicator_label1 "Float Histogram"
property indicator_color2 clrRed
property indicator_width2 1
property indicator_style2 STYLE_SOLID
property indicator_label2 "Float Line"
input int Float = 200;
input string ObjectPrefix = "FI-";
input bool DisableDinapoli = false;
input bool DisableFibonacci = false;
input bool DrawVerticalLinesAsBackground = false;
input color SwingBorderColor = clrBlue;
input int SwingBorderWidth = 1;
input ENUM_LINE_STYLE SwingBorderStyle = STYLE_SOLID;
input color SwingLinesColor = clrRed;
input int SwingLinesWidth = 1;
input ENUM_LINE_STYLE SwingLinesStyle = STYLE_DOT;
input color FiboColor = clrGreen;
input int FiboWidth = 1;
input ENUM_LINE_STYLE FiboStyle = STYLE_DASH;
input color DinapoliColor = clrRed;
input int DinapoliWidth = 1;
input ENUM_LINE_STYLE DinapoliStyle = STYLE_DOT;
int prevbars;
double Histogram[];
double Line[];
void OnInit()
{
IndicatorShortName("Float波动指标");
SetIndexStyle(0, DRAW_HISTOGRAM);
SetIndexBuffer(0, Histogram);
SetIndexDrawBegin(0, Float * 2);
SetIndexStyle(1, DRAW_LINE);
SetIndexBuffer(1, Line);
SetIndexDrawBegin(1, Float * 2);
}
void OnDeinit(const int reason)
{
ObjectsDeleteAll(ChartID(), ObjectPrefix);
Comment("");
}
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime& time_timeseries[],
const double& open[],
const double& high[],
const double& low[],
const double& close[],
const long& tick_volume[],
const long& volume[],
const int& spread[]
)
{
if (Bars – prevbars < 1) return rates_total; // Do not recalculate yet.
prevbars = Bars;
bool first = true;
long cumulativeV = 0;
double FLOATV = 0, high_bar = 0, low_bar = 0;
int bars_high = 0, bars_low = 0, shift, swing_time = 0, cvstart = 0, cvend = 0;
int loopbegin = Bars – Float;
for (shift = loopbegin; shift >= 0; shift–)
{
// Find bar counts.
bars_high = iHighest(NULL, 0, MODE_HIGH, Float, 1);
bars_low = iLowest(NULL, 0, MODE_LOW, Float, 1);
// Find the high and low values over the period.
high_bar = High[bars_high];
low_bar = Low[bars_low];
// Find cumulative volume for float period.
if (bars_high < bars_low) // Uptrend.
{
cvstart = bars_low;
cvend = bars_high;
}
else // Downtrend.
{
cvstart = bars_high;
cvend = bars_low;
}
if ((first) && (FLOATV == 0))
{
for (shift = cvstart; shift >= cvend; shift–)
{
FLOATV = FLOATV + Volume[shift];
first = false;
}
}
}
// Find float time barcount.
swing_time = MathAbs(bars_low – bars_high);
// Find cumulative volume since last turnover.
for (shift = cvstart; shift >= 0; shift–)
{
cumulativeV += Volume[shift];
if (cumulativeV >= FLOATV) cumulativeV = 0;
Histogram[shift] = cumulativeV 0.001; // Blue histogram.
Line[shift] = FLOATV 0.001; // Red line.
}
Comment(
"\n", "High was ", bars_high, " bars ago",
"\n", "Low was ", bars_low, " bars ago", "\n",
"\n", "Float time was = ", swing_time, " bars",
"\n", "Float volume left = ", FLOATV – cumulativeV,
"\n", "Float volume = ", FLOATV);
ObjectDelete(ObjectPrefix + "Swingtop");
ObjectCreate(ObjectPrefix + "Swingtop", OBJ_TREND, 0, Time[cvstart], high_bar, Time[1], high_bar);
ObjectSet(ObjectPrefix + "Swingtop", OBJPROP_STYLE, SwingBorderStyle);
ObjectSet(ObjectPrefix + "Swingtop", OBJPROP_COLOR, SwingBorderColor);
ObjectSet(ObjectPrefix + "Swingtop", OBJPROP_RAY, 0);
ObjectSet(ObjectPrefix + "Swingtop", OBJPROP_WIDTH, SwingBorderWidth);