简体   繁体   English

数组 function 在严格模式下使用

[英]Array function use on strict mode

i have trouble for using these array function to be able to use it on MQL4 strict mode.我无法使用这些数组 function 在 MQL4 严格模式下使用它。 Could anyone hint me where i should start?谁能提示我应该从哪里开始? The purpose is so it could work on strict mode.目的是让它可以在严格模式下工作。

int Trigger;

 void function6(int &arrays[50])
  {
   int vals = ArraySize(arrays);
   int trailingstop = TimeCurrent() - (arrays[function5(arrays) - 1]);
   while(trailingstop > Trigger)
     {
      arrays[function5(arrays) - 1] = 0;
      trailingstop = TimeCurrent() - (arrays[function5(arrays) - 1]);
      if(function5(arrays) < 2)
         break;
     }
  }
                                        
int function5(int &arrays[50])
  {
   int vals = ArraySize(arrays);
   for(int k = 0; k < vals; k++)
      if(!(arrays[k] > 0))
         return (k);

   return (vals - 1);
  }

void function4(double &val[50])
  {
   int vald = ArraySize(val);
   for(int l = vald; l > 0; l--)
      val[l] = val[l - 1];
   val[0] = 0;
  }

void function3(int &arrays[50])
  {
   int vald = ArraySize(arrays);
   for(int l = vald; l > 0; l--)
      arrays[l] = arrays[l - 1];
   arrays[0] = 0;
  }

Arrays start at 0, not 1. When using ArraySize to define counting of arrays, you should always minus 1 to account for starting at 0. Arrays 从 0 开始,而不是 1。当使用 ArraySize 定义 arrays 的计数时,应始终减去 1 以说明从 0 开始。

void function6(int &arrays[50])
{
   int vals = ArraySize(arrays)-1;
   int trailingstop = TimeCurrent() - (arrays[function5(arrays) - 1]);
   while(trailingstop > Trigger)
   {
      arrays[function5(arrays) - 1] = 0;
      trailingstop = TimeCurrent() - (arrays[function5(arrays) - 1]);
      if(function5(arrays) < 2) break;
   }
}

int function5(int &arrays[50])
{
   int vals = ArraySize(arrays)-1;
   for(int k = 0; k < vals; k++)
   if(!(arrays[k] > 0)) return (k);
   return (vals - 1);
}

void function4(double &val[50])
{
   int vald = ArraySize(val)-1;
   for(int l = vald; l > 0; l--)
   val[l] = val[l - 1];
   val[0] = 0;
}

void function3(int &arrays[50])
{
   int vald = ArraySize(arrays)-1;
   for(int l = vald; l > 0; l--) arrays[l] = arrays[l - 1];
   arrays[0] = 0;
}

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

相关问题 如何在严格模式下重写Function.length以返回数组的长度 - How to override Function.length to return the length of an array, in strict mode 如何在“使用严格”模式下跨多个节点模块将对象数组作为数据存储访问? - How do I access my object array as a datastore across multiple node modules in 'use strict' mode? Typescript 严格模式下可能未定义的数组引用 - Possibly Undefined Array References in Typescript Strict Mode vb.net中Option Strict模式下的数组转换错误 - array convert error in Option Strict mode in vb.net JavaScript中的严格模式限制 - Strict mode constrictions in Javascript 不能在“严格引用”时使用字符串作为 ARRAY 引用 - Can't use string as an ARRAY ref while "strict refs" 如何使用 Toggle Function 和 NodeList/Array 在具有相同 class 的所有部分中切换暗模式? - How can I use Toggle Function with NodeList/Array to toggle dark mode in all sections with same class? perl:在使用“strict refs”时,不能将字符串用作ARRAY引用 - perl: Can't use string as an ARRAY ref while “strict refs” in use 哈希数组; 不能在“严格引用”中使用字符串(“ 1”)作为阵列引用? - Array of hash; Can't use string (“1”) as an ARRAY ref while “strict refs”? 如何使用哈希图在数组中查找最小模式 - how to use hashmap to find smallest mode in the array
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM