Lua to MT4 program conversion

指定

I need a programmer familiar with Lua to convert an EA written in Lua (Atached) for Trading Station platform to MET4 and make some additional modifications as explained below to it: 

The new EA needs to have the following characteristics:

Option 1) EA needs to identify the High and Low price within the last X hours

EA to write down the two values found above on the active screen for manual confirmation by user and draw a horizontal line through the two values

EA Properties variable Options to include:

No of Hrs prior for Highs and Lows determination NOHPHLD

Example of high low when NOHPHLD = 20 hours


a


Option 2) Also EA need to identify the Highs and Lows in the 2 previously completed ZigZag patterns And to draw the zigzag pattern on the active instrument chart as well as a horizontal line identifying the previous completed zigzag high and low. (I have included below the code for the ZigZag pattern I obtained from the list of TD Ameritrades indicators for your review and conversion to MET4 (granted the programming language of TD Ameritrade platform is different that the trading stations, but there are enough commonalities that you could possibly use that as a template for the type of variables and parameters I'd like the ZigZag indicator to include in it)

(Properties to be included are as follow): 


If the difference between the highs and lows is less than another user defined variable by the name of "Minimum accepted high low difference", then the EA will pick the higher or the lower of the previous zig zag High and Low until the difference between the highs and lows is greater than the "Minimum accepted high low difference".

Example: in the following figure, lets say that I set the Minimum accepted high low difference as 3.0

The previously completed zigzag high and low as seen below is 113.96 and 112.04. But the difference between 113.96 - 112.04 is less than 3. Therefore, the program would go back and pick the higher high and lower of the low of the two previous completed zigzag patterns which are 115.370 and 112.02. Now the difference between those two high and lows are greater than 3. Therefore, the program uses those two figures as the highs and the lows instead for the next part of the program.  

 



Other Variables to be included for this part of the EA:

ZZ Percent Reversal

Absolute Reversal

ATR Length

ATR Reversal


 

and Option to apply ZZ to one of the following chart times

30 min

1 hour

2 hour

4 hour

 

Trend stop_Color add ons:

Property to be added to the Trend Stop_Color strategy include options to either use the High Low value obtained from Option 1 above or option 2 above

Property to include a variable called “Delta pips from high Low (DPFHL)”

Criteria: only IF the price point is within the High +/- DPFHL, or Low +/- DPFHL, Trend Stop_Color can open a new position (Trend stop can always close the position at any point). Trendstop should not be able to open a new position if the price is outside of the High +/- DPFHL or Low +/- DPFHL


Example. Lets say that after establishing that the high and low in the option 2 above was 115.370 and 112.02, I set the DPFHL at 0.6.  This means that anytime the TrendStop has an open position order within price range of 115.37 +/- 0.3 or 112.02 +/- 0.3, then it should act on that order. Otherwise it should not open the new position. So, in the example below, the EA opens a long position when the trend stop line crosses below at 112.40 and closes that position when it crosses above at 112.8, but does not open a new position again when the trendstop line crosses below at 113.2 or when it crosses above at 113.1 because those values are outside of the range defined above. 


  


Additional variables to include options to allow opening the trades at any point in time or only during one or more of the following Trading Session (times are Eastern Standard Time):

NYT: 8:00 to 16:00

London: 3:00 to 11:00

Tokyo: 19:00 to 3:00

Sydney; 17:00 to 1:00


Add Variable to trigger new trade when bar crosses above (long position) or crosses below (short position) the Trendstop line or when the bar closes above or below the trendstop line.

 

Last thing to be added is with regards to the amount to be traded. Id like the EA to be able to break the dollar amount of the trades into multiple smaller orders, executed at X seconds from each other: (for example, if I am sending an order for 1 million, I'd like to be able to break down the orders by a factor of 10 (variable to be added)  or 1 Lot per order, submitted to the broker within a second of each other.  When closing the trades, all lots to be closed at the same time  

Variable to be included: Trade size:

Trade broken down by a factor of:   

Trades executed within how many seconds of one another:




And here is the code to the Zig Zag indicator on TD Ameritrade to model after: 
 input priceH = high;

input priceL = low;

input percentageReversal = 5.0;

input absoluteReversal = 0.0;

input atrLength = 5;

input atrReversal = 1.5;

 

Assert(percentageReversal >= 0, "'percentage reversal' must not be negative: " + percentageReversal);

Assert(absoluteReversal >= 0, "'absolute reversal' must not be negative: " + absoluteReversal);

Assert(atrReversal >= 0, "'atr reversal' must not be negative: " + atrReversal);

Assert(percentageReversal != 0 or absoluteReversal != 0 or atrReversal != 0, "Either 'percentage reversal' or 'absolute reversal' or 'atr reversal' must not be zero");

 

def hlPivot;

if (atrReversal != 0) {

    hlPivot = percentageReversal / 100 + WildersAverage(TrueRange(high, close, low), atrLength) / close * atrReversal;

} else {

    hlPivot = percentageReversal / 100;

}

def state = {default init, undefined, uptrend, downtrend};

def maxPriceH;

def minPriceL;

def newMax;

def newMin;

 

def prevMaxH = GetValue(maxPriceH, 1);

def prevMinL = GetValue(minPriceL, 1);

 

if GetValue(state, 1) == GetValue(state.init, 0) {

    maxPriceH = priceH;

    minPriceL = priceL;

    newMax = yes;

    newMin = yes;

    state = state.undefined;

} else if GetValue(state, 1) == GetValue(state.undefined, 0) {

    if priceH >= prevMaxH {

        state = state.uptrend;

        maxPriceH = priceH;

        minPriceL = prevMinL;

        newMax = yes;

        newMin = no;

    } else if priceL <= prevMinL {

        state = state.downtrend;

        maxPriceH = prevMaxH;

        minPriceL = priceL;

        newMax = no;

        newMin = yes;

    } else {

        state = state.undefined;

        maxPriceH = prevMaxH;

        minPriceL = prevMinL;

        newMax = no;

        newMin = no;

    }

} else if GetValue(state, 1) == GetValue(state.uptrend, 0) {

    if priceL <= prevMaxH - prevMaxH * hlPivot - absoluteReversal {

        state = state.downtrend;

        maxPriceH = prevMaxH;

        minPriceL = priceL;

        newMax = no;

        newMin = yes;

    } else {

        state = state.uptrend;

        if (priceH >= prevMaxH) {

            maxPriceH = priceH;

            newMax = yes;

        } else {

            maxPriceH = prevMaxH;

            newMax = no;

        }

        minPriceL = prevMinL;

        newMin = no;

    }

} else {

    if priceH >= prevMinL + prevMinL * hlPivot + absoluteReversal {

        state = state.uptrend;

        maxPriceH = priceH;

        minPriceL = prevMinL;

        newMax = yes;

        newMin = no;

    } else {

        state = state.downtrend;

        maxPriceH = prevMaxH;

        newMax = no;

        if (priceL <= prevMinL) {

            minPriceL = priceL;

            newMin = yes;

        } else {

            minPriceL = prevMinL;

            newMin = no;

        }

    }

}

 

def barNumber = BarNumber();

def barCount = HighestAll(If(IsNaN(priceH), 0, barNumber));

def newState = GetValue(state, 0) != GetValue(state, 1);

def offset = barCount - barNumber + 1;

def highPoint = state == state.uptrend and priceH == maxPriceH;

def lowPoint = state == state.downtrend and priceL == minPriceL;

 

def lastH;

if highPoint and offset > 1 {

    lastH = fold iH = 1 to offset with tH = priceH while !IsNaN(tH) and !GetValue(newState, -iH) do if GetValue(newMax, -iH) or iH == offset - 1 and GetValue(priceH, -iH) == tH then Double.NaN else tH;

} else {

    lastH = Double.NaN;

}

 

def lastL;

if lowPoint and offset > 1 {

    lastL = fold iL = 1 to offset with tL = priceL while !IsNaN(tL) and !GetValue(newState, -iL) do if GetValue(newMin, -iL) or iL == offset - 1 and GetValue(priceL, -iL) == tL then Double.NaN else tL;

} else {

    lastL = Double.NaN;

}

 

plot ZZ;

if barNumber == 1 {

    ZZ = fold iF = 1 to offset with tP = Double.NaN while IsNaN(tP) do if GetValue(state, -iF) == GetValue(state.uptrend, 0) then priceL else if GetValue(state, -iF) == GetValue(state.downtrend, 0) then priceH else Double.NaN;

} else if barNumber == barCount {

    ZZ = if highPoint or state == state.downtrend and priceL > minPriceL then priceH else if lowPoint or state == state.uptrend and priceH < maxPriceH then priceL else Double.NaN;

} else {

    ZZ = if !IsNaN(lastH) then lastH else if !IsNaN(lastL) then lastL else Double.NaN;

}

ZZ.SetDefaultColor(GetColor(1));

ZZ.EnableApproximation();

  

 

応答済み

1
開発者 1
評価
(119)
プロジェクト
127
41%
仲裁
3
33% / 67%
期限切れ
0
2
開発者 2
評価
(68)
プロジェクト
78
27%
仲裁
13
31% / 62%
期限切れ
15
19%
パブリッシュした人: 4 codes
3
開発者 3
評価
(4)
プロジェクト
12
42%
仲裁
0
期限切れ
0
4
開発者 4
評価
(29)
プロジェクト
49
22%
仲裁
13
31% / 15%
期限切れ
13
27%
5
開発者 5
評価
(219)
プロジェクト
370
42%
仲裁
145
17% / 41%
期限切れ
124
34%
パブリッシュした人: 38 codes
6
開発者 6
評価
(121)
プロジェクト
134
66%
仲裁
36
25% / 56%
期限切れ
22
16%
パブリッシュした人: 10 codes
7
開発者 7
評価
(101)
プロジェクト
136
36%
仲裁
14
29% / 50%
期限切れ
15
11%
8
開発者 8
評価
(80)
プロジェクト
117
67%
仲裁
16
25% / 13%
期限切れ
12
10%
パブリッシュした人: 2 codes
9
開発者 9
評価
(91)
プロジェクト
144
38%
仲裁
67
15% / 48%
期限切れ
55
38%
10
開発者 10
評価
(130)
プロジェクト
210
40%
仲裁
90
20% / 43%
期限切れ
85
40%
11
開発者 11
評価
(1)
プロジェクト
1
0%
仲裁
1
0% / 100%
期限切れ
0
類似した注文
Hi, I am looking for someone who has already developed a high-performance Gold EA that can outperform the one shown in my screenshot. If you have such an EA, please apply for this job. Please describe how the EA works (for example, whether it uses a grid system) and provide backtest results along with the set files. If the EA meets my expectations, you can make the necessary adjustments and I will use it as my own
CORE STRATEGY LOGIC (THIS IS WHAT MAKES MONEY IN 2025) Primary chart: Renko, 12-tick bricks (fixed, no user change) Instrument: XAUUSD or GC (auto-detect) Minimum tick size: 0.10 (standard Gold) MANDATORY FILTERS – ALL MUST BE TRUE OR NO TRADE 60-minute Trend Filter SMA(100) on 60-minute chart Longs only when current price > SMA100 (60-min) Check the attach file for full project details
Copytrade 30+ USD
Preciso de um copymaster para b3 onde tenho controle da escrava com números de contratos risco diário etc Controle de mensalidade , escrava onde pode utilizar de qualquer localidade e onde eu tenha controle
I have a bot that opens positions based on the opening candle of the New York and London markets. After an MT5 update, the bot stopped working. Does anyone know how to fix it
Request: I need a non-repainting MT5 indicator for the M5 timeframe that plots clear buy and sell arrows for Weltrade indices (similar to Boom and Crash on Deriv). Signals must be live and generated at the open of the M5 candle: a sell arrow at candle open must indicate a full 5-minute sell without spikes, and a buy arrow at candle open must indicate a full 5-minute buy without spikes. Note: I already started this
I’m developing a trading strategy on Polymarket (15‑minute prediction markets) and I’m looking for a developer who can help with backtesting and then implementing a bot. The strategy is fully rule‑based: • observes 4 crypto markets (BTC, ETH, SOL, XRP) • detects when 3 are in an “extreme zone” and 1 is lagging • enters in the expected direction of the laggard and exits when the gap closes I already have: • a formal
The Gorilla 30 - 200 USD
Hi, Mr the Gorilla I would like to make an order that might help us both but mostly me , I would like to order a robot to help me trade
Hello, i'm looking for a developer who can make an EA for MT5 based on 2 indicators from tradingview. Instrument: XAU/USD 1M timeframe Entry: Based on 2 indicators on tradingview Tp: i want to choose Sl: i want to choose Lotsize: i want to choose Days: i want to choose what day active
Hello, I need someone who can covert SuperTrend Strategy indicators on TradingView to an expert advisor with the Stop Loss and Take Profit . The trade shall close on opposite direction based on reversal . And have some features just like below . ART Length and Factor : We can customize the ART Length and Factor just like on TradingView for adaptable trade . Buy Entry: Open long trade right after the bar close (
i Would like to Make 1 New MT5 EA 1 with martingale ..can adjustable ( can input any number ) ( on/off ) 2 Support manuual Buy and Sell ( on/off ) 3 can manuual input Lot Size ( on/off ) 4 if manuual Buy or Sell it will auto input to Auto EA ( with all the item as auto EA ) 5 Max Order ( include manual and Auto Lots count ) 6 Buy Only ( on/off ) 7 Sell Only ( on/off ) 8 Take Profit Points ( 0 not in Use ) 10 Stop

プロジェクト情報

予算
2000 - 5000 USD
締め切り
最低 7 最高 21 日