期货均线是期货技术分析中常用的指标之一,它可以帮助投资者识别趋势并做出交易决策。默认情况下,均线可能比较细,难以在图表上清晰辨认。将介绍如何对期货均线进行加粗,以增强其可视性。
一、使用平台设置
1. MT4平台
2. TradingView平台
二、使用指标代码
1. MT4平台
2. TradingView平台
三、使用自定义指标
1. MT4平台
```
int plots=1;
int type=0;
int buffers=1;
int window=20;
array double MovingAverage(double price[],int period)
{
double ma[period];
for(int i=0;i<period;i++)
ma[i]=0;
for(int i=0;i<period;i++)
for(int j=0;j<period;j++)
ma[i]+=price[j];
for(int i=0;i<period;i++)
ma[i]/=period;
return ma;
}
int OnInit()
{
SetIndexStyle(0,DRAW_LINE,0,1);
return(0);
}
int OnCalculate(const int rates_total,const int prev_calculated,const double &price[],const int &mode,double &value[])
{
value[0]=MovingAverage(price,window);
return(0);
}
```
2. TradingView平台
//@version=5
indicator(title="Custom Moving Average", shorttitle="MA", format=format.price, precision=2)
length = input.int(20, title="Length")
ma = sma(close, length)
plot(ma, color=color.blue, linewidth=2)
四、设置多个均线
如果需要在图表上显示多个均线,可以重复上述步骤,并为每个均线设置不同的颜色和线宽。例如:
五、注意事项