Converting Pine script (Tradingview) into Expert advisor (Trading robot) in MT4

2020.03.18 Experts

Specification

convert it into a MT4 EA with features to include controlling lot sizes, trailing stops, and stop loss , take profit .

be sure its not repainting .

study("MavilimW buy sell alert by coinsspor", overlay=true)
mavilimold = input(false, title="Show Previous Version of MavilimW?")
fmal=input(3,"First Moving Average length")
smal=input(5,"Second Moving Average length")
tmal=fmal+smal
Fmal=smal+tmal
Ftmal=tmal+Fmal
Smal=Fmal+Ftmal

M1= wma(close, fmal)
M2= wma(M1, smal)
M3= wma(M2, tmal)
M4= wma(M3, Fmal)
M5= wma(M4, Ftmal)
MAVW= wma(M5, Smal)
col1= MAVW>MAVW[1]
col3= MAVW<MAVW[1]
color = col1 ? blue : col3 ? red : yellow

plot(MAVW, color=color, linewidth=2, title="MAVW")

M12= wma(close, 3)
M22= wma(M12, 5)
M32= wma(M22, 8)
M42= wma(M32, 13)
M52= wma(M42, 21)
MAVW2= wma(M52, 34)

plot(mavilimold and MAVW2 ? MAVW2 : na, color=blue, linewidth=2, title="MavWOld")

baraMIrenkMI = input(true, title="Buy sell option on/off , ON >> bar crosses on line... OFF >> depends line colors ")

l1= close>MAVW and close[1]<=MAVW[1]
s1=close<MAVW and close[1]>=MAVW[1]

longCond=baraMIrenkMI ?l1: col1
shortCond=baraMIrenkMI ?s1: col3



last_signal = 0
long_final = longCond and (nz(last_signal[1]) == 0 or nz(last_signal[1]) == -1)
short_final = shortCond and (nz(last_signal[1]) == 0 or nz(last_signal[1]) == 1)
bgcolor( (nz(last_signal[1]) == 0 or nz(last_signal[1]) == -1) ? blue : green, transp=93)

bgcolor( long_final? blue : na, transp=93)
bgcolor( short_final? red : na, transp=93)
alertcondition(long_final, title="buy alarm", message="buy signal!!!")
alertcondition(short_final, title="sell alarm", message="sell signal!!!")
last_signal := long_final ? 1 : short_final ? -1 : last_signal[1]

plotshape(long_final, style=shape.labelup,
location=location.belowbar, color=blue,size=size.tiny,title="buy label",text="BUY",textcolor=white)
plotshape(short_final, style=shape.labeldown,
location=location.abovebar, color=red,size=size.tiny,title="sell label",text="SELL",textcolor=white)


Responded

1
Developer 1
2020.03.18
Rating
4.95
(204)
Projects
256
41%
Arbitration
10
20% / 30%
Overdue
77
30%
Loaded
2
Developer 2
2020.03.18
Rating
4.92
(203)
Projects
334
66%
Arbitration
9
56% / 0%
Overdue
84
25%
Free

Project information

Budget
30+ USD
For the developer
27 USD
Deadlines
from 1 day(s)

Customer

Placed orders25
Arbitrage count2