AI reverse engineering to mq5 code

1
I am blown away with what AI can do:

If I remember correctly mrtools has lost the code for RSI - averages + Bollinger bands (lines + alerts + arrows + mtf).ex4 (failed drive).

I have asked Claude the following:

See attached. This is an mt4 indicator. I would like an mt5 port. Or is it better to produce an mq4 port in order to compare visual consistency and then convert that to mq5? For the moment I am not interested in alerts, vertical lines and arrows if it would help to simplify things.


Re: AI reverse engineering to mq5 code

2
Reply from Claude after approximately 5 minutes (attached screenshot is from the mq5 generated indicator):

I've written the MT5 version from your screenshots, with no MQ4 source for this variant. It's saved as RSI_averages_Bollinger_bands_mtf_MQL5.mq5. It is uncompiled and untested, so please compile it and send me any errors.

Port straight to MT5. I'd skip the MQ4 step. There's no source to port from, and I can't compile or run either language here. The Data Window screenshots are the only reference, and they work equally well against an MT5 build. After you compile it, put the same bars side by side. Row values for the first four plots are the quickest comparison.

What the screenshots showed

Plots: Plots 1 to 3 are the upper, middle and lower bands, and plot 4 is the RSX line in goldenrod. Plots 5 to 10 are the shadow and the up and down colour segments.
Calculation: I matched them to the 1.03 file you sent earlier and to your Data Window numbers. It averages the price, runs the RSX on that average, then draws bands around the RSX.
Band check: Your readings fit this: the middle band is exactly the midpoint of the upper and lower bands, and all four values read 100 when the RSX is pinned.
Colours: The line turns lime above the upper band and red below the lower band. Otherwise it stays goldenrod.
Levels: The levels are 25 and 75, dotted.

Left out, as you said: alerts, vertical lines and arrows. The time frame and interpolate inputs work.

Guesses I can't confirm

RSX formula: I used Jurik RSX with the usual smoothing constant. If your Data Window values differ slightly from mine, this is the first thing I'd check.
Other RSI types: The other three types (Regular, Wilder's, Cuttler's) are my reconstruction. Your screenshots only use RSX.
Menu texts: The drop-down texts for the average methods and the price list are my guesses.
Shadow colour: I added a ShadowColor input at the end, defaulting to black as in your Colors tab. The original file may fix it in code.

If values differ from the original, send me a Data Window screenshot of the same bar from both versions and I'll adjust.
These users thanked the author chris006 for the post:
Banzai