Voir comment télécharger gratuitement des robots de trading
Retrouvez-nous sur Twitter !
Rejoignez notre page de fans
Un script intéressant ?
Poster un lien vers celui-ci -
laisser les autres l'évaluer
Vous avez aimé le script ? Essayez-le dans le terminal MetaTrader 5
Vues:
3121
Note:
(12)
Publié:
2018.04.18 17:07
Besoin d'un robot ou d'un indicateur basé sur ce code ? Commandez-le sur Freelance Aller sur Freelance

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

Traduit du russe par MetaQuotes Ltd.
Code original : 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.