Hedging Trading Robot coding required

Tâche terminée

Temps d'exécution 2 jours

Spécifications

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

Répondu

1
Développeur 1
Évaluation
(253)
Projets
358
49%
Arbitrage
24
25% / 50%
En retard
80
22%
Gratuit
2
Développeur 2
Évaluation
(117)
Projets
138
41%
Arbitrage
30
7% / 77%
En retard
17
12%
Gratuit
3
Développeur 3
Évaluation
(35)
Projets
40
23%
Arbitrage
10
10% / 50%
En retard
16
40%
Gratuit
4
Développeur 4
Évaluation
(89)
Projets
137
24%
Arbitrage
35
9% / 40%
En retard
52
38%
Gratuit
5
Développeur 5
Évaluation
(219)
Projets
370
42%
Arbitrage
145
17% / 41%
En retard
124
34%
Gratuit
6
Développeur 6
Évaluation
(53)
Projets
74
26%
Arbitrage
30
10% / 63%
En retard
22
30%
Gratuit
7
Développeur 7
Évaluation
(298)
Projets
427
26%
Arbitrage
18
61% / 33%
En retard
26
6%
Gratuit
Commandes similaires
I don't see signals on the chart .... On mt4 it's perfect...but when I converted it to Tradingview by a guy on here it doesn't show any signals, I need an expert that can help me to work on it, that can also work on more projects, Thanks, I have $20 for this project now, If you think is too small and you want to charge $30, i can pay you the rest later on
I have an EA based on MACD, MA, and RSI indicators. It works on backtest and demo accounts, but it does not open any positions on the live account in MT5. On MT4, it is working well; the problem is on MT5. I need help to find out what is wrong and fix it. I have the source code
I needed one MT4 multicurrency’s connected Following FIFO Rule, No Hedging, with panel box EA. If making profit total 1%, 2%, 3% whatever setup of the total balance/equity then automatically close all open positions and, immediately open new trade positions (sell/buy.. buy/sell as setup). only for really good understandable, giving time and high professional good quality Developer. I’ll sent Everything in detail, we
I need to create something that will allow me to transfer information about the transaction (entry moment, Tp and SL levels) from the indicator I have on tradingview to metatrader 5. Additionally, I would like to be able to set trading hours, transaction risk in percentage, enter into transactions only with a trend, and the ability to enable and turning off the trailing stop loss
1. **Trade Execution:** - The bot should be capable of entering and exiting trades based on predefined signals from my trading strategy. 2. **Take Profit:** - Implement mechanisms to take profit at specific levels as defined by my strategy. ### Additional Features: - The bot should be able to handle multiple trades simultaneously. - It must have a user-friendly interface for monitoring and adjustments. -
I have a renko chart generator EA and I want to modify it: 1. I would like it to have a start date where I can give the start time based on the year, month, day, hour, minute, second. 2. I would like to include a "type" section where I can specify whether to calculate the Renko bricks from the "opening" or "closing" price. The Renko EA generator is attached. Thank you
hello great developer I have an mt4 indicator that stopped working with the new mt4 build. Can you fix it to work with the new mt4 build? I do not have the source code. i will looing for great developer that wil bid for it quickly
can anyone here help me with develop a Pine script on TradingView's Pine Editor for a trading strategy based on certain variations of the Morning Star candlestick pattern which I have been noticing from last 2 years
hi.. i have a pin script (TV) but some lines in the code needs to be fixed,,, i will attach the file, Also I will be paying $20 for the project cause i just need you to adjust some Minor things in it, i will explain more further in the message side
Hello There With new mt4 update my EA by the name "BreakFast In Canada" does not work on the new mt4 version so I need someone to make it work, however it looks like I do not have the source code for it. So I do not know if it is still possible to work on it. I have attached the picture of the specific EA as there many EAs with this name

Informations sur le projet

Budget
50 - 1000 USD
Pour le développeur
45 - 900 USD