Job finished
Execution time 3 days
Feedback from employee
Great customer, nice feedbacks. It is a pleasure to help him.
Feedback from customer
He is a very kind and genuine person and has completed work on time. Skillful and Trustworthy developer!
Specification
PLEASE SEE THE BELOW TABLE AND ADD THESE AS ADDITIONAL FEATURE OF THE EXISTING EA
//+------------------------------------------------------------------+
//| HedgeEA_V1.mq4 |
//| Copyright 2021, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
enum ENUM_OPEN_TYPE {TYPE1, //Type1: Instant Hedging
TYPE2 //Type2: Price Entry
};
enum ENUM_TRADE_DIRECTION {BUY,SELL,BOTH};
//+------------------------------------------------------------------+
//| Trades |
//+------------------------------------------------------------------+
extern string Trades="<<=== TRADES ===>>"; //.
extern int Magic=54126548; //Magic Number
extern string TradeComment="VtranscriptionEA"; //Trade Comment
extern ENUM_TRADE_DIRECTION Direction=BOTH; //Trade Direction
extern ENUM_OPEN_TYPE OpenType=TYPE1; //Trade Open Type
extern double EntryPrice=1.20000; //Enter Price
extern double MaxSpread=3; //Max Spread(Pips)
extern string Vols="<<=== Lot Size ===>>";
extern double FixedLotSize=0.1; //Fixed Lot Size [0:Auto]
extern double LotRisk=1; //Risk % of Equity
extern string Param="<<=== SETTINGS ===>>"; //.
extern double UserSL=20; //Stop Loss(Pips) [0:off]
extern double UserTP=20; //Take Profit(Pips)[0:off]
extern double Distance=10; //Distance(Pips)[0:off]
//+------------------------------------------------------------------+
//| Global Variables |
//+------------------------------------------------------------------+
int Bar=0;
int DBar=0;
string Description;
double Pip=Point()*10;
datetime TimeIndex=0;
//+------------------------------------------------------------------+
//| Structer |
//+------------------------------------------------------------------+
struct OrderStr
{
int Step;
double Lot;
string Start;
double TP_Price;
double SL_Price;
};
//---
OrderStr Buy,Sell,Order;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- create timer
EventSetTimer(60);
//---
if(OpenType==TYPE1)
Take_Instant_Positions();
if(OpenType==TYPE2)
Place_Initial_Pending();
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//--- destroy timer
EventKillTimer();
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
// datetime NY=D'2021.12.15';
//if(TimeCurrent()>=NY )
// {
// Comment("Product Expired,Contact the Author");
// ExpertRemove();
// }
//---
if(Distance==0)
{
if(Is_Hit_SL())
Take_Another_Positions();
//---
if(Is_Hit_TP())
Take_Another_Positions();
}
if(Distance>0)
{
Place_Pending();
}
//---
}
//+------------------------------------------------------------------+
//| Timer function |
//+------------------------------------------------------------------+
void OnTimer()
{
//---
}
//+------------------------------------------------------------------+
//| Taking Positions |
//+------------------------------------------------------------------+
void Take_Instant_Positions()
{
double spread=MarketInfo(_Symbol,MODE_SPREAD);
if(spread<=MaxSpread*10)
if(Direction==BUY || Direction==BOTH)
if(Positions_Buy_Num()==0)
{
Order.Step=1;
//---
Buy.Lot=LotSize();
//---
Buy.Lot=NormalizeLots(Buy.Lot,Symbol());
//---
int BuyTicket=0;
//---
if(CheckMoneyForTrade(_Symbol,Buy.Lot,OP_BUY))
if(CheckVolumeValue(Buy.Lot,Description))
BuyTicket=OrderSend(_Symbol,OP_BUY,Buy.Lot,Ask,10,0,0,TradeComment,Magic,0,clrBlue);
//---
Order.Start="Begin";
//---
if(UserTP>0)
Buy.TP_Price=Ask+UserTP*Pip;
else
Buy.TP_Price=0;
//---
if(UserSL>0)
Buy.SL_Price=Ask-UserSL*Pip;
else
Buy.SL_Price=0;
//---
Order_SLTP_Modification(Buy.SL_Price,Buy.TP_Price,BuyTicket);
//---
TimeIndex=TimeCurrent();
}
//---
if(spread<=MaxSpread*10)
if(Direction==SELL|| Direction==BOTH)
if(Positions_Sell_Num()==0)
{
Order.Step=1;
//---
Sell.Lot=LotSize();
//---
Sell.Lot=NormalizeLots(Sell.Lot,Symbol());
//---
int SellTicket=0;
if(CheckMoneyForTrade(_Symbol,Sell.Lot,OP_SELL))
if(CheckVolumeValue(Sell.Lot,Description))
SellTicket=OrderSend(_Symbol,OP_SELL,Sell.Lot,Bid,10,0,0,TradeComment,Magic,0,clrRed);
//---
Order.Start="Begin";
//---
if(UserTP>0)
Sell.TP_Price=Bid-UserTP*Pip;
else
Sell.TP_Price=0;
//---
if(UserSL>0)
Sell.SL_Price=Bid+UserSL*Pip;
else
Sell.SL_Price=0;
//---
Order_SLTP_Modification(Sell.SL_Price,Sell.TP_Price,SellTicket);
//---
TimeIndex=TimeCurrent();
}
//---
}
//+------------------------------------------------------------------+
//| Taking Positions |
//+------------------------------------------------------------------+
void Take_Another_Positions()
{
double spread=MarketInfo(_Symbol,MODE_SPREAD);
if(spread<=MaxSpread*10)
if(Direction==BUY || Direction==BOTH)
{
Order.Step++;
//---
Buy.Lot=LotSize();
//---
Buy.Lot=NormalizeLots(Buy.Lot,Symbol());
//---
int BuyTicket=0;
//---
if(CheckMoneyForTrade(_Symbol,Buy.Lot,OP_BUY))
if(CheckVolumeValue(Buy.Lot,Description))
BuyTicket=OrderSend(_Symbol,OP_BUY,Buy.Lot,Ask,10,0,0,TradeComment,Magic,0,clrBlue);
//---
Order.Start="Begin";
//---
if(UserTP>0)
Buy.TP_Price=Ask+UserTP*Pip;
else
Buy.TP_Price=0;
//---
if(UserSL>0)
Buy.SL_Price=Ask-UserSL*Pip;
else
Buy.SL_Price=0;
//---
Order_SLTP_Modification(Buy.SL_Price,Buy.TP_Price,BuyTicket);
//---
TimeIndex=TimeCurrent();
}
//---
if(spread<=MaxSpread*10)
if(Direction==SELL|| Direction==BOTH)
{
Order.Step=1;
//---
Sell.Lot=LotSize();
//---
Sell.Lot=NormalizeLots(Sell.Lot,Symbol());
//---
int SellTicket=0;
if(CheckMoneyForTrade(_Symbol,Sell.Lot,OP_SELL))
if(CheckVolumeValue(Sell.Lot,Description))
SellTicket=OrderSend(_Symbol,OP_SELL,Sell.Lot,Bid,10,0,0,TradeComment,Magic,0,clrRed);
//---
Order.Start="Begin";
//---
if(UserTP>0)
Sell.TP_Price=Bid-UserTP*Pip;
else
Sell.TP_Price=0;
//---
if(UserSL>0)
Sell.SL_Price=Bid+UserSL*Pip;
else
Sell.SL_Price=0;
//---
Order_SLTP_Modification(Sell.SL_Price,Sell.TP_Price,SellTicket);
//---
TimeIndex=TimeCurrent();
}
//---
}
//+------------------------------------------------------------------+
//| Place Initial Pending Order |
//+------------------------------------------------------------------+
void Place_Initial_Pending()
{
if(Direction==BUY || Direction==BOTH)
if(Order_Buy_Num()==0)
{
int BuyTicket=0;
if(Ask>EntryPrice)
BuyTicket=OrderSend(_Symbol,OP_BUYLIMIT,LotSize(),EntryPrice,5,0,0,TradeComment,Magic,0,clrBlue);
if(Ask<EntryPrice)
BuyTicket=OrderSend(_Symbol,OP_BUYSTOP,LotSize(),EntryPrice,5,0,0,TradeComment,Magic,0,clrBlue);
//---
if(UserTP>0)
Buy.TP_Price=EntryPrice+UserTP*Pip;
else
Buy.TP_Price=0;
//---
if(UserSL>0)
Buy.SL_Price=EntryPrice-UserSL*Pip;
else
Buy.SL_Price=0;
//---
Order_SLTP_Modification(Buy.SL_Price,Buy.TP_Price,BuyTicket);
}
//---
if(Direction==SELL || Direction==BOTH)
if(Order_Sell_Num()==0)
{
int SellTicket=0;
if(Bid>EntryPrice)
SellTicket=OrderSend(_Symbol,OP_SELLSTOP,LotSize(),EntryPrice,5,0,0,TradeComment,Magic,0,clrRed);
if(Bid<EntryPrice)
SellTicket=OrderSend(_Symbol,OP_SELLLIMIT,LotSize(),EntryPrice,5,0,0,TradeComment,Magic,0,clrRed);
//---
if(UserTP>0)
Sell.TP_Price=EntryPrice-UserTP*Pip;
else
Sell.TP_Price=0;
//---
if(UserSL>0)
Sell.SL_Price=EntryPrice+UserSL*Pip;
else
Sell.SL_Price=0;
//---
Order_SLTP_Modification(Sell.SL_Price,Sell.TP_Price,SellTicket);
}
}
//+------------------------------------------------------------------+
//| Place Pending Order |
//+------------------------------------------------------------------+
void Place_Pending()
{
if(Direction==BUY || Direction==BOTH)
{
if(Order_Num(OP_BUYSTOP)==0)
{
int BuyTicket=0;
//---
double Price=Ask+Distance*Point()*10;
BuyTicket=OrderSend(_Symbol,OP_BUYSTOP,LotSize(),Price,5,0,0,TradeComment,Magic,0,clrBlue);
//---
if(UserTP>0)
Buy.TP_Price=Price+UserTP*Pip;
else
Buy.TP_Price=0;
//---
if(UserSL>0)
Buy.SL_Price=Price-UserSL*Pip;
else
Buy.SL_Price=0;
//---
Order_SLTP_Modification(Buy.SL_Price,Buy.TP_Price,BuyTicket);
}
//---
if(Order_Num(OP_BUYLIMIT)==0)
{
double Price=Ask-Distance*Point()*10;
int BuyTicket=OrderSend(_Symbol,OP_BUYLIMIT,LotSize(),Price,5,0,0,TradeComment,Magic,0,clrBlue);
//---
if(UserTP>0)
Buy.TP_Price=Price+UserTP*Pip;
else
Buy.TP_Price=0;
//---
if(UserSL>0)
Buy.SL_Price=Price-UserSL*Pip;
else
Buy.SL_Price=0;
//---
Order_SLTP_Modification(Buy.SL_Price,Buy.TP_Price,BuyTicket);
}
}
//---
if(Direction==SELL || Direction==BOTH)
{
if(Order_Num(OP_SELLLIMIT)==0)
{
int SellTicket=0;
//---
double Price=Bid+Distance*Point()*10;
SellTicket=OrderSend(_Symbol,OP_SELLLIMIT,LotSize(),Price,5,0,0,TradeComment,Magic,0,clrRed);
//---
if(UserTP>0)
Sell.TP_Price=Price-UserTP*Pip;
else
Sell.TP_Price=0;
//---
if(UserSL>0)
Sell.SL_Price=Price+UserSL*Pip;
else
Sell.SL_Price=0;
//---
Order_SLTP_Modification(Sell.SL_Price,Sell.TP_Price,SellTicket);
}
//---
if(Order_Num(OP_SELLSTOP)==0)
{
double Price=Bid-Distance*Point()*10;
int SellTicket=OrderSend(_Symbol,OP_SELLSTOP,LotSize(),Price,5,0,0,TradeComment,Magic,0,clrRed);
//---
if(UserTP>0)
Sell.TP_Price=Price-UserTP*Pip;
else
Sell.TP_Price=0;
//---
if(UserSL>0)
Sell.SL_Price=Price+UserSL*Pip;
else
Sell.SL_Price=0;
//---
Order_SLTP_Modification(Sell.SL_Price,Sell.TP_Price,SellTicket);
}
}
}
//+------------------------------------------------------------------+
//| Position Number |
//+------------------------------------------------------------------+
int Positions_Num()
{int Num=0;
for(int i=OrdersTotal()-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
if(OrderMagicNumber()==Magic && OrderSymbol()==_Symbol)
if(OrderType()==OP_BUY || OrderType()==OP_SELL)
Num++;
}
return(Num);
}
//+------------------------------------------------------------------+
//| Position Number |
//+------------------------------------------------------------------+
int Positions_Sell_Num()
{int Num=0;
for(int i=OrdersTotal()-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
if(OrderMagicNumber()==Magic && OrderSymbol()==_Symbol)
if(OrderType()==OP_SELL)
Num++;
}
return(Num);
}
//+------------------------------------------------------------------+
//| Position Buy Number |
//+------------------------------------------------------------------+
int Positions_Buy_Num()
{int Num=0;
for(int i=OrdersTotal()-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
if(OrderMagicNumber()==Magic && OrderSymbol()==_Symbol)
if(OrderType()==OP_BUY)
Num++;
}
return(Num);
}
//+------------------------------------------------------------------+
//| Position Number |
//+------------------------------------------------------------------+
int Order_Sell_Num()
{
int Num=0;
for(int i=OrdersTotal()-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
if(OrderMagicNumber()==Magic && OrderSymbol()==_Symbol)
if(OrderType()==OP_SELLLIMIT || OrderType()==OP_SELLSTOP)
Num++;
}
return(Num);
}
//+------------------------------------------------------------------+
//| Position Buy Number |
//+------------------------------------------------------------------+
int Order_Buy_Num()
{int Num=0;
for(int i=OrdersTotal()-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
if(OrderMagicNumber()==Magic && OrderSymbol()==_Symbol)
if(OrderType()==OP_BUYLIMIT || OrderType()==OP_BUYSTOP)
Num++;
}
return(Num);
}
//+------------------------------------------------------------------+
//| Order Numbers By Type |
//+------------------------------------------------------------------+
int Order_Num(ENUM_ORDER_TYPE Type)
{int Num=0;
for(int i=OrdersTotal()-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
if(OrderMagicNumber()==Magic && OrderSymbol()==_Symbol)
if(OrderType()==Type)
Num++;
}
return(Num);
}
//+------------------------------------------------------------------+
//| Normalize |
//+------------------------------------------------------------------+
double NormalizeLots(double lots, string pair="")
{
if (pair == "") pair = Symbol();
double lotStep = MarketInfo(pair, MODE_LOTSTEP),
minLot = MarketInfo(pair, MODE_MINLOT);
lots = MathRound(lots/lotStep) * lotStep;
if (lots < minLot) lots = minLot; // or minLot
return(lots);
}
//+------------------------------------------------------------------+
//| Check if there is enough money |
//+------------------------------------------------------------------+
bool CheckMoneyForTrade(string symb, double lots,int type)
{
double free_margin=AccountFreeMarginCheck(symb,type, lots);
//-- if there is not enough money
if(free_margin<0)
{
string oper=(type==OP_BUY)? "Buy":"Sell";
Print("Not enough money for ", oper," ",lots, " ", symb, " Error code=",GetLastError());
return(false);
}
//--- checking successful
return(true);
}
//+------------------------------------------------------------------+
//| Check the correctness of the order volume |
//+------------------------------------------------------------------+
bool CheckVolumeValue(double volume,string &description)
{
//--- minimal allowed volume for trade operations
double min_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MIN);
if(volume<min_volume)
{
description=StringFormat("Volume is less than the minimal allowed SYMBOL_VOLUME_MIN=%.2f",min_volume);
return(false);
}
//--- maximal allowed volume of trade operations
double max_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MAX);
if(volume>max_volume)
{
description=StringFormat("Volume is greater than the maximal allowed SYMBOL_VOLUME_MAX=%.2f",max_volume);
return(false);
}
//--- get minimal step of volume changing
double volume_step=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_STEP);
int ratio=(int)MathRound(volume/volume_step);
if(MathAbs(ratio*volume_step-volume)>0.0000001)
{
description=StringFormat("Volume is not a multiple of the minimal step SYMBOL_VOLUME_STEP=%.2f, the closest correct volume is %.2f",
volume_step,ratio*volume_step);
return(false);
}
description="Correct volume value";
return(true);
}
//+------------------------------------------------------------------+
//| LotSize Calculator |
//+------------------------------------------------------------------+
double LotSize()
{
if(FixedLotSize>0)
return(FixedLotSize);
//---
if(FixedLotSize==0 && UserSL>0)
{
double Current_PointValue= (MarketInfo(Symbol(),MODE_TICKSIZE)!=0) ? MarketInfo(Symbol(),MODE_TICKVALUE)*MarketInfo(Symbol(),MODE_POINT)/MarketInfo(Symbol(),MODE_TICKSIZE)*1 : 0;
double Target_PointValue= (UserSL != 0) ? (AccountEquity()*LotRisk/100)/ (UserSL*10) : 0 ;
double Vol= (Current_PointValue!=0) ? Target_PointValue/Current_PointValue : 0;
// Print("Sym: ",Sym," Vol: ",Vol," Target_PointValue: ",Target_PointValue," Current_PointValue: ",Current_PointValue);
if(MarketInfo(Symbol(),MODE_MINLOT)==0.1)
Vol=NormalizeDouble(Vol,1);
else if(MarketInfo(Symbol(),MODE_MINLOT)==0.01)
Vol=NormalizeDouble(Vol,2);
if(Vol<MarketInfo(Symbol(),MODE_MINLOT)) Vol=MarketInfo(Symbol(),MODE_MINLOT);
if(Vol>MarketInfo(Symbol(),MODE_MAXLOT)) Vol=MarketInfo(Symbol(),MODE_MAXLOT);
return(Vol);
}
return 0;
}
//+------------------------------------------------------------------+
//| Order SL & TP Modification for ECN Accounts |
//+------------------------------------------------------------------+
void Order_SLTP_Modification(double StopLoss,double TakeProfit,int Ticket)
{
if(OrderSelect(Ticket,SELECT_BY_TICKET,MODE_TRADES))
{
bool Modify_Order=OrderModify(OrderTicket(),OrderOpenPrice(),StopLoss,TakeProfit,0,clrNONE);
if(!Modify_Order)
Print("Cannot Modify Order. Error: ",GetLastError()," SL: ",StopLoss," TP: ",TakeProfit," Type: ",OrderType());
}
}
//+------------------------------------------------------------------+
//| Check if trade hit TP |
//+------------------------------------------------------------------+
bool Is_Hit_TP()
{
for(int i=OrdersHistoryTotal()-1; i>=0; i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
if(OrderSymbol()==Symbol())
if(OrderMagicNumber()==Magic)
if(OrderCloseTime()>TimeIndex)
if(StringSubstr(OrderComment(),StringLen(OrderComment())-4,4)=="[tp]")
{
TimeIndex=TimeCurrent();
return(true);
}
}
return(false);
}
//+------------------------------------------------------------------+
//| Check if trade hit SL |
//+------------------------------------------------------------------+
bool Is_Hit_SL()
{
for(int i=OrdersHistoryTotal()-1; i>=0; i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
if(OrderSymbol()==Symbol())
if(OrderMagicNumber()==Magic)
if(OrderCloseTime()>TimeIndex)
if(StringSubstr(OrderComment(),StringLen(OrderComment())-4,4)=="[sl]")
{
TimeIndex=TimeCurrent();
return(true);
}
}
return(false);
}
Responded
1
Rating
Projects
397
31%
Arbitration
61
20%
/
69%
Overdue
49
12%
Working
2
Rating
Projects
73
47%
Arbitration
2
50%
/
50%
Overdue
2
3%
Free
3
Rating
Projects
195
27%
Arbitration
0
Overdue
3
2%
Free
Similar orders
I NEED EXPERT FOR MY DASHBOARD NEEDED
30 - 150 USD
hi, I'm looking for who can help me with my needed I must do changes to a dashboard with manual input of trader and active expert. Budget 30$ Can do
I have an MT5 EA which I like to modify to run on custom symbol chart. I can backtest the EA on the custom symbol chart, but I cannot run on the chart to trade. When I attach the EA to the custom symbol chart, it gives me error: "2024.06.07 21:27:59.270 Trades '1520250871': failed request buy 0.1 BTCUSD_ATR10_M1 at 69260.30000 [Invalid request]" Please help me to modify the EA to run on custom symbol chart. EA is
Money bag
40+ USD
I want a robot that can trade for me daily and make profits.It must Atleast make $30 a day.The robot must be able to make successful trades .exchange markets (currencies,stocks )
So I want to make a risk management EA for mt4 and I will run down the button features I want it to have I have included a risk management tool that does exactly what I want this ea to do for the risk management pop up Also I want the ea to have a water mark that shows the time frame and pair or instrument being trades with a 3rd tag line I can input a name in here is the dash board button functions EA Name Long
I will provide pine script and need to convert it as a mql4 EA. The system is based on swing highs and lows. If you interested please knock me, Thank you
Custom EA development
300+ USD
Please develop the strategy according to the specifications above. Ensure that all settings and parameters are accessible and modifiable through the inputs section for ease of optimization and customization by the user. Incorporate the following features to enhance robustness and profitability: 1. Entry Logic : • Utilize PSAR, EMA, and Supertrend for entry signals, with adjustable parameters and selectable
I'd like to make a program which was able to improve strategies just avoiding trading: - Hours - Days of week - Months According to these parameters: - Calmar Ratio must be higher than original one and the optimization must be within top 5 optimization. - Rsquared must not change more than 4% of the original one. - Strategy must have at least 150 trades. I hope it has been enough for you to make an idea
I want an Indicator that : Draws vertical lines at the opening of candles on a time frames selected.( I want to be able change the candle timeframe the line will be drawn. Eg. I can slelect 1H, 4H etc from the settings, and the vertical line will be drawn at the opening). Draw a horizontal line at the opening of the candles in the selected timeframe. Calculate the average range of the candles on a selected timeframe
An Expert Advisor for a simple Hedging strategy
30 - 150 USD
Overview: We are seeking an experienced developer to create an Expert Advisor (EA) for a simple hedging strategy in the forex market. The EA will utilize MACD, 200 EMA, and support and resistance levels to determine entry signals. It will manage orders, including placing stop orders and adjusting lot sizes based on predefined conditions. Responsibilities: Develop EA Logic: Implement the first order based on MACD
Debug of Indicator
30+ USD
Hello, I need to optimize my indicator so that it works in several time frames. and then convert it to mq5 The task will be carried out remotely by ANYDESK
Project information
Budget
30+ USD
For the developer
27
USD