Hedging Trading Robot coding required

Trabalho concluído

Tempo de execução 2 dias

Termos de Referência

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;
}

Respondido

1
Desenvolvedor 1
Classificação
(253)
Projetos
358
49%
Arbitragem
24
25% / 50%
Expirado
80
22%
Livre
2
Desenvolvedor 2
Classificação
(117)
Projetos
138
41%
Arbitragem
30
7% / 77%
Expirado
17
12%
Livre
3
Desenvolvedor 3
Classificação
(35)
Projetos
40
23%
Arbitragem
10
10% / 50%
Expirado
16
40%
Livre
4
Desenvolvedor 4
Classificação
(89)
Projetos
137
24%
Arbitragem
35
9% / 40%
Expirado
52
38%
Livre
5
Desenvolvedor 5
Classificação
(219)
Projetos
370
42%
Arbitragem
145
17% / 41%
Expirado
124
34%
Livre
6
Desenvolvedor 6
Classificação
(53)
Projetos
74
26%
Arbitragem
30
10% / 63%
Expirado
22
30%
Livre
7
Desenvolvedor 7
Classificação
(298)
Projetos
427
26%
Arbitragem
18
61% / 33%
Expirado
26
6%
Livre
Pedidos semelhantes
Custom Robot Needed. 50 - 60 USD
Hi, I have a wonderful Half trend indicator that I've been using and for testing purposes. I'd like to convert it into an automatic EA for MT4. I'll probably be editing the EA as I go along but first I would like to see how it does with a few custom EA settings. Once the bot is placed on a new chart it will wait for a fresh buy/sell signal to enter a trade in the direction of the arrow. 1 full candle must close
I am looking for an experienced developer to create an MT5 EA for any FX pair, that if is applied to a chat, will show the following buttons which perform the following actions: Buy now button: places a buy order[ or orders [more than one] explained later] with the lot, SL and TP defined in the EA configuration prompt Sell now button: places a sell o rder[ or orders [more than one] explained later] with the lot, SL
I am looking for an experienced developer to create an MT5 EA for any FX pair, that if is applied to a chat, will show the following buttons which perform the following actions: Buy now button: places a buy order[ or orders [more than one] explained later] with the lot, SL and TP defined in the EA configuration prompt Sell now button: places a sell o rder[ or orders [more than one] explained later] with the lot, SL
Hello! I am a trader and I have a strategies on Trading View on my Trading View Account. The bot you need to create should be a normal solana trading bot like bonkbot for example but it needs to buy and sell automatically after the strategy on trading view so the bot needs to be connected trough API with Trading View, if you know you are capable of handling this project, please kindly reach out with your
👋 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 I need an ea based on indicator from trading view name "Support and resistance leveles with breaks [lux algo]" Ee should draw support and resistance levels the same way as this incidator in trading view and tp,sl, trailing sl, breakeven, partial tp etc
I'm looking for someone who can create an expert advisor based on an indicator which will be provided by me. It will execute a trade based on signals generated by the indicator. A few money management parameter settings like breakeven, trailing stop are to be included. Thanks
I need opinions if it is possible to develop a panel for managing multiple orders for 28 Forex currency pairs for Metatrader 5. The main features should include: - Symbol selection for manual opening of multiple orders. - Stop-Loss/Take-Profit. - Option to close all open orders manually or automatically (by stop loss/take profit). The panel should allow you to select various currency pairs with different lot sizes to
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

Informações sobre o projeto

Orçamento
50 - 1000 USD
Desenvolvedor
45 - 900 USD