Job finished
Execution time 4 days
![](https://c.mql5.com/i/avatar/avatar_na2.png)
Feedback from employee
Very good to work with.
Specification
I need an expert advisor to check for existing positions with a set take profit target and to close 1/3 of the position if the price reaches 1/3 of the take profit target and close another 1/3 of the position if price reaches 2/3 of the take profit target.
This is what google bard wrote but has too many errors.
If it could auto get the symbol from the chart that it is loaded onto that would be better too.
//+------------------------------------------------------------------+
//| Expert Advisor code generated by MetaTrader 5 |
//| |
//| Author: Bard |
//| Date: 2023-05-14 |
//| |
//+------------------------------------------------------------------+
#property copyright "Bard"
#property link "https://bard.ai"
#property version "1.00"
#include <Trade\PositionInfo.mqh>
#include <Trade\Trade.mqh>
#include <Trade\SymbolInfo.mqh>
#include <Trade\AccountInfo.mqh>
//--- variables
CPositionInfo m_position; // trade position object
CTrade m_trade; // trading object
CSymbolInfo m_symbol; // symbol info object
CAccountInfo m_account; // account info wrapper
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit() {
// Get the symbol info
m_symbol = SymbolInfo("US30.a");
// Get the account info
m_account = AccountInfo();
// Set the expert magic number
m_trade.SetExpertMagicNumber(13324);
// Set the deviation in points
m_trade.SetDeviationInPoints(10);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit() {}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick() {
// Get the current price
double price = MarketInfo("US30.a", MODE_BID);
// Check if there are any open orders
if (m_trade.GetOrdersTotal() > 0) {
// Loop through the open orders
for (int i = 0; i < m_trade.GetOrdersTotal(); i++) {
// Get the current order
CTrade order = m_trade.GetOrder(i);
// Check if the order is a buy or sell order
if (order.GetType() == ORDER_TYPE_LONG || order.GetType() == ORDER_TYPE_SHORT) {
// Calculate the 1/3 take profit price
double takeProfit1 = price + (m_symbol.GetStopLoss() / 3);
// Calculate the 2/3 take profit price
double takeProfit2 = price + (m_symbol.GetTakeProfit() / 2);
// Check if the price has reached the 1/3 take profit price
if (price >= takeProfit1) {
// Sell 1/3 of the position
if (order.GetType() == ORDER_TYPE_LONG) {
m_trade.Sell(order.GetLots() / 3, order.GetPrice());
} else {
m_trade.Buy(order.GetLots() / 3, order.GetPrice());
}
}
// Check if the price has reached the 2/3 take profit price
if (price >= takeProfit2) {
// Sell another 1/3 of the position
if (order.GetType() == ORDER_TYPE_LONG) {
m_trade.Sell(order.GetLots() / 3, order.GetPrice());
} else {
m_trade.Buy(order.GetLots() / 3, order.GetPrice());
}
}
}
}
}
}
//+------------------------------------------------------------------+
//| Expert start function |
//+------------------------------------------------------------------+
void OnStart() {
}
//+------------------------------------------------------------------+
//| Expert stop function |
//+------------------------------------------------------------------+
void OnStop() {
}
Responded
1
Rating
Projects
17
65%
Arbitration
3
0%
/
100%
Overdue
1
6%
Free
2
Rating
Projects
109
34%
Arbitration
5
40%
/
20%
Overdue
5
5%
Working
3
Rating
Projects
54
4%
Arbitration
5
0%
/
60%
Overdue
4
7%
Free
4
Rating
Projects
11
36%
Arbitration
3
0%
/
100%
Overdue
0
Free
5
Rating
Projects
160
23%
Arbitration
7
0%
/
43%
Overdue
4
3%
Loaded
6
Rating
Projects
59
27%
Arbitration
25
20%
/
52%
Overdue
10
17%
Working
7
Rating
Projects
84
26%
Arbitration
23
22%
/
48%
Overdue
23
27%
Free
8
Rating
Projects
932
47%
Arbitration
301
59%
/
25%
Overdue
124
13%
Working
9
Rating
Projects
512
33%
Arbitration
25
40%
/
48%
Overdue
7
1%
Loaded
10
Rating
Projects
175
71%
Arbitration
4
100%
/
0%
Overdue
1
1%
Free
11
Rating
Projects
50
42%
Arbitration
3
33%
/
33%
Overdue
4
8%
Free
12
Rating
Projects
400
54%
Arbitration
9
67%
/
22%
Overdue
36
9%
Free
Similar orders
I'm looking for an expert MQL5 developer that can create an EA that's based on my price action trading strategy with no indicators. The EA must analyze trades based on my price action rules, enter trades based on my price action rules, manage trades based on my price action rules and exit trades based on my price action rules
hi hi there i have an strategy on tradingview and i want to automate it like metatrader EA so i want the strategy to open and close trade automaticlly on tradingview
Expert Advisor Developer for MT5
30 - 100 USD
We are looking for an experienced Expert Advisor Developer who can build a customized MT5 Expert Advisor for us. The Expert Advisor would use two built-in indicators as entry/exit signals and our own risk management strategy with customizable inputs. The goal is to create a reliable and efficient trading tool that can automate our trading process on the MT5 platform. Skills required: - Strong understanding of
Need stochastic divergence ea
30 - 40 USD
I need stochastic div (hidden ®ular ea) that should perform task in all tf's ..divergence is a repaint stly so i want to use it with candlestick flips .. so bet for it
Replicate indicator to mt5
30+ USD
Hello, I have an indicator from a friend and I'd like to replicate it on my own TradingView or MT5 platform. Could you assist me with that?. Here is the link
so basically I have an EA(mql5), AI script(python), flask server and socket server both on python. Now this is an experimental script as I am trying to learn. However the EA is not entering any trades. How much would it cost for you to troubleshoot this for me? Thank you in advance
NEW FUNCTION
50+ USD
La idea es la siguiente, sería un EA semi automático. Yo como trader opero en zonas. En adelante las vamos a denominar ``zonas calientes´´. El EA debe que necesito debe operar conforme a 4 zonas calientes que yo configure en el mismo. ¿Qué hará el EA en cada una de esas zonas calientes que yo he configurado? En cada una de estas zonas el EA debe realizar hedging (crear un rango en el cual el EA entrara en sell o en
I have the bot just over half made, from another developer who let me down and decided they no longer wished to finish the project, so I have a basic example of the fundamentals of what it could look like, although multiple functions I require do not work, but I can show this to you on request. There are multiple features that I require, so please read the in depth requirement sheet on the attachment. Function: To
Create an EA VWAP + RSI for MT5
50 - 100 USD
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
Boulē’s Full Margin Trader
30 - 50 USD
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
Project information
Budget
30 - 100 USD
For the developer
27
- 90
USD