//+------------------------------------------------------------------+
//| 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 clrGold
#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])+(3*Close[pos+1])+(3*Close[pos+2])-(Low[pos]+Open[pos]+High[pos]+Low[pos+1]+Open[pos+1]+High[pos+1]+Low[pos+2]+Open[pos+2]+High[pos+2]);
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);
}
We have to guess that you want this converted? Not even a ‘Please could someone convert this’?
If that is what you want then please follow the instructions that can be found here:
https://www.prorealcode.com/free-code-conversion/
The person doing the conversion needs far more than just the code to assist them. Please add the missing information to this post rather than submitting it again via the form.
How to formulate the request?
-
- Write a meaningful title, containing the name of the original code and its platform
e.g. “Conversion of indicator X from the Y trading software”
-
- Add a complete description and any useful information about the original code
- Add the original code in your description or as an attachment
- Add attachments files: screenshots, documents, code files, ..
(if the original code is an indicator, screenshots are greatly appreciated!)
Sorry about that my first time asking for a free code conversion thought that was straightforward please could you convert this for me thank you very much and kind regards now to the matter of the other parts
rex oscillator
rex Oscillator no-nonsense group or RONFX
This is all I have on the indicator sorry I hope it’s enough
Patrick
Rex Oscillator can be found here: Rex Oscillator
Hello Nicholas
I am afraid rex oscillator is not the same as the one that on Prorealtime someone’s changed something in the coding to make it smoother it’s not the settings I’m not sure what it is. If it’s not too much to ask when you have some time to take another look at the coding to see what’s smoothing out one of the lines you can see from the picture that I’ve shared in this post
thank you
Patrick
The version you have shared use a different calculation for the TVB (True Value of a Bar), which is not the original one as described by the author.
The TVB is defined as:
TVB = (Close-Low) + (Close – Open) – (High – Close), or
= 3 * Close – (Low + Open + High)
Good afternoon
Are you able to tell me what the calculation is in the mt4 I see it and I’ll post it below but I don’t understand it do you know what is actually doing and if so could you write it in the pro real-time version if that’s ok please thank you
{
TVB[pos]=(3*Close[pos])+(3*Close[pos+1])+(3*Close[pos+2])-(Low[pos]+Open[pos]+High[pos]+Low[pos+1]+Open[pos+1]+High[pos+1]+Low[pos+2]+Open[pos+2]+High[pos+2]);
pos--;
}
I just found this written by the person who’s changed the settings for the Rex oscillator
(( rex is calculated (3*close)/open+high+low. but its too fast, so i coded rex that calculates this for three days, therefore smoothing everything out. it shout hold trends for longer))
Good evening
I tried changing it myself been staring at it for ages and I thought I’ll give it a go but I’ve got no results back it looks the same i’m wondering if it’s to do with (pos=limit;) function in the mt4 what would be the similar thing in Prorealtime
TVB=3*Close+3*Close+3*Close-(Low+Open+High)-(Low+Open+High)-(Low+Open+High)
rexnfx=average[smoothlength,smoothmethod](tvb)/pointsize
signal=average[signallength,signalmethod](rexnfx)
return rexnfx coloured(0,255,0),signal coloured(255,0,0)
“pos” is the current bar in the MT4 code, so consider replacing all pos reference to 0.
So: Close[pos] is Close[0], or High[pos+2] is High[2]
Or use this code (not tested)
pos = 0
tvb=(3*Close[pos])+(3*Close[pos+1])+(3*Close[pos+2])-(Low[pos]+Open[pos]+High[pos]+Low[pos+1]+Open[pos+1]+High[pos+1]+Low[pos+2]+Open[pos+2]+High[pos+2])
Good afternoon Nicholas
Thank you for doing that now it’s very close to the original don’t know if I’ve missed something or it’s just the data itself but I’m fine with it now but he’s a picture anyway to show you thanks again
Patrick
I think I’ve spotted something else with the code pos=limit; but if(ExtCountedBars>2) limit=Bars–ExtCountedBars–1;
I don’t know if you factor this part in (limit=Bars–ExtCountedBars–1; )
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)
Got a very close similarity with this code:
//PRC_Rex Oscillator | indicator
//06.01.2020
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//converted from MT4 code
// --- settings
smoothlength=14
smoothmethod=0
signallength=14
signalmethod=0
// --- end of settings
//TVB=3*Close-(Low+Open+High)
pos = 0
tvb=(3*Close[pos])+(3*Close[pos+1])+(3*Close[pos+2])-(Low[pos]+Open[pos]+High[pos]+Low[pos+1]+Open[pos+1]+High[pos+1]+Low[pos+2]+Open[pos+2]+High[pos+2])
rex=average[smoothlength,smoothmethod](tvb)/pointsize
signal=average[signallength,signalmethod](rex)
return rex coloured(0,255,0),signal coloured(255,0,0)
Differences might come from different data between brokers. Calculation is exactly the same between the 2 codes!