Convert PineScript V3 to MQL5

指定

//@version=3
//

strategy(title = "JustAmhas 3S2", shorttitle = "JustAmhas 3S1", overlay=true, pyramiding=0, default_qty_value=1, commission_value=0.05)


// === INPUTS ===
useRes      = true
intRes      = input(defval = 2,    title = "Multiplier for Alernate Resolution")
stratRes    = ismonthly? tostring(interval*intRes,"###M") : isweekly? tostring(interval*intRes,"###W") : isdaily?  tostring(interval*intRes,"###D") : isintraday ? tostring(interval*intRes,"####") : '60'
basisType   = input(defval = "TEMA", title = "MA Type: ", options=["DEMA","EMA", "TEMA", "WMA", "VWMA", "HullMA", "LSMA", "ALMA", "TMA", "SSMA"])
basisLen    = input(defval = 8, title = "MA Period", minval = 1)
offsetSigma = input(defval = 6, title = "Offset for LSMA / Sigma for ALMA", minval = 0)
offsetALMA  = input(defval = 0.85, title = "Offset for ALMA", minval = 0, step = 0.01)
delayOffset = 0

// Constants colours that include fully non-transparent option.
green100 = #008000FF
lime100  = #00FF00FF
red100   = #FF0000FF
blue100  = #0000FFFF
aqua100  = #00FFFFFF
darkred100 = #8B0000FF
gray100 = #808080FF

// === BASE FUNCTIONS ===
// Returns MA input selection variant, default to SMA if blank or typo.
variant(type, src, len, offSig, offALMA) =>
    v1 = sma(src, len)                                                  // Simple
    v2 = ema(src, len)                                                  // Exponential
    v3 = 2 * v2 - ema(v2, len)                                          // Double Exponential
    v4 = 3 * (v2 - ema(v2, len)) + ema(ema(v2, len), len)               // Triple Exponential
    v5 = wma(src, len)                                                  // Weighted
    v6 = vwma(src, len)                                                 // Volume Weighted
    v7 = 0.0
    v7 := na(v7[1]) ? sma(src, len) : (v7[1] * (len - 1) + src) / len    // Smoothed
    v8 = wma(2 * wma(src, len / 2) - wma(src, len), round(sqrt(len)))   // Hull
    v9 = linreg(src, len, offSig)                                       // Least Squares
    v10 = alma(src, len, offALMA, offSig)                               // Arnaud Legoux
    v11 = sma(v1,len)                                                   // Triangular (extreme smooth)
    // SuperSmoother filter
    // © 2013  John F. Ehlers
    a1 = exp(-1.414*3.14159 / len)
    b1 = 2*a1*cos(1.414*3.14159 / len)
    c2 = b1
    c3 = (-a1)*a1
    c1 = 1 - c2 - c3
    v12 = 0.0
    v12 := c1*(src + nz(src[1])) / 2 + c2*nz(v12[1]) + c3*nz(v12[2])
    type=="EMA"?v2 : type=="DEMA"?v3 : type=="TEMA"?v4 : type=="WMA"?v5 : type=="VWMA"?v6 : type=="SMMA"?v7 : type=="HullMA"?v8 : type=="LSMA"?v9 : type=="ALMA"?v10 : type=="TMA"?v11: type=="SSMA"?v12: v1

// security wrapper for repeat calls
reso(exp, use, res) => use ? security(tickerid, res, exp, gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_on) : exp


// === SERIES SETUP ===
closeSeries     = variant(basisType, close[delayOffset], basisLen, offsetSigma, offsetALMA)
openSeries      = variant(basisType, open[delayOffset], basisLen, offsetSigma, offsetALMA)


// === PLOTTING ===

// Get Alternate resolution Series if selected.
closeSeriesAlt = reso(closeSeries, useRes, stratRes)
openSeriesAlt = reso(openSeries, useRes, stratRes)
trendColour = (closeSeriesAlt > openSeriesAlt) ? green : red

bcolour     = (closeSeries > openSeriesAlt) ? lime100 : red100
closeP=plot(closeSeriesAlt, title = "Close Series", color = trendColour, linewidth = 2, style = line, transp = 20)
openP=plot(openSeriesAlt, title = "Open Series", color = trendColour, linewidth = 2, style = line, transp = 20)

fill(closeP,openP,color=trendColour,transp=80)


// === ALERT condition 1
xlong       = crossover(closeSeriesAlt, openSeriesAlt)
xshort      = crossunder(closeSeriesAlt, openSeriesAlt)

longCond    = xlong   // alternative: longCond[1]? false : (xlong or xlong[1]) and close>closeSeriesAlt and close>=open
shortCond   = xshort  // alternative: shortCond[1]? false : (xshort or xshort[1]) and close<closeSeriesAlt and close<=open

ebar            = 10000
dummy           = false

//
// Calculate how many mars since last bar
tdays       = (timenow-time)/60000.0  // number of minutes since last bar
tdays       := ismonthly? tdays/1440.0/5.0/4.3/interval : isweekly? tdays/1440.0/5.0/interval : isdaily? tdays/1440.0/interval : tdays/interval // number of bars since last bar

//set up exit parameters
TP = 200
SL = 200

// Make sure we are within the bar range, Set up entries and exit conditions
if (ebar==0 or tdays<=ebar)
    strategy.entry("long", strategy.long, when=longCond==true)
    strategy.entry("short", strategy.short, when=shortCond==true)
    strategy.close("long", when = shortCond==true)
    strategy.close("short", when = longCond==true)
    strategy.exit("exit", from_entry = "long", profit = TP, loss = SL)
    strategy.exit("exit", from_entry = "short", profit = TP, loss = SL)



反馈

1
开发者 1
等级
(290)
项目
432
64%
仲裁
5
40% / 0%
逾期
4
1%
已载入
2
开发者 2
等级
(30)
项目
55
22%
仲裁
12
67% / 8%
逾期
2
4%
空闲
3
开发者 3
等级
(408)
项目
536
75%
仲裁
9
44% / 0%
逾期
24
4%
空闲
4
开发者 4
等级
(4)
项目
6
0%
仲裁
4
25% / 75%
逾期
0
空闲
5
开发者 5
等级
(4)
项目
4
0%
仲裁
2
0% / 100%
逾期
1
25%
空闲
6
开发者 6
等级
(563)
项目
932
47%
仲裁
301
59% / 25%
逾期
124
13%
工作中
相似订单
I want to make a new dashboard using 3 common indicators and the ADX indicator , which you must supply I have a MA dash which you can strip & reuse if it helps you I tried to cover all questions in the attached but i'm sure there'll be more
I want the script in mql5 language for my martingale strategy. The script should open trades in both directions buy and sell and if any trade closes in loss then open new trade in that direction by using the next volume and when trade closes in profit then reset the volume to first from volume list and also maximum consecutive losses limit will apply. If trades closes consecutively in losses and hits the limit then
Long Position 1. Trend Line: When a Lower High (LH) is formed, draw a trend line from the previous Higher High (HH) to the new LH. 2. Trend Line Adjustment: If a new Lower High (LH) is formed without breaking the trend line, redraw the trend line to the new LH. Draw a trend line between the Higher High (HH) and the Higher Low (HL). If a new Higher High (HH) is formed, remove the previous trend line and draw a new one
I have a custom EA that works fine in the live market trading, but when doing a back test in the strategy tester , it does not open sell orders. There are no errors or warnings; it just doesn't open sell orders. I've checked every possible reason that might be the reason why it does not open sell orders, but I can't find anything, especially since it works fine in the real market and it opens both buys and sells
I'm looking for someone to help me create an arbitrage trading robot that can trade on any decentralized exchange and forex market. I already have some source code to a strategy but would like to enhance it to make it profitable and automated
I installed the E.A. into the Experts folder in MT4. When I double click on it nothing happens. When I right click and "attach to chart" nothing happens. The E.A. is not grayed out, it simply will not attach. Any help would be greatly Appreciated
I have an EA and want to add few new logic to fetch profit taking factors and other values from an external master data and use it in existing EA
I need EA that works on MT5 to be able to do the following: - Can recognize Support/Resistance area - Can recognize VWAP direction. - Can recognize RSI. - Can recognize Double Top/bottom, Bullish/Bearish hammer candle, Bullish/bearish engulfing candle. - Ability to set Stoploss below/above support/resistance, but risk must be fixed at a certain price. - Stoploss
I want a program that will help calculate and enter the market on full margin for me. I just need to put in the price for entry, Stop loss and TP then it will calculate the lot sizes for entering the trade on full margin on Mt5
I am seeking a highly skilled and experienced developer to assist with an important project. I need a development of an automated trading bot for NinjaTrader, utilizing a 4 SMA (Simple Moving Average) crossing strategy, with additional custom diversions for trade entries. The bot needs to be based on a strategy involving the crossing of four different SMAs. The exact periods for these SMAs and the conditions for

项目信息

预算
75+ USD
开发人员
67.5 USD