Convert Pinescript into MQL5 auto trading robot with minor modification

MQL5 Conversión

Tarea técnica

Below is the script I want to convert to MT5 the only addition is that I want to add a way to each time trade the maximum of my balance or the amount traded must go up with the amount of the 


//@version=2


strategy(title = "Strategy Code Example", shorttitle = "Strategy Code Example", overlay = true, pyramiding = 0, default_qty_type = strategy.percent_of_equity, default_qty_value = 10, currency = currency.GBP)

//
// *** THIS IS JUST AN EXAMPLE OF STRATEGY RISK MANAGEMENT CODE IMPLEMENTATION ***

// === GENERAL INPUTS ===
// short ma
maFastSource   = input(defval = open, title = "Fast MA Source")
maFastLength   = input(defval = 14, title = "Fast MA Period", minval = 1)
// long ma
maSlowSource   = input(defval = open, title = "Slow MA Source")
maSlowLength   = input(defval = 21, title = "Slow MA Period", minval = 1)

// === STRATEGY RELATED INPUTS ===
tradeInvert     = input(defval = false, title = "Invert Trade Direction?")
// the risk management inputs
inpTakeProfit   = input(defval = 1000, title = "Take Profit", minval = 0)
inpStopLoss     = input(defval = 200, title = "Stop Loss", minval = 0)
inpTrailStop    = input(defval = 200, title = "Trailing Stop Loss", minval = 0)
inpTrailOffset  = input(defval = 0, title = "Trailing Stop Loss Offset", minval = 0)

// === RISK MANAGEMENT VALUE PREP ===
// if an input is less than 1, assuming not wanted so we assign 'na' value to disable it.
useTakeProfit   = inpTakeProfit  >= 1 ? inpTakeProfit  : na
useStopLoss     = inpStopLoss    >= 1 ? inpStopLoss    : na
useTrailStop    = inpTrailStop   >= 1 ? inpTrailStop   : na
useTrailOffset  = inpTrailOffset >= 1 ? inpTrailOffset : na

// === SERIES SETUP ===
/// a couple of ma's..
maFast = ema(maFastSource, maFastLength)
maSlow = ema(maSlowSource, maSlowLength)

// === PLOTTING ===
fast = plot(maFast, title = "Fast MA", color = green, linewidth = 2, style = line, transp = 50)
slow = plot(maSlow, title = "Slow MA", color = red, linewidth = 2, style = line, transp = 50)

// === LOGIC ===
// is fast ma above slow ma?
aboveBelow = maFast >= maSlow ? true : false
// are we inverting our trade direction?
tradeDirection = tradeInvert ? aboveBelow ? false : true : aboveBelow ? true : false

// === STRATEGY - LONG POSITION EXECUTION ===
enterLong() => not tradeDirection[1] and tradeDirection // functions can be used to wrap up and work out complex conditions
exitLong() => tradeDirection[1] and not tradeDirection
strategy.entry(id = "Long", long = true, when = enterLong()) // use function or simple condition to decide when to get in
strategy.close(id = "Long", when = exitLong()) // ...and when to get out
// === STRATEGY - SHORT POSITION EXECUTION ===
enterShort() => tradeDirection[1] and not tradeDirection
exitShort() => not tradeDirection[1] and tradeDirection
strategy.entry(id = "Short", long = false, when = enterShort())
strategy.close(id = "Short", when = exitShort())

// === STRATEGY RISK MANAGEMENT EXECUTION ===
// finally, make use of all the earlier values we got prepped
strategy.exit("Exit Long", from_entry = "Long", profit = useTakeProfit, loss = useStopLoss, trail_points = useTrailStop, trail_offset = useTrailOffset)
strategy.exit("Exit Short", from_entry = "Short", profit = useTakeProfit, loss = useStopLoss, trail_points = useTrailStop, trail_offset = useTrailOffset)

Han respondido

1
Desarrollador 1
Evaluación
(55)
Proyectos
96
40%
Arbitraje
13
38% / 62%
Caducado
25
26%
Libre
2
Desarrollador 2
Evaluación
(549)
Proyectos
826
73%
Arbitraje
15
53% / 13%
Caducado
193
23%
Trabaja
3
Desarrollador 3
Evaluación
(8)
Proyectos
13
38%
Arbitraje
0
Caducado
2
15%
Libre
4
Desarrollador 4
Evaluación
(128)
Proyectos
162
36%
Arbitraje
4
25% / 50%
Caducado
13
8%
Libre
5
Desarrollador 5
Evaluación
(38)
Proyectos
50
10%
Arbitraje
1
0% / 0%
Caducado
8
16%
Libre
6
Desarrollador 6
Evaluación
(71)
Proyectos
97
43%
Arbitraje
2
50% / 0%
Caducado
2
2%
Libre
7
Desarrollador 7
Evaluación
(563)
Proyectos
932
47%
Arbitraje
302
59% / 25%
Caducado
124
13%
Trabajando
8
Desarrollador 8
Evaluación
(66)
Proyectos
143
34%
Arbitraje
10
10% / 60%
Caducado
26
18%
Libre
Solicitudes similares
CTRADER 30+ USD
can you help me with this project? Retrieve US30 asset price data from Ctrader Convert it to YM futures data Display the converted data on TradingView The reason why I need to convert US30 cfd prices from Ctrader into YM future prices is because all of my trading signals are from ctrader, and i need to trade on tradingview. Thanks
I need help with a small project. Basically I need to convert us30 asset price on Ctrader platform into YM futures on tradingview. Can you do it? It should be quite straight forward this is an example of what my trade signals look like
I have an Expert Advisor in ex4 and mq4 file formats that I would like to recreate with its original strategy. I believe the file have a bug or one error inside or maybe also is a Decomp file , and as a result, I am unable to understand the rules it follows to evaluate the market and open orders. I am looking for a developer who can help me reconstruct the strategy accurately. The mql4 format file would need to be
Skarito98 30 - 100 USD
Always stay winning and survive....we all want a better life now this is a chance someone can take,to change their lives for the better.No one is supposed to suffer in this world,we create and invert new things and come up with ideas to solve situations we come across especially when it comes to finance. We all need better things in life and God want good things for us
hello i need a professional to convert a fully functioning buy and sell signal strategy on tradingview to EA mt4 , the signals trigger when the bar closed match all conditions , it has a specific calculation for strength of each pair
Attached is a ThinkScript Strategy. I would like to convert it into an Expert Advisor for MQL4. Here is a link of a PineScript code for a similar indicator. This is just to give you additional info about the indicator, hence helping you to convert it from Thinkscript to MQL4
Only with feedbacks 30 - 100 USD
PINESCRIPT->MQL4 i need a exactly conversion of the file attached to mql4 with source code (i need the source code), obviously as indicator for mt4 let me know your bid and timeline
C onversion from Ninjatrader to Tradingview. This includes thorough testing and debugging to guarantee that the script functions as intended on Tradingview...If you are in for this job kindly bid
Hi, i have a tos script i need converted to Ninja script, but someone who knows both coding. Cant be someone who is just going to paste into chat gpt, it requires more understanding for compatibility
Hi, i have a tos script i need converted to Ninja script, but someone who knows both coding. Cant be someone who is just going to paste into chat gpt, it requires more understanding for compatibility

Información sobre el proyecto

Presupuesto
30+ USD
Para el ejecutor
27 USD