期货均线怎加粗(期货均线设置)

以太坊 (52) 2024-11-03 03:15:34

期货均线是期货技术分析中常用的指标之一,它可以帮助投资者识别趋势并做出交易决策。默认情况下,均线可能比较细,难以在图表上清晰辨认。将介绍如何对期货均线进行加粗,以增强其可视性。

一、使用平台设置

1. MT4平台

  • 打开MT4平台。
  • 在图表上右键单击,选择“属性”。
  • 在“颜色”选项卡中,找到“均线”设置。
  • 调整“宽度”参数,以加粗均线。

2. TradingView平台

  • 打开TradingView平台。
  • 在图表上单击“研究”按钮。
  • 在搜索栏中输入“移动平均线”。
  • 将“移动平均线”指标添加到图表。
  • 在指标设置中,找到“线宽”参数,以加粗均线。

二、使用指标代码

1. MT4平台

期货均线怎加粗(期货均线设置)_https://www.xjzxxn66.com_以太坊_第1张

  • 在“导航器”窗口中,选择“技术指标”。
  • 右键单击“Moving Average”,选择“修改”。
  • 在“输入”选项卡中,找到“线宽”参数,以加粗均线。

2. TradingView平台

  • 在TradingView平台中,单击“图表”菜单。
  • 选择“添加指标”。
  • 在搜索栏中输入“Moving Average”。
  • 将“Moving Average”指标添加到图表。
  • 在指标设置中,找到“线宽”参数,以加粗均线。

三、使用自定义指标

1. MT4平台

  • 创建一个新的指标文件(.mq4)。
  • 在指标代码中,使用以下代码加粗均线:

```

property indicator_plots

int plots=1;

property indicator_type

int type=0;

property indicator_buffers

int buffers=1;

property indicator_window

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);

}

```

  • 编译指标并将其加载到MT4平台中。

2. TradingView平台

  • 在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)

  • 编译指标并将其保存到TradingView平台中。

四、设置多个均线

如果需要在图表上显示多个均线,可以重复上述步骤,并为每个均线设置不同的颜色和线宽。例如:

  • 5日均线:颜色为红色,线宽为2
  • 10日均线:颜色为蓝色,线宽为3
  • 20日均线:颜色为绿色,线宽为4

五、注意事项

  • 加粗均线可以提高其可视性,但也要注意不要过度加粗,以免影响图表的美观和清晰度。
  • 均线的线宽设置会根据图表的分辨率和缩放级别而有所不同。
  • 如果在图表上添加了过多加粗的均线,可能会使图表变得杂乱无章,难以解读。

发表回复