거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Twitter에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
조회수:
3249
평가:
(12)
게시됨:
2018.04.18 17:07
MQL5 프리랜스 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

An example of mathematical functions:

  • MathCeil returns the nearest upper integer;
  • MathRound rounds a number to the nearest integer;
  • MathFloor returns the nearest lower integer.

The code:

//+------------------------------------------------------------------+
//|                                           MathCeilRoundFloor.mq5 |
//|                              Copyright © 2016, Vladimir Karputov |
//|                                           http://wmua.ru/slesar/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2016, Vladimir Karputov"
#property link      "http://wmua.ru/slesar/"
#property description "MathCeil: Returns integer numeric value closest from above"
#property description "MathRound: Rounds of a value to the nearest integer"
#property description "MathFloor: Returns integer numeric value closest from below"
#property description "MathCeil: Returns integer numeric value closest from above"
#property description "MathRound: Rounds of a value to the nearest integer"
#property description "MathFloor: Returns integer numeric value closest from below"
#property version   "1.003"
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   double price=1.01561;
   Print("\n","Start price: ",DoubleToString(price,5));
   for(int i=0;i<10;i++)
     {
      Print("MathCeil(",DoubleToString(price,5),") ->  ",MathCeil(price));
      Print("MathRound(",DoubleToString(price,5),") ->  ",MathRound(price));
      Print("MathFloor(",DoubleToString(price,5),") ->  ",MathFloor(price));
      Print("");
      price+=1.9;
     }
  }

Starting with "price" equal to 1.01561 and then increase it by 1.9 in a loop.

Result:

Start price: 1.01561
MathCeil(1.01561) ->  2.0
MathRound(1.01561) ->  1.0
MathFloor(1.01561) ->  1.0

MathCeil(2.91561) ->  3.0
MathRound(2.91561) ->  3.0
MathFloor(2.91561) ->  2.0

MathCeil(4.81561) ->  5.0
MathRound(4.81561) ->  5.0
MathFloor(4.81561) ->  4.0

MathCeil(6.71561) ->  7.0
MathRound(6.71561) ->  7.0
MathFloor(6.71561) ->  6.0

MathCeil(8.61561) ->  9.0
MathRound(8.61561) ->  9.0
MathFloor(8.61561) ->  8.0

MathCeil(10.51561) ->  11.0
MathRound(10.51561) ->  11.0
MathFloor(10.51561) ->  10.0

MathCeil(12.41561) ->  13.0
MathRound(12.41561) ->  12.0
MathFloor(12.41561) ->  12.0

MathCeil(14.31561) ->  15.0
MathRound(14.31561) ->  14.0
MathFloor(14.31561) ->  14.0

MathCeil(16.21561) ->  17.0
MathRound(16.21561) ->  16.0
MathFloor(16.21561) ->  16.0

MathCeil(18.11561) ->  19.0
MathRound(18.11561) ->  18.0
MathFloor(18.11561) ->  18.0

MetaQuotes Ltd에서 러시아어로 번역함.
원본 코드: https://www.mql5.com/ru/code/20131

Fractured Fractals Fractured Fractals

The Expert Advisor uses the Fractals indicator signals to place pending orders and trail the Stop Loss level of positions.

AD AD

The AD (Accumulation Distribution) indicator with three calculation methods.

BHS system BHS system

The EA trades using pending Buy Stop and Sell Stop orders, applying the iAMA (Adaptive Moving Average, AMA) indicator based on a "round price". Position trailing.

Fractal_TL Fractal_TL

An indicator for automatic drawing of trendlines based on fractals of a given timeframe.