Ci-dessous une demande qui a été envoyée à ProRealTime :
bonjour je vous envoi un indicateur mt4 serait il possible de le coder pour prt
merci
—————————————————————–+
xxx
double TSI_Buffer[];
double SignalBuffer[];
double MTM_Buffer[];
double EMA_MTM_Buffer[];
double EMA2_MTM_Buffer[];
double ABSMTM_Buffer[];
double EMA_ABSMTM_Buffer[];
double EMA2_ABSMTM_Buffer[];
//+——————————————————————+
//| Custom indicator initialization function |
//+——————————————————————+
int init()
{
//—- indicators
IndicatorBuffers(8);
SetIndexBuffer(2, MTM_Buffer);
SetIndexBuffer(3, EMA_MTM_Buffer);
SetIndexBuffer(4, EMA2_MTM_Buffer);
SetIndexBuffer(5, ABSMTM_Buffer);
SetIndexBuffer(6, EMA_ABSMTM_Buffer);
SetIndexBuffer(7, EMA2_ABSMTM_Buffer);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,TSI_Buffer);
SetIndexLabel(0,”Ergodic”);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,SignalBuffer);
SetIndexLabel(1,”Signal”);
//—-
return(0);
}
//+——————————————————————+
//| Custor indicator deinitialization function |
//+——————————————————————+
int deinit()
{
//—- TODO: add your code here
//—-
return(0);
}
//+——————————————————————+
//| Custom indicator iteration function |
//+——————————————————————+
int start()
{
int counted_bars=IndicatorCounted();
int limit,i;
limit=Bars-counted_bars-1;//Bars
for (i=Bars-1;i>=0;i–)//Bars
{
MTM_Buffer[i]=(Close[i]-Close[i+1]);
//MTM_Buffer[i]=((High[i]+Low[i])/2)-((High[i+1]+Low[i+1])/2);
//MTM_Buffer[i]=(((Close[i]-Close[i+1])/Close[i+1])+Point);
xxx
//—-
return(0);
}
//+—————————————————————
Et une proposition de réponse :
Once period1 = 7
Once period2 = 7
Once signalPeriod = 7
mtm = Close - Close [ 1 ]
absMtm = Abs (mtm)
ema1Mtm = ExponentialAverage [ period1] (mtm)
ema1AbsMtm = ExponentialAverage [ period1] (AbsMtm)
ema2Mtm = ExponentialAverage [ period2] (ema1Mtm)
ema2AbsMtm = ExponentialAverage [ period2] (ema1AbsMtm)
tsi = 100 * ema2Mtm / ema2AbsMtm
signal = ExponentialAverage [ signalPeriod] (tsi)
Return signal as "TSI-Osc"