新人对MQL4和MQL5的任何问题,对算法和代码的帮助和讨论 - 页 719

 
Artyom Trishkin:

在OrderModify()之前,打印开盘价 和新止损价的数值。

如果你想得到帮助,请保持你不尊重的 "不?"。然而,我已经在这个主题中发布了一个用于任何拖网的完整工作模板--你可以查找它。

不尊重人的 "没有?"- 对不起,没有投入任何东西。

 
        if((fMarketOrderss(OP_SELL)>=1)) { 
       if( ((Bid-Opens)/ma+Times/1440) > SELL ) {
if(OrderSend(Symbol(),OP_SELL,0.01,Bid,3,0,0,NULL,321,0,1)>0){} }}

请指教!应该增加什么功能来代替SELL,用数字的顺序来进行。如果有一个开放的交易,那么就放1。只要这个交易被打开,它就会给2,以此类推。如果没有交易,那么这个数字将被重置。

 
Artyom Trishkin:

在OrderModify()之前,打印开盘价 和新止损价的数值。

它打印的是相同的值。那为什么要检查!=,你能告诉我吗?

 
Andrey Sokolov:

写出相同的值。那为什么要检查!=,你能告诉我吗?

阅读关于比较实数 的文章。

 
Artyom Trishkin:

阅读关于比较实数 的文章。

关闭阅读。谢谢
 
Andrey Sokolov:
我去读书了。谢谢

不要只是比较,而是要检查 "是不是该行动了?",即是不是小于必要的 "n>=p"

 
Vitaly Muzichenko:

不要只是比较,而是要检查 "是不是该行动了?",即 "n>=p "是不是少于必要的限度

谢谢
 
你好,我有一个颜色水平指标,我有一个问题,当我试图把这个指标的两个部分应用到一个图表上时,即第一个指标的窗口消失了,只有第二个指标的窗口显示出来,当我点击创建一个对象--一个矩形时,会创建两个对象,一个来自一个指标,另一个来自另一个指标。请告知如何解决这个问题,以便这个指标的几个部分可以在图表中使用,并且可以正确创建对象?我可以改变代码中的一些东西吗,或者反之亦然?例子
附加的文件:
 

尽我所能地组装了指示器
需要帮助,当指数在+/-0.4%区域时,突出显示条形,例如一个矩形。
或者至少是代码本身
我的指标代码

//+------------------------------------------------------------------+
//|                           Copyright © 2018, forex-time@mail.ru   |
//|                        Copyright © 2018, mr.aliaksei@yandex.ru   |
//|                                         % Алексея Королькова.mq4 |
//+------------------------------------------------------------------+
#property copyright   "Copyright © 2018, forex-time@mail.ru"
#property copyright   "Copyright © 2018, mr.aliaksei@yandex.ru"
#property link        "http://axe44.opentraders.ru/bio/"
#property version     "1.10"
#property strict 
//+------------------------------------------------------------------+
//--- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 3
#property  indicator_color1  LimeGreen
#property  indicator_color2  Red
#property  indicator_color3  Blue
#property  indicator_width1  2
#property  indicator_width2  2
#property  indicator_width3  2
#property  indicator_level1  0.0
#property  indicator_levelcolor DarkGray
//--- indicator parameters
input int InpFastEMA=14;   // Fast EMA Period
input int Metod     =1;   // Metod EMA Period 0-3
input string Pereferics="";// Переферикс после названия основной пары. Например EURUSD.m где переферикс .m
//--- indicator buffers
double Buffer1[];
double Buffer2[];
double Buffer3[];
//--- right input parameters flag
bool   ExtParameters=false;
string IndName= "% A.K ("+IntegerToString(InpFastEMA)+")";
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit(void)
  {
   IndicatorDigits(Digits+1);
//--- drawing settings
   SetIndexBuffer(0,Buffer1);SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(1,Buffer2);SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(2,Buffer3);SetIndexStyle(2,DRAW_LINE);

//--- name for DataWindow and indicator subwindow label
   IndicatorShortName(IndName);
//--- check for input parameters
   if(InpFastEMA<=1  )
     {
      Print("Wrong input parameters");
      ExtParameters=false;
      return(INIT_FAILED);
     }
   else
      ExtParameters=true;
//--- initialization done
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence                           |
//+------------------------------------------------------------------+
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[])
  {
    int i = rates_total-prev_calculated-1;

    while(i >= 0)  
      {
      double eurusd=(((iMA("EURUSD"+Pereferics,0,InpFastEMA,0,Metod,0,i)+1)/(iMA("EURUSD"+Pereferics,0,InpFastEMA,0,Metod,1,i)+1))-1)*10000;
      double eurjpy=(((iMA("EURJPY"+Pereferics,0,InpFastEMA,0,Metod,0,i)+1)/(iMA("EURJPY"+Pereferics,0,InpFastEMA,0,Metod,1,i)+1))-1)*10000;
      double usdjpy=(((iMA("USDJPY"+Pereferics,0,InpFastEMA,0,Metod,0,i)+1)/(iMA("USDJPY"+Pereferics,0,InpFastEMA,0,Metod,1,i)+1))-1)*10000;
      double eur=(eurusd+eurjpy)/2;
      double usd=(-eurusd+usdjpy)/2;
      double jpy=-(usdjpy+eurjpy)/2;
      Buffer1[i]=ND(eur,1);
      Buffer2[i]=ND(usd,1);
      Buffer3[i]=ND(jpy,1);

      Pair(IndName+"EUR","EUR",54,indicator_color1);
      Pair(IndName+"USD","USD",28,indicator_color2);
      Pair(IndName+"JPY","JPY",5,Blue);
                  
      i--;}
return(rates_total);}
//+------------------------------------------------------------------+
//|ND - нормализация числа                                           |
//-------------------------------------------------------------------+
double ND(double value, int digits) {  
      return(NormalizeDouble(value, digits));}  
//+------------------------------------------------------------------+
void Pair(string name,string txt, int shift, color col){
      int window=WindowFind(IndName);
      //если окно не найдено - "текстовые метки" будут созданы в окне графика
      if(window<0) window=0;
       ObjectCreate(name,OBJ_LABEL,window,0,0,0,0,0,0);
          ObjectSet(name,OBJPROP_CORNER,0);
          ObjectSet(name,OBJPROP_XDISTANCE,shift);
          ObjectSet(name,OBJPROP_YDISTANCE,2);
          ObjectSet(name,OBJPROP_CORNER,CORNER_RIGHT_UPPER);
      ObjectSetText(name,txt,8,"Arial",col);}
//+------------------------------------------------------------------+

有人向我推荐了这个代码,但我不知道如何附上它。

ObjectCreate(VLINE, OBJ_VLINE, 0, 0, 0);
ObjectSet(VLINE, OBJPROP_COLOR, VLINE_COLOR);
ObjectSet(VLINE, OBJPROP_STYLE, VLINE_STYLE);

ObjectDelete(VLINE);

if(Bf<0.4 && Bf>(-0.4))
ObjectSet(VLINE, VLINE, VLINE);

预先感谢你。

 
是否有可能代替
高/低>1.02做
高>低*1.02
哪种方案对指标更好