Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
Vitesse
//+------------------------------------------------------------------+
//| Vitesse.mq4 |
//| Copyright © 2007, GwadaTradeBoy Corp. |
//| racooni_1975@yahoo.fr |
//+------------------------------------------------------------------+
//| Author: Thierry Clément |
//| MQ4 Conversion: Ignace BIENVILLE |
//| racooni_1975@yahoo.fr |
//+------------------------------------------------------------------+
/*[[
REM Calcul de la Vitesse
MaMoyenne = Average[50](Close)
IF MaMoyenne[1]<> 0 THEN
Indicateur = 100*(MaMoyenne - MaMoyenne[1]) / MaMoyenne[1]
ELSE
Indicateur = 0
ENDIF
Vitesse = Average[10](Indicateur)
Return Vitesse
+------------------------------------------------------------------+
Clément, Thierry (CB).
Le guide complet de l'analyse technique pour la gestion de vos
portefeuilles boursiers 3e édition.
Maxima, 2006.
ISBN 2 84 001 480-7
Page 122
]]*/
#property copyright "Copyright © 2007, GwadaTradeBoy Corp."
#property link "racooni_1975@yahoo.fr"
#property copyright "Copyright © 2006, Thierry Clément"
#property link "thierry-clement@maxima.fr"
#property indicator_separate_window
//----Section #property
#property indicator_buffers 3
#property indicator_color1 Black //LightSeaGreen
#property indicator_color2 Red
#property indicator_color3 LightCoral
//----
extern int MAPeriod = 50;
extern int VitessePeriod = 10;
//---- Variables
int nShift;
int i,j,limit,counted_bars;
//double vites;
//---- Buffers
double MaMoyenne[];
double Indicateur[];
double Vitesse[];
//ArraySetAsSeries(Indicateur,true);
//int limitI=ArraySize(Indicateur);
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
//---- Styles et couleur des Lignes
SetIndexStyle(0,DRAW_NONE);
SetIndexBuffer(0,MaMoyenne);
SetIndexStyle(1,DRAW_NONE);
SetIndexBuffer(1,Indicateur);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,Vitesse);
//----
switch(Period())
{
case 1: nShift = 1; break;
case 5: nShift = 3; break;
case 15: nShift = 5; break;
case 30: nShift = 10; break;
case 60: nShift = 15; break;
case 240: nShift = 20; break;
case 1440: nShift = 80; break;
case 10080: nShift = 100; break;
case 43200: nShift = 200; break;
}
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
counted_bars = IndicatorCounted();
//----
if(counted_bars < 0)
return(-1);
if(counted_bars > 0)
counted_bars--;
//---- initial zero
if(counted_bars < 1)
for(i = 1; i <= MAPeriod; i++)
{
MaMoyenne[Bars - i] = EMPTY_VALUE;
Indicateur[Bars - i] = EMPTY_VALUE;
Vitesse[Bars - i] = EMPTY_VALUE;
}
//----
limit = Bars - counted_bars;
for(i = 0; i < limit; i++)
{
if (Period() >= 1440)
MaMoyenne[i] = iMA(NULL,0,MAPeriod,0,MODE_SMA,PRICE_CLOSE,i);
else
MaMoyenne[i] = iMA(NULL,PERIOD_D1,MAPeriod,0,MODE_SMA,PRICE_CLOSE,i);
if (MaMoyenne[i+1] != 0) // <> Diferent de
Indicateur[i] = 100 * ((MaMoyenne[i] - MaMoyenne[i+1]) / MaMoyenne[i+1]);
else
Indicateur[i] = 0;
// vites = iMAOnArray(Indicateur,0,VitessePeriod,0,MODE_SMA,i); //( Indicateur)
// Vitesse[i] = vites;
// iMAOnArray( double array[], int total, int period, int ma_shift, int ma_method, int shift)
Vitesse[i] = iMAOnArray(Indicateur,0,VitessePeriod,0,MODE_SMA,i); //( Indicateur)
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---