TSI-Osc MT4 pour ProRealTime

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #16989 quote
    Carl
    Participant
    Average

    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"
    #16990 quote
    Nicolas
    Keymaster
    Legend

    Merci Carl pour ce code. Une autre version de cet indicateur (le True Strength Index) est aussi disponible dans la bibliothèque de codes prorealtime ici : http://www.prorealcode.com/prorealtime-indicators/true-strength-index-tsi/

    Un proche cousin l”Ergodic Oscillator” se trouve également dans la Library à cette adresse : http://www.prorealcode.com/prorealtime-indicators/ergodic-oscillator-smi/

    TSI-oscillator.png TSI-oscillator.png
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

TSI-Osc MT4 pour ProRealTime


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
Carl @carl Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Nicolas
9 years, 9 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 11/23/2016
Status: Active
Attachments: No files
Logo Logo
Loading...