Translate a script from Thinkscript used on ThinkorSwim platform to MQL5

2020.07.30 Indicators Converting

Specification

so I have this indicator in ThinkScript but I need to convert it to MQL5 im not sure how to write script and call that script function into an indicator function to plot it, Ive done it before in EasyLanguage on Tradestaion but their coding is much simpler than MQL5..... input length = 21;
input lengthG = 8;
input beta = 8; script g {
    input length  = 4;
    input betaDev =  2;
    input data = close;
    def w = (2 * Double.Pi / length);
    def beta = (1 - Cos(w)) / (Power(1.414, 2.0 / betaDev) - 1 );
    def alpha = (-beta + Sqrt(beta * beta + 2 * beta));
    def G = Power(alpha, 4) * data + 
                 4 * (1 – alpha) * G[1] – 6 * Power( 1 - alpha, 2 ) * G[2] + 
                 4 * Power( 1 - alpha, 3 ) * G[3] - Power( 1 - alpha, 4 ) * G[4];
    plot Line = G;
} def val = g(length = lengthG, betaDev = beta, Data = close);
plot Zscore = (close - Average(val, length)) / StDev(val, length); 
plot smoothed = g(data = Zscore);

Responded

1
Developer 1
2020.07.30
Rating
4.99
(559)
Projects
742
70%
Arbitration
9
33% / 33%
Overdue
34
5%
Working
2
Developer 2
2020.07.30
Rating
4.96
(342)
Projects
529
65%
Arbitration
28
32% / 54%
Overdue
41
8%
Free
3
Developer 3
2020.07.30
Rating
4.93
(626)
Projects
1075
72%
Arbitration
84
27% / 45%
Overdue
349
32%
Loaded
4
Developer 4
2020.07.31
Rating
5
(3)
Projects
3
0%
Arbitration
0
Overdue
0
Working
5
Developer 5
2020.07.31
Rating
1
(1)
Projects
0
0%
Arbitration
2
0% / 50%
Overdue
0
Free
6
Developer 6
2020.07.31
Rating
4.94
(36)
Projects
39
23%
Arbitration
0
Overdue
1
3%
Free
7
Developer 7
2020.08.01
Rating
5
(1)
Projects
1
0%
Arbitration
0
Overdue
1
100%
Free
8
Developer 8
2020.08.02
Rating
5
(418)
Projects
671
71%
Arbitration
13
46% / 15%
Overdue
218
32%
Working

Project information

Budget
31 - 200 USD
For the developer
27.9 - 180 USD

Customer

Placed orders1
Arbitrage count0