为什么我编的涨跌幅和震幅指标无法正常显示?请高手帮我看一下。 新评论 [删除] 2008.11.07 04:24 这是个再简单不过的指标了。就是把每日的收盘价格减去开盘价格再除以开盘价格,以及最高价减去最低价然后除以开盘价。可是在图标上却只能显示出最近三个蜡烛位置的指标,之间的全都无法显示。请各位菩萨帮我分析一下,错误在哪里?万分感谢了。 double ExtMapBuffer1[]; double ExtMapBuffer2[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,ExtMapBuffer2); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; //---- int pos=Bars-counted_bars; double dhigh,dlow,dclose,dopen; while(pos>=0) {dhigh=High[pos]; dlow=Low[pos]; dclose=Close[pos]; dopen=Open[pos]; ExtMapBuffer1[pos]=100*(dclose-dopen)/dopen; ExtMapBuffer2[pos]=100*(dhigh-dlow)/dopen; pos--;} //---- return(0); 问吧! trouble me for very long term 欢迎来到MQL4课程 [删除] 2008.11.07 04:25 #1 附上文件。 附加的文件: cr.mq4 3 kb 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
这是个再简单不过的指标了。就是把每日的收盘价格减去开盘价格再除以开盘价格,以及最高价减去最低价然后除以开盘价。可是在图标上却只能显示出最近三个蜡烛位置的指标,之间的全都无法显示。请各位菩萨帮我分析一下,错误在哪里?万分感谢了。
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
//----
int pos=Bars-counted_bars;
double dhigh,dlow,dclose,dopen;
while(pos>=0)
{dhigh=High[pos];
dlow=Low[pos];
dclose=Close[pos];
dopen=Open[pos];
ExtMapBuffer1[pos]=100*(dclose-dopen)/dopen;
ExtMapBuffer2[pos]=100*(dhigh-dlow)/dopen;
pos--;}
//----
return(0);