I need a pinescript indicator converted to an MT4 indicator (for visualization) and develop a EA based on the indicator.

MQL4 Converting Consultation

Specification

I need a pinescript indicator converted to an MT4 indicator (for visualization) and develop a EA based on the indicator. 

The requirement for the EA:
- An adjustable lot size input and an back-up code to allow lot size be based on 2% of account balance.
- Only one trade per day.
- Entering condition follows the indicator direction, and a backup code to allow trade entering against indicator direction.
- Entering trade at a specific time of each day (Time A, an input I can adjust) (30 minute timeframe) 
- Entering trade using limit order (need a input to adjust gap between entering price and ask/bid price, say gap = 0.1 pip).
- Exiting trade based on the following:
-adjust table stop loss input in pips (and backup code to allow stop loss be calculated based on an input factor times ATR (at the time when entering order was placed;
-if certain number of pips (an input I can adjust) has been reached (profit) before TIMEOUT (explained below). Exit trade using limit order (need a input to adjust gap between exit price and ask/bid price, say 0.1 pip).
-if time of a day has reached a specirfic time (Time B or TIMEOUT, an input I can adjust), clear all pending orders and exit trade using market order. (Time B will be earlier than Time A of another day)
- An input to prevent trade on certain day of week.
- An input to prevent trade on a number days of year.

And as I am learning MQL4 (no coding background), I will also need you to answer some general questions as listed below and some questions relating to converted indicator/EA once I have reviewed / tested them.

Pinescript has a "barssince" function, how can I use that in MQL4?
Pinescript has a "valuewhen" function, how can I use that in MQL4?  
Pinescript has a "nz" function, how can I use that in MQL4?  e.g. htrack := max(high, nz(htrack[1], high))
From my understanding Pinescript performs a single run-throughfor every bars, so it is easy to get the lastest value of a series using (e.g) Series _A[0] and the value of the series for previous bar using Series_A[1], and the value N'th bar back using  Series_A[N].  How can i get the value of previous bar and the N the bar back in MQL4

This indicator does not repaint in tradingview so it shouldnt in MT4 either. 

Responded

1
Developer 1
Rating
(137)
Projects
220
52%
Arbitration
21
24% / 52%
Overdue
64
29%
Working
Published: 3 codes
2
Developer 2
Rating
(560)
Projects
840
73%
Arbitration
15
53% / 13%
Overdue
193
23%
Working

Project information

Budget
30 - 60 USD
For the developer
27 - 54 USD