Turn this code into an ea

MQL4 Experts

Job finished

Execution time 14 days
Feedback from employee
Thanks for the job
Feedback from customer
Best developer I've worked with. Keen to continue with him in future. Thank you

Specification

//---- input parameters
extern int MAPeriod = 20;
extern double StopLoss = 10;
extern double TakeProfit = 20;

//---- global variables
int ticket = 0;
double ma = 0.0;

//---- initialization function
int init()
{
    // set up the chart
    SetIndexBuffer(0, ma);
    SetIndexStyle(0, DRAW_LINE);
    SetIndexShift(0, 0);
    SetIndexPeriod(0, MAPeriod);

    return(0);
}

//---- start function
int start()
{
    // identify the trend
    ma = iMA(NULL, 0, MAPeriod, 0, MODE_SMA, PRICE_CLOSE, 0);
    double slope = ma - iMA(NULL, 0, MAPeriod, 0, MODE_SMA, PRICE_CLOSE, 1);
    int trend = 0;
    if (slope > 0) {
        trend = 1; // bullish
    } else if (slope < 0) {
        trend = -1; // bearish
    }

    // look for entry and exit points
    double price = Ask;
    if (trend > 0 && price < ma) {
        ticket = OrderSend(Symbol(), OP_BUY, 0.01, price, 3, Bid - StopLoss * Point, Bid + TakeProfit * Point, "Buy", 0, 0, Green);
    } else if (trend < 0 && price > ma) {
        ticket = OrderSend(Symbol(), OP_SELL, 0.01, price, 3, Ask + StopLoss * Point, Ask - TakeProfit * Point, "Sell", 0, 0, Red);
    }

    // monitor the trade
    if (ticket > 0) {
        if (OrderSelect(ticket, SELECT_BY_TICKET)) {
            if (OrderCloseTime() == 0) {
                if (trend > 0) {
                    double stoploss = Bid - StopLoss * Point;
                    if (OrderStopLoss() < stoploss) {
                        bool modified = OrderModify(ticket, OrderOpenPrice(), stoploss, OrderTakeProfit(), 0, Green);
                        if (!modified) {
                            Alert("Error modifying stop loss: ", GetLastError());
                        }
                    }
                } else if (trend < 0) {
                    double stoploss = Ask + StopLoss * Point;
                    if (OrderStopLoss() > stoploss) {
                        bool modified = OrderModify(ticket, OrderOpenPrice(), stoploss, OrderTakeProfit(), 0, Red);
                        if (!modified) {
                            Alert("Error modifying stop loss: ", GetLastError());
                        }
                    }
                }
            }
        }
    }

    return(0);
}

Responded

1
Developer 1
Rating
(137)
Projects
162
22%
Arbitration
7
29% / 43%
Overdue
4
2%
Busy
2
Developer 2
Rating
(41)
Projects
54
4%
Arbitration
5
0% / 60%
Overdue
4
7%
Free
3
Developer 3
Rating
(42)
Projects
62
8%
Arbitration
12
58% / 42%
Overdue
1
2%
Free
4
Developer 4
Rating
(197)
Projects
201
27%
Arbitration
0
Overdue
3
1%
Free
5
Developer 5
Rating
(103)
Projects
160
33%
Arbitration
11
18% / 36%
Overdue
0
Loaded
6
Developer 6
Rating
(97)
Projects
135
52%
Arbitration
4
50% / 50%
Overdue
0
Working
7
Developer 7
Rating
(455)
Projects
514
33%
Arbitration
26
38% / 46%
Overdue
7
1%
Loaded
8
Developer 8
Rating
(298)
Projects
427
26%
Arbitration
18
61% / 33%
Overdue
26
6%
Free
9
Developer 9
Rating
(68)
Projects
79
9%
Arbitration
34
9% / 53%
Overdue
6
8%
Loaded
10
Developer 10
Rating
(58)
Projects
178
71%
Arbitration
4
100% / 0%
Overdue
1
1%
Working
11
Developer 11
Rating
(13)
Projects
16
38%
Arbitration
2
50% / 50%
Overdue
0
Free
12
Developer 12
Rating
(4)
Projects
6
0%
Arbitration
4
25% / 75%
Overdue
0
Free
13
Developer 13
Rating
(568)
Projects
641
41%
Arbitration
21
57% / 29%
Overdue
47
7%
Working
14
Developer 14
Rating
(769)
Projects
1033
44%
Arbitration
50
8% / 50%
Overdue
117
11%
Free
Similar orders
I am urgently in need of an expert full time programmer who can code an ea from scratch, Programming a well automated expert advisor from the existing strategy and make it work exactly more details will be provided in chat room thanks
Hello, I have implemented the method how to read the Toolbox Journal in MQL4, but this method does not work in MT5, because in MT5 the listview has LVS_OWNERDATA style. If you know or have a solution for MT5, without reading it from the log file, then please apply to this job. Regards, TradingProFX
I would need a robot that will automatically enter buy and sell positions based on the renko chart. The trend is to be determined on the basis of Elliot Waves. Individual peaks and troughs are determined by the TMA centerband Indicator. The buy position is entered when a higher low appears via the buy signal of the TMA indicator A sell position is entered when a lower high appears via the sell signal of the TMA
hi. I hv a strategy on tradingview need to convert to MT4/MT5 expert advisor for algo trading. would like to add some tradingview strategy setting to the EA(not included in my tradingview code): recalculate after order is filled, order size: xx% of equity
The idea of the trading system is as follows : market entries are performed when MACD's main and signal lines intersect in the current trend direction . 2. Trend is determined based on the Exponential Moving Average with the specified period (InpMATrendPeriod). If the current EMA value is greater than the previous one, the trend is seen as growing (ema_current > ema_previous). Alternatively, if current EMA is
Modify My EA 30+ USD
good day coder i want to add additional indicator to my ea The Coder should be able to code indicator to EA i will only send you source code if you can proof the indicator can be coded into ea all other features will be discussed inside but the major part is this peculiar indicator i am available for discussion My time zone is GMT+1 Source code will be release and tested on live market i trade from monday to sunday
Hello , By slippage control on Take profit and stoploss functions the ea won't implement different results of TP and Stoploss on volatile markets, target is to produce exact numbers of sl and tp on live executions .A coder who has done this type of job will be the choice . lot sizing will be added to EA
Use indicator provided to produce support and resistance levels, and enter trade if price reaches s/r level which user has specified in settings. TP and SL should also come from user settings. TP and SL options should be s/r levels. EA trade should only be opened if there is a trade already open from another EA, based on magic number. EA should check for magic number from other EA, and only enter trade if there is a
1. Idea uruchomienia jest następująca : wejście na rynek ma miejsce, gdy główna linia MACD przecina się z linią sygnałową zgodnie z aktualnym uruchamianiem trendu . 2. Trend jest ustalany na podstawie średniej kroczącej wykładniczej z określonym okresem (InpMATrendPeriod). Jeśli bieżąca wartość EMA jest większa od sieci, trend jest postrzegany jako rosnący (ema_current > ema_previous). Alternatywnie, jeśli
Hello, Need to create an EA solely based on an indicator. Will provide the indicator, which is just available on the market. The EA will just trade based on the signals and close trades based on my parameter

Project information

Budget
40+ USD
For the developer
36 USD
Deadline
to 1 day(s)