Convert Pinescript into MQL5 auto trading robot with minor modification

MQL5 Conversão

Termos de Referência

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)

Respondido

1
Desenvolvedor 1
Classificação
(55)
Projetos
96
40%
Arbitragem
13
38% / 62%
Expirado
25
26%
Livre
2
Desenvolvedor 2
Classificação
(546)
Projetos
823
73%
Arbitragem
15
53% / 13%
Expirado
193
23%
Livre
3
Desenvolvedor 3
Classificação
(8)
Projetos
13
38%
Arbitragem
0
Expirado
2
15%
Livre
4
Desenvolvedor 4
Classificação
(125)
Projetos
157
36%
Arbitragem
4
25% / 50%
Expirado
13
8%
Livre
5
Desenvolvedor 5
Classificação
(38)
Projetos
50
10%
Arbitragem
1
0% / 0%
Expirado
8
16%
Livre
6
Desenvolvedor 6
Classificação
(71)
Projetos
97
43%
Arbitragem
2
50% / 0%
Expirado
2
2%
Livre
7
Desenvolvedor 7
Classificação
(555)
Projetos
922
48%
Arbitragem
300
59% / 25%
Expirado
123
13%
Trabalhando
8
Desenvolvedor 8
Classificação
(66)
Projetos
143
34%
Arbitragem
10
10% / 60%
Expirado
26
18%
Trabalhando
Pedidos semelhantes
Hello Good evening, I would like to convert an MT4 indicator to MT5. Is this possible? I will send you a screenshot of how the indicator works. It has up and down arrows. that's all. What is your cost for labor and delivery time
Hello, developer is requested to work only remotely by anydesk who has rich experience in debugging and generic variables I need to convert my code to mq5 For more information in private, thank you
Convert Trading View indicator to MT5. The source code is available for free on Trading View. Changing the colors of buffers used for each color must be allocated to separate buffers This is so that there is no difficulty in making a robot through the indicator need source file
Recherche codeur pour convertir mon script de stratégie pine script en mql5 afin d’en faire un ea fonctionnel gratuit si possible car très rapide ou alors arrangement à mes premier gain
Hello, I am kindly looking for a developer to help with the migration of an existing Expert Advisor from MQL4 to MQL5. The primary tasks required are: Code Migration: The current EA is based on MQL4 and needs to be rewritten for compatibility with MQL5. It is a straightforward mechanical limit order inventory management strategy (Grid), but it requires precise handling to ensure that its functionality remains
already have an advisor on mql4 and I want to adapt it to mql5, and chance some things on it, I was working with a developer but he is to busy to keep working on it the advisor has been tested and it does most of what we want it to do but, I need some adjusts
Hello there, I need a developer that can help me convert 2 TradingView Indicators into MT4 in 2 days. I need this to be perfectly converted and as soon as possible. Thanks
👋 hello great developer am looking for expert to help me with convert with this 2 pine script indicator into mt4 indicator? I will be looking for great developer to bid for this project. Best regards
Hello there, I need a developer that can help me convert 2 TradingView pinescripts into MT4 in 2 days. I need this to be perfectly converted and as soon as possible. Thanks
👋 hello great developer am looking for expert to help me with convert pine script indicator into mt4 indicator? I will be looking for great developer to bid for this project Best regards

Informações sobre o projeto

Orçamento
30+ USD
Desenvolvedor
27 USD