初学者的问题 MQL5 MT5 MetaTrader 5 - 页 716

 
Artyom Trishkin:

你好...你说你不能是什么意思?

那这是什么?在编辑部的5分钟...

它是完美的!

一个团队?

int j;
...
start()
{
........
      j=j+10;
      PlotIndexSetInteger(0,PLOT_SHIFT,j);
........
不工作(( //MT4, build 1031)
 
Renat Akhtyamov:

谢谢你!

无论如何。

在MT5平台上,将指标窗口中的线向右移动,超过零点栏,确实可以发挥作用。

MT4没有这个功能,不管我怎么做,它都没有用。

另外,据我所知,MT5具有3D建模功能,与MT4不同。

这一切都非常酷

我崩溃了。

// 而且我做得很急;)

什么是不可能的?将指标缓冲区向右移?是的,你可以,甚至向右或向左;)SetIndexShift()。

但如果你已经决定转到MT5,那就去吧;)

 
Renat Akhtyamov:

那很好啊!

指挥?

int j;
...
start()
{
........
      j=j+10;
      PlotIndexSetInteger(0,PLOT_SHIFT,j);
........

愚蠢地倒置了计算缓冲区的最后十个数值,并以10个小节的移位进行输出。甚至没有考虑过任何优化或任何东西。只是为了给你看。

//+------------------------------------------------------------------+
//|                                                  iCheckShift.mq4 |
//|              Copyright 2017, Artem A. Trishkin, Skype artmedia70 |
//|                       https://login.mql5.com/ru/users/artmedia70 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, Artem A. Trishkin, Skype artmedia70"
#property link      "https://login.mql5.com/ru/users/artmedia70"
#property version   "1.00"
#property strict
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_plots   2
//--- plot BufferCurrent
#property indicator_label1  "BufferCurrent"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrRed
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1
//--- plot BufferFuture
#property indicator_label2  "BufferFuture"
#property indicator_type2   DRAW_LINE
#property indicator_color2  clrDodgerBlue
#property indicator_style2  STYLE_SOLID
#property indicator_width2  2
//--- input parameters
input int      Shift=10;   // Смещение в будущее (баров)
//--- indicator buffers
double         BufferCurrent[];
double         BufferFuture[];
double         BufferCalculate[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   IndicatorBuffers(3);
   SetIndexBuffer(0,BufferCurrent,INDICATOR_DATA);
   SetIndexBuffer(1,BufferFuture,INDICATOR_DATA);
   SetIndexBuffer(2,BufferCalculate,INDICATOR_CALCULATIONS);
   SetIndexShift(1,Shift);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
   if(rates_total<1) return(0);
   ArraySetAsSeries(BufferCalculate,true);
   ArraySetAsSeries(BufferCurrent,true);
   ArraySetAsSeries(BufferFuture,true);
   int limit=rates_total-prev_calculated;
   if(limit>1) {
      limit=rates_total-1;
      ArrayInitialize(BufferCalculate,EMPTY_VALUE);
      ArrayInitialize(BufferCurrent,EMPTY_VALUE);
      ArrayInitialize(BufferFuture,EMPTY_VALUE);
      }
   for(int i=limit; i>=0; i--) {
      BufferCurrent[i]=(high[i]+low[i])/2.0;
      if(i<Shift) BufferCalculate[i]=(high[i]+low[i]+open[i]+close[i])/4.0;
      }
   for(int i=0; i<Shift; i++) {
      BufferFuture[Shift-i]=BufferCalculate[i];
      }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
 
Vitalie Postolache:

什么是不可能的?将指标缓冲区向右移?是的,你可以,向右或向左;)

但如果你已经决定转到MT5,请继续;)

我在上面写了我的代码。对吗?
 
Renat Akhtyamov:
你上面写的代码。对吗?
我把它加在那里了,SetIndexShift()。 而Artem把它写得更明确。
 
Vitalie Postolache:
我把它加在那里了。 SetIndexShift()。 而Artiom写得更详细。

终于!问题解决了。

int j=0;
...
start()
{
........
      j=j+10;
      SetIndexShift(0,j);

一切都在MT4上运行。

非常感谢!!!

 
你好!
我的问题是这样的。
在指标窗口中有一个MACD,它有一些根据当前价格 计算的 "A "值。如果当前的MACD值变为"-A",计算价格值的公式是什么?
 
Leo59:
你好!
我的问题是这样的。
在指标窗口中有一个MACD,它有一些根据当前价格 计算的 "A "值。如果当前的MACD值变为"-A",计算价格值的公式应该是什么?
https://ru.wikipedia.org/wiki/%D0%98%D0%BD%D0%B4%D0%B8%D0%BA%D0%B0%D1%82%D0%BE%D1%80_MACD
Индикатор MACD — Википедия
Индикатор MACD — Википедия
  • ru.wikipedia.org
Индикатор используют для проверки силы и направления тренда, а также определения разворотных точек. Строится на основе скользящих средних. Существует две модификации индикатора MACD: линейный MACD и MACD-гистограмма. Для расчёта линейного MACD из скользящей средней цены (обычно берётся экспоненциальная скользящая средняя с меньшим периодом...
 
Renat,当然要感谢你的参与....。但是,这个问题是关于别的东西。
在指标窗口中有一个MACD,它有一些根据当前价格 计算的 "A "值。如果当前的MACD值变为"-A",计算价格值的公式应该是什么?
 
Leo59:
Renat,当然,谢谢你的参与....。但是,这个问题是关于别的东西。
在指标窗口中有一个MACD,它有一些根据当前价格 计算的 "A "值。如果当前的MACD值变为"-A",计算价格值的公式是什么?
也许,值得展示一下当一些 "A "值为正值时的计算公式--不清楚我们在谈论什么。