Hedging Trading Robot coding required

Trabajo finalizado

Plazo de ejecución 2 días

Tarea técnica

I am looking to have the below code cleaned up and formed into an ex4. I am getting a headache trying to do this myself.


This is a continuing project and I would like to continually develop and improve this EA.


The logic for this EA is as follows

*initiate trade everyday at 23:00 GMT or 1:00 PST.

*initiate a hedge by putting on both a long and a short order.

*set a 20pip Take Profit and a 100pip Stop Loss on both orders.

*Initial lot size = (account balance/100,000). As an example, if the account balance is $10,000 then the lot size would equal .1.

*If the previous trade resulted in a profit then keep the lot size at(account balance / 100,000) However, If the previous trade resulted in a loss then adjust the lot size to (account balance/20,000) so now a $10,000 account would have a lot size of .5




input int start_hour = 23;
input int start_minute = 0;
input int end_hour = 0;
input int end_minute = 0;
input int take_profit = 20;
input int stop_loss = 100;
input int winning_denom = 100000;
input int losing_denom = 20000;
input string order_comment = *EA20 Fresh Start*;
input int signal_bar = 0;

int magic_number;
int fract_factor = 1;
int OnInit (){
magic_number = (int) TimeCurrent ();
if (Digits == 5 || Digits == 3) fract_factor = 10;
Print (*EA20 is initialized. Magic number is *+ (string)magic_number);
return (INIT_SUCCEEDED);
}

void OnTick(){
static datetime last_open_signal_time = 0;
if (OpenSignal (signal_bar) ++ Time [0] ! = last_open_signal_time) {
Order (OP_BUY);
Order (OP_SELL);
last_open_signal_time = Time [0];

}

static datetime last_close_signal_time = 0;
if (CloseSignal(signal_bar)++ Time [0] ! = last_open_signal_time){
CloseAllTrades();
last_close_signal_time = Time [0]

}
}

void OnDeinit (const int reason) {
}

double GetLastTradeProfit(){
double profit = EMPTY_VALUE;
datetime close_time = 0;
for (int i = OrdersHistoryTotal() - 1; i > = 0; i --)
if (OrderSelect(i, SELECT_BY_POS_MODE_HISTORY))
if (OrderMagicNumber() == magic_number ++ OrderCloseTime()> close_time){
}
return profit;
}

void CloseAllTrades (int order_type =-1){
for (int i = OrdersTotal() -1; i >= 0; i --)
if (OrderSelect(i, SELECT_BY_POS))
if ((OrderType() <= 1 ++ order_type ==-1) || (OrderType () == order_type))
if (OrderMagicNumber () == magic_number)
if
(!OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(), 10* fract_factor, clr NONE))
Print (GetLastError());
}

int Order (int order_type) {
double price = (order_type == OP_BUY) ? Ask: Bid;
double tp = (take_profit == 0)? 0: (order_type == OP_BUY)? price + take_profit* Pip(): price - take_profit * Pip();
double sl= (stop_loss == 0)?0: (order_type == OP_BUY)? price - stop_loss * Pip(): price + stop_loss * Pip();
double denom = (GetLastTradeProfit() == EMPTY_VALUE)? winning_denom: (GetLastTradeProfit() > 0)? winning_denom: losing_denom;
double lot = AccountBalance()/denom;
double min_lot = Market_Info(Symbol(),MODE_MINLOT);
lot= NormalizeDouble (lot,1);
lot= MathMax (min_lot, lot);
return
OrderSend(Symbol(), order_type,lot,price,10,sl,tp, order_comment, magic_number,0,clr NONE);
}

double Pip(){
return Point * fract_factor;
}

bool OpenSignal (int shift) {
if (TimeHour(Time[shift]) == start_hour ++ TimeMinute(Time[shift]) == start_minute)
return true;
return false;
}

bool CloseSignal (int shift){
if (TimeHour(Time[shift]) == end_hour ++ TimeMinute(Time[shift]) == end_minute ++ (end_hour ! = 0 || end_minute ! = 0))
return true;
return false;
}

Han respondido

1
Desarrollador 1
Evaluación
(253)
Proyectos
358
49%
Arbitraje
24
25% / 50%
Caducado
80
22%
Libre
2
Desarrollador 2
Evaluación
(117)
Proyectos
138
41%
Arbitraje
30
7% / 77%
Caducado
17
12%
Libre
3
Desarrollador 3
Evaluación
(35)
Proyectos
40
23%
Arbitraje
10
10% / 50%
Caducado
16
40%
Libre
4
Desarrollador 4
Evaluación
(89)
Proyectos
137
24%
Arbitraje
35
9% / 40%
Caducado
52
38%
Libre
5
Desarrollador 5
Evaluación
(219)
Proyectos
370
42%
Arbitraje
145
17% / 41%
Caducado
124
34%
Libre
6
Desarrollador 6
Evaluación
(53)
Proyectos
74
26%
Arbitraje
30
10% / 63%
Caducado
22
30%
Libre
7
Desarrollador 7
Evaluación
(298)
Proyectos
427
26%
Arbitraje
18
61% / 33%
Caducado
26
6%
Libre
Solicitudes similares
👋 Hey can you help me to convert mt4 to ctrader cbot? Options Required along with the conversion from given MQL4 source code to Ctrader Cbot just need one option on top of converting mt4 to cbot need an option to run cbot in selected direction with options as Buy/Sell/Buy-and-Sell
Hello there, I need a professional mt4 developer who can perfectly help me to backtest my mt4 trading strategy on these trading pairs, XAUUSD H1 PEPPERSTONE 1:200 LEVERAGE. The strategy would be provided once you bid to this task
GIOVA 30 - 50 USD
I need a skillful programmer that can Automate my trading indicator into an EA . System has 2 indicators. One of the Indicator is to know the Direction of Trend on H1 and the second indicator is to be use to enter trade on M5 in line with the H1 Trend The EA must have 1. TP and SL, 2. Trailing Stop Loss, 3. ability to add more trade when there is signal in line with H1
Hello developers here, I need a professional developer that can help me to develop an mt5 trading bot that works according to my strategy, I will be sharing my strategy in the inbox, Let me know if you can develop it, I will be waiting for your response
Strategy To Be Used 1. Order Blocks (4HR, Daily And Weekly) 2. FVG (For Entry) 3. Fibonacci Levels (TP) 4. HH/LL ( SL) Works in 1HR & 4HR (TF) Risk to reward minimum 2:1 (Default) Winrate 53.21% (Accuracy) tested on Live account of 1000$ May 14th to May 31st You can change the risk per trade percent Per day DD Limit *it should takes multiple entries at the same price point when the price touches weekly/ daily
### Strategy Description for Developer: **Objective**: Develop a profitable Inner Circle Trader (ICT) strategy for the 1-minute and 5-minute time frames. **Components**: 1. **Market Structure**: Identify market structure using swing highs and lows. 2. **Order Blocks**: Utilize bullish and bearish order blocks for potential entry points. 3. **Fair Value Gaps**: Use Fair Value Gaps (FVG) as alternative or complementary
MetaTrader MT4 to MT5 Conversion I'm on the lookout for a skilled developer proficient in MetaTrader who can assist me in converting my custom indicators and Expert Advisors (EAs) from MT4 to MT5. The primary goal of this project is to ensure that my tools are seamlessly compatible with both platforms. Key Requirements: - Proven experience in MetaTrader programming - A deep understanding of the differences between
I'm seeking a skilled developer to automate my trading strategy. The ideal candidate will have experience in algorithmic trading, proficient in coding languages such as Python or C++, and familiar with trading platforms like MetaTrader5 . The project involves creating a bot that can execute trades based on predefined criteria, manage risk, and adapt to market conditions. Knowledge of financial markets and backtesting
I am Ph.D. in Finance and I just bought 4 EA: EA Reaper --> 30USD EA Golden Emperador --> 30USD EA Golden Elephant and --> 30USD EA Quantum Lab --> 30USD I need a person that can help me to improve and test my strategy in this EA. I have some Ideas, but I do know how I can improve. I like also that you explain me how I can configurate well this EA in the future. I do not need program nothing. All I need is JOIN a
هل يمكنك مساعدتي؟ أريد تنفيذ إشارة تداول آلية على MT4/MT5 لنظام Android Can you help me I want to implement an automated trading signal on MT4/MT5 for Android Can you help me I want to implement an automated trading signal on MT4/MT5 for Android

Información sobre el proyecto

Presupuesto
50 - 1000 USD
Para el ejecutor
45 - 900 USD