如何通过if语句分隔两个Low [1]?

时间:2019-07-04 03:49:07

标签: mql4

例如,先前的低点是1.55。当下一个蜡烛低点是1.66时,则下一个蜡烛低点是1.44,它比上一个低点(1.55)低,然后执行一些操作。如何实现?

double previous_low = 0;
double new_low = 0;
double new_low2 = 0;
if (((previous_low==0)&&(Low[1] < Low[2])){
     previous_low = Low[1];
}
if (previous_low != 0){
     if (Low[1] < previous_low){
          new_low2 = Low[1]; //it fail
     }
     if (Low[0] < previous_low){
          new_low2 = Low[0]; //it works only if next 1 candle is lower than previous. It fail if next 2 candle is lower than previous_low.
     }
}

1 个答案:

答案 0 :(得分:0)

  

可以通过冒泡排序来实现

<?php

$uri = $_SERVER['REQUEST_URI'];

if (strpos($uri, '//') !== false) {
    $uri = str_replace('//', '/', $uri);

    header("Location: $uri");
}

//BEFORE: http://127.0.0.1/test.php//?&mod=server
//AFFTER: http://127.0.0.1/test.php/?&mod=server