chart上画移动平均线问题

zql177 2008-03-31 04:38:42
如题,任何根据chart上一条series的数据,增加该条线的移动平均线(每隔7个点)呢?
或者有什么三方控件呢?
...全文
1060 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
zql177 2008-04-28
  • 打赏
  • 举报
回复
上面2楼说的很清楚了呀
emma103 2008-04-14
  • 打赏
  • 举报
回复
楼主,能否共享这个方法的具体实现程序啊,小弟我急需,万分感激!
email:lwt01001@163.com
zql177 2008-04-07
  • 打赏
  • 举报
回复
TAverageTeeFunction 和 TMovingAverageFunction 有区别吧
zql177 2008-04-07
  • 打赏
  • 举报
回复
好的,谢谢了
zhaixing0101 2008-04-07
  • 打赏
  • 举报
回复
不一样, 不过使用方法一样, 替换那个函数名即可
TMovingAverageFunction 的两个属性, E文不好,把帮助直接摘给楼主吧
property Weighted: Boolean;

The Weighted property controls if the moving average points will be calculated using or not the corresponding X point values.

When False, (the default), the average is calculated as the simple sum of Y values divided by the number of points.

When True, each Y value is first multiplied by it's X value and the total sum is divided by the sum of all X point values.
-------------------------------
property WeightedIndex: Boolean;

Set WeightedIndex to true to calculate the Moving Average using the source points index as the "weight".

This differs than using the Weighted property, in which the Weighted property uses the points "X" value as the weight instead of the points index.
zhaixing0101 2008-04-02
  • 打赏
  • 举报
回复

设置好后
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
series2.CheckDataSource;
end;

或者写代码
Series2.SetFunction( TAverageTeeFunction.Create(Series2) ) ;
Series2.FunctionType.PeriodStyle:=psRange;
Series2.FunctionType.Period:=7;
Series2.DataSource:=Series1;
程序运用在外汇MT4交易系统 /+------------------------------------------------------------------+ //| MACD Sample.mq4 | //| Copyright ?2005, MetaQuotes Software Corp. | //| http://www.metaquotes.net/ | //+------------------------------------------------------------------+ extern double TakeProfit = 50; extern double Lots = 0.1; extern double TrailingStop = 30; extern double MACDOpenLevel=3; extern double MACDCloseLevel=2; extern double MATrendPeriod=26; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { double MacdCurrent, MacdPrevious, SignalCurrent; double SignalPrevious, MaCurrent, MaPrevious; int cnt, ticket, total; // initial data checks // it is important to make sure that the expert works with a normal // chart and the user did not make any mistakes setting external // variables (Lots, StopLoss, TakeProfit, // TrailingStop) in our case, we check TakeProfit // on a chart of less than 100 bars if(Bars<100) { Print("bars less than 100"); return(0); } if(TakeProfit<10) { Print("TakeProfit less than 10"); return(0); // check TakeProfit } // to simplify the coding and speed up access // data are put into internal variables MacdCurrent=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0); MacdPrevious=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,1); SignalCurrent=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,0); SignalPrevious=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,1); MaCurrent=iMA(NULL,0,MATrendPeriod,0,MODE_EMA,PRICE_CLOSE,0); MaPrevious=iMA(NULL,0,MATrendPeriod,0,MODE_EMA,PRICE_CLOSE,1);

5,379

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧