CONVERSION OF PINESCRIPT STRATEGY TO FOREX ROBOT

MQL4 Experts Converting

Job finished

Execution time 22 hours
Feedback from customer
Mehran made my script for a very competitive price all in just 1 day. I couldn't be happier. I will continue to use him in future if i need a freelancer. Would highly recommend
Feedback from employee
He is a great customer. Thanks...

Specification

//@version=4
strategy("OSPREY NO VISUAL", shorttitle="OSPREY NO VISUAL", overlay=true, pyramiding=1, calc_on_every_tick = false)


tick_round(x) => 
    round(x / syminfo.mintick) * syminfo.mintick

position = 0

//EMAs
ema_1 = ema(close, 55)
ema_2 = ema(close, 110)
ema_3 = ema(close, 200)

//Keltner Channel
ma      = sma(close, 20)
rangema = sma(tr, 20)
upper = ma + rangema 
lower = ma - rangema

// Signal for crossing Keltner Channel
crossUpper = crossover(close, upper)
crossLower = crossunder(close, lower)

//Signal for EMA Crossover
long_cross = crossover(ema_1, ema_2)
short_cross = crossover(ema_2, ema_1)

// Buying price - first high after the cross
bprice = 0.0
bprice := crossUpper ? low+syminfo.mintick : nz(bprice[1])

// Selling price - first low after the cross
sprice = 0.0
sprice := crossLower ? high -syminfo.mintick : nz(sprice[1]) 

crossBcond = false
crossBcond := crossUpper ? true 
 : na(crossBcond[1]) ? false : crossBcond[1]

crossScond = false
crossScond := crossLower ? true 
 : na(crossScond[1]) ? false : crossScond[1]

// Condition to cancel orders
cancelBcond = crossBcond and (close < ma or high >= bprice )
cancelScond = crossScond and (close > ma or low <= sprice )


// Active stop long order
waitingB = false
waitingB := position[1] == 1 ? false : crossUpper ? true : cancelBcond ? false : nz(waitingB[1])


// Active stop short order
waitingS = false
waitingS := position[1] == -1 ? false : crossLower ? true : cancelScond ? false : nz(waitingS[1])


// Long/Short signals
long1 = long_cross 
long2 = high >= bprice 
long3 = close > upper
long4 = close > ema_3

short1 = short_cross
short2 = low <=  sprice
short3 = close < lower
short4 = close < ema_3

long = 0
if (long1 and long2 and long3 and long4)
    long := 1

short = 0
if (short1 and short2 and short3 and short4)
    short := 1


// Keeping track of current position
position := long ? 1 : short ? -1 : nz(position[1])


//Limit Levels
stop_level_long = strategy.position_avg_price * (1 - 0.004)
take_level_long = strategy.position_avg_price * (1 + 0.008)
stop_level_short = strategy.position_avg_price * (1 + 0.004)
take_level_short  = strategy.position_avg_price * (1 - 0.008)

//Entries
strategy.entry("Long Entry", strategy.long, when=long)
strategy.exit("SL/TP", "Long Entry", stop=stop_level_long, limit=take_level_long)

strategy.entry("Short Entry", strategy.short, when=short)
strategy.exit("SL/TP", "Short Entry", stop=stop_level_short,limit=take_level_short)

Hi! I currently have a working strategy script on trading view that I have developed and am happy with the backtest data. I want you to take the entry and exit criteria that currently works so well, but implement them into an EA. The only input that the EA needs would be the risk % which the EA needs to correctly calculate the position size.


I would also like you to add comments throughout the code so i understand it :)


Responded

1
Developer 1
Rating
(359)
Projects
637
26%
Arbitration
91
71% / 13%
Overdue
12
2%
Working
Published: 1 code
2
Developer 2
Rating
(13)
Projects
35
71%
Arbitration
2
0% / 0%
Overdue
11
31%
Working
Published: 1 code
3
Developer 3
Rating
(88)
Projects
143
39%
Arbitration
21
19% / 48%
Overdue
30
21%
Free
4
Developer 4
Rating
(412)
Projects
543
75%
Arbitration
9
44% / 0%
Overdue
24
4%
Free
5
Developer 5
Rating
(560)
Projects
840
73%
Arbitration
15
53% / 13%
Overdue
193
23%
Working
6
Developer 6
Rating
(572)
Projects
943
47%
Arbitration
303
59% / 25%
Overdue
125
13%
Working

Project information

Budget
50+ USD
For the developer
45 USD