Hedging Trading Robot coding required

工作已完成

执行时间2 天

指定

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

反馈

1
开发者 1
等级
(253)
项目
358
49%
仲裁
24
25% / 50%
逾期
80
22%
空闲
2
开发者 2
等级
(117)
项目
138
41%
仲裁
30
7% / 77%
逾期
17
12%
空闲
3
开发者 3
等级
(35)
项目
40
23%
仲裁
10
10% / 50%
逾期
16
40%
空闲
4
开发者 4
等级
(89)
项目
137
24%
仲裁
35
9% / 40%
逾期
52
38%
空闲
5
开发者 5
等级
(219)
项目
370
42%
仲裁
145
17% / 41%
逾期
124
34%
空闲
6
开发者 6
等级
(53)
项目
74
26%
仲裁
30
10% / 63%
逾期
22
30%
空闲
7
开发者 7
等级
(298)
项目
427
26%
仲裁
18
61% / 33%
逾期
26
6%
空闲
相似订单
Hello great developer Attached is the code I would like to have converted from pine script to mt4. It's a simple indicator. i will be looking for great developer that will bid for this project peace be unto you thanks
Looking for an mql5 EA developer to build a custom EA for MT5 based on several simple variables. It will be initially used on 5m EUR/USD, but needs to work with any currency/commodity/stock/crypto. Custom risk management will also need to be built into the EA. Exact variables will be discussed in detail once a developer is selected, but a basic overview of the EA variables is below. Positions will be opened based on
Média móvel M édia móvel sugeridas 8 21 50 e 200 quero que qualquer média móvel que eu possa adicionar tenha essa função As médias apareça em uma só tela como exemplo igual o tradingview as médias sejam todas em uma tela e que apareça de qual tempo gráfico é Linhas mais finas em tempos gráficos menores e linhas mais grossas em tempos maiores Quando tocados em qualquer média móvel o px diminui, de 2px para 1 px e
Bottrading 30 USD
// Khai báo các tham số đầu vào input int rsiPeriod = 14; // Chu kỳ RSI đầu vào mua gấp đôiLevel = 30,0; // Ngưỡng quá bán RSI để mua đầu vào bán gấp đôiLevel = 70,0; // Ngưỡng quá mua RSI để bán đầu vào int movingAveragePeriod = 50; // Chu kỳ trung bình để theo dõi tài khoản đầu vào rủi ro képPerTrade = 1,0; // Tỷ lệ sai sót của mỗi lệnh (% tài khoản) input int keyLevelPeriod = 100; // Chu kỳ tìm kiếm key level đầu
The Trading View Indicator script has about 80% of what I need. 1. I have an additional entry model called a confirmation entry 2. I normally just look back 3-50 bars to determine if a bar is wide range or not, but the 3 additional WRB models require requirements based on 3 bars before it, and each one has its own name. 3. The TV indicator has a lot of visual cosmetics that we won't be able to do in MT5, but colour
Hello, I am looking for a developer to reconstruct an indicator that is currently in an ex4 file into an mq4 file. The indicator provides buy and sell signals with entry points, Stop Loss, and TP1, TP2, and TP3. However, the indicator has some errors, and I would like to correct them. Unfortunately, since I only have the ex4 file, it's not possible to make these corrections directly. Therefore, I would like to
very simple rule buy rate 2 sl 1 if market reach 3 sl 2 market reach 4 sl 3 sl hit reverse trade open too with same 1:1 trail sl system if sl hit reverse trade open with same sl trail function 1 input open trade with buy or sell option 2 sl in pip .............xyz 3 lot size ............. xyz 4 distance from sl when sl trail one step [main point] Iam buying in rate of 2 my sl is 1 market reach 3 my sl is 2 market
I’m looking for someone experienced with Think or Swim to create a backtesting script for an in-the-money Iron Condor strategy using options on the SPX. The strategy involves setting up 10 contracts of an Iron Condor with a 10-point spread width and a net credit requirement of $11 per contract. The goal is to backtest the performance over the last three years, focusing on trades where the SPX closes outside a
Hello, I have a physically trading keyboard and i want to connect it with tradelocker, mt4,mt5 and ctrader. People need to be able to open and close a position with the keyboard really fast. i need it on macos, windows and linux. (desktop) My competition is: www.magickeys.trade My goal is to be the number 1 to sell the keyboards + software. When people order a tradingkeyboard they will get a mail after the purchase
Job Title: Expert Advisor (EA) Developer for Forex Trading Job Description: I am seeking an experienced Expert Advisor (EA) developer to create a customized trading bot for the MetaTrader 4/5 platform. The bot will be designed to execute a sophisticated trading strategy that incorporates daily range calculations, cost averaging, and hedging with precise pip management. The successful candidate should have strong

项目信息

预算
50 - 1000 USD
开发人员
45 - 900 USD