简体   繁体   English

更改时间范围后,将不会绘制该图MQL5

[英]After changing time frame the graph is not plotted MQL5

Have a look at the code: 看一下代码:

input ENUM_TIMEFRAMES TimePeriod = PERIOD_M1; // Set the timeframe for the stochastic.
void OnInit()
{
 int stochastic_output = iStochastic(_Symbol,TimePeriod,5,3,3,MODE_SMA,STO_LOWHIGH);//initialize the value for Stochastic calculator in Handle.

   if(!ChartIndicatorAdd(0,(int)ChartGetInteger(0,CHART_WINDOWS_TOTAL),stochastic_output)) //Plot initial chart
   {
   Comment("Stochastic Cannot be plotted");
   }
}

I am trying to run the expert that will display the stochastic graph for the particular timeframe as mentioned in the run time. 我正在尝试运行专家,该专家将在运行时提到的特定时间范围内显示随机图。

For 1 minute the graph is working fine but after changing the time to 2 minutes the graph is not displayed or if displayed then it is for the 1 minute. 在1分钟内,该图工作正常,但是将时间更改为2分钟后,该图不显示,或者如果显示则为1分钟。 The same is the situation for 5 minutes and so on. 同样情况持续5分钟,依此类推。

I am afraid you need a multi-timeframe version of the indicator for the opposite task, and probably nothing with help you for what you want. 恐怕您需要针对该相反任务的多时限版本的指标,可能对您想要的内容没有任何帮助。

Multitimeframe indicators are usually displaying global trends, eg, you have M1 chart open, and you see a H1 moving average on it. 多时间框架指标通常显示全球趋势,例如,您打开了M1图表,并且看到了H1移动平均线。 for all M1 candles inside any particular hour the values are same, it is a horizontal line that jumps up or down at the beginning of the next hour. 对于任何特定小时内所有M1蜡烛,其值均相同,这是一条水平线,在下一小时开始时向上或向下跳跃。 What you want is the opposite: you want to have M1 chart at a higher chart. 相反,您想要的是:希望在更高的图表上显示M1图表。 If it could work at M1/M2 then it might work with M1/D1 too, right? 如果它可以在M1 / M2上工作,那么它也可以在M1 / D1上工作,对吗? then the platform would not know which of the 1440 bars to show, it has only one bar (D1) and has to inject 1440 values there. 那么平台将不知道显示1440条中的哪一条,它只有一个条(D1),并且必须在其中注入1440个值。 Probably that is not possible. 可能那是不可能的。 If we proved it is not possible M1/D1, then it becomes obvious it is not possible with M1/M2 too because of the same reason. 如果我们证明不可能用M1 / D1,那么很明显,由于同样的原因,用M1 / M2也不可能。 If you want to show just last minute candles (16:01,16:03,16:05 that will match with M2 16:00-16:01:59 etc) or the first candle of the period, you have to code your own indicator. 如果您只想显示最后一分钟蜡烛(与M2 16:00-16:01:59等匹配的16:01,16:03,16:05等)或该期间的第一根蜡烛,则必须编写代码自己的指标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM