Rex Oscillator indicator

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #111939 quote
    FinansDiagnosFinansDiagnos
    Participant
    Average

    Hi.

    The Rex oscillator measures market behavior based on the relationship of the close to the open, high and low values of the same bar. A big difference between the high and close on a bar indicates weakness, and wide disparity between the low and close indicates strength. The difference between open and close also indicates market performance.

    The True Value of a Bar (TVB) gives an indication of how healthy the market is. A negative close and a positive TVB (or vice versa) is an indication of the market building strength on the opposing side of the trend. The Rex oscillator is a moving average (SMA, EMA, WMA or SMMA) of the TVB value with the specified period.

    Interpretation

    When the Rex Oscillator turns positive in a bearish trend, a reversal is indicated. Likewise, Rex turning negative in a bull market indicates a reversal to the downside.

    I stumbled upon a very interesting indicator who would be very useful as an exitindicator. I have looked everywhere but I couldn’t find it ready for PRT.

    Here is the mq4-code:

    //+------------------------------------------------------------------+
    //| Rex.mq4 |
    //| Copyright © 2014, Gehtsoft USA LLC |
    //| http://fxcodebase.com |
    //+------------------------------------------------------------------+
    #property copyright "Copyright © 2014, Gehtsoft USA LLC"
    #property link "http://fxcodebase.com"
    
    #property indicator_separate_window
    #property indicator_buffers 3
    #property indicator_color1 Green
    #property indicator_color2 Red
    
    extern int Smoothing_Length=14;
    extern int Smoothing_Method=0; // 0 - SMA
    // 1 - EMA
    // 2 - SMMA
    // 3 - LWMA
    extern int Signal_Length=14;
    extern int Signal_Method=0; // 0 - SMA
    // 1 - EMA
    // 2 - SMMA
    // 3 - LWMA
    
    double Rex[], Signal[];
    double TVB[];
    
    int init()
    {
    IndicatorShortName("Rex oscillator");
    IndicatorDigits(Digits);
    SetIndexStyle(0,DRAW_LINE);
    SetIndexBuffer(0,Rex);
    SetIndexStyle(1,DRAW_LINE);
    SetIndexBuffer(1,Signal);
    SetIndexStyle(2,DRAW_NONE);
    SetIndexBuffer(2,TVB);
    
    return(0);
    }
    
    int deinit()
    {
    
    return(0);
    }
    
    int start()
    {
    if(Bars<=3) return(0);
    int ExtCountedBars=IndicatorCounted();
    if (ExtCountedBars<0) return(-1);
    int limit=Bars-2;
    if(ExtCountedBars>2) limit=Bars-ExtCountedBars-1;
    int pos;
    pos=limit;
    while(pos>=0)
    {
    TVB[pos]=3.*Close[pos]-(Low[pos]+Open[pos]+High[pos]);
    
    pos--;
    }
    
    pos=limit;
    while(pos>=0)
    {
    Rex[pos]=iMAOnArray(TVB, 0, Smoothing_Length, 0, Smoothing_Method, pos)/Point;
    
    pos--;
    }
    
    pos=limit;
    while(pos>=0)
    {
    Signal[pos]=iMAOnArray(Rex, 0, Signal_Length, 0, Signal_Method, pos);
    
    pos--;
    }
    
    return(0);
    }
    Rex.mq4 Rex_MQL.png Rex_MQL.png
    #112011 quote
    NicolasNicolas
    Keymaster
    Legend

    Here is the translated code for prorealtime:

    smoothlength=14
    smoothmethod=0
    signallength=14
    signalmethod=0
    
    TVB=3*Close-(Low+Open+High)
    
    rex=average[smoothlength,smoothmethod](tvb)/pointsize
    signal=average[signallength,signalmethod](rex)
    
    return rex coloured(0,255,0),signal coloured(255,0,0)
    
    rex-oscillator-indicator.png rex-oscillator-indicator.png
    #112038 quote
    FinansDiagnosFinansDiagnos
    Participant
    Average

    Thanks!!! What a service!

    Marvellous 🙂

Viewing 3 posts - 1 through 3 (of 3 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

Rex Oscillator indicator


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by FinansDiagnosFinansDiagnos
6 years, 11 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 11/03/2019
Status: Active
Attachments: 3 files
ProRealCode ProRealCode
Loading...