Hedging Trading Robot coding required

İş tamamlandı

Tamamlanma süresi: 2 gün

İş Gereklilikleri

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

Yanıtlandı

1
Geliştirici 1
Derecelendirme
(253)
Projeler
358
49%
Arabuluculuk
24
25% / 50%
Süresi dolmuş
80
22%
Serbest
2
Geliştirici 2
Derecelendirme
(117)
Projeler
138
41%
Arabuluculuk
30
7% / 77%
Süresi dolmuş
17
12%
Serbest
3
Geliştirici 3
Derecelendirme
(35)
Projeler
40
23%
Arabuluculuk
10
10% / 50%
Süresi dolmuş
16
40%
Serbest
4
Geliştirici 4
Derecelendirme
(89)
Projeler
137
24%
Arabuluculuk
35
9% / 40%
Süresi dolmuş
52
38%
Serbest
5
Geliştirici 5
Derecelendirme
(219)
Projeler
370
42%
Arabuluculuk
145
17% / 41%
Süresi dolmuş
124
34%
Serbest
Yayınlandı: 38 kod
6
Geliştirici 6
Derecelendirme
(53)
Projeler
74
26%
Arabuluculuk
30
10% / 63%
Süresi dolmuş
22
30%
Serbest
7
Geliştirici 7
Derecelendirme
(298)
Projeler
427
26%
Arabuluculuk
18
61% / 33%
Süresi dolmuş
26
6%
Serbest
Yayınlandı: 8 kod
Benzer siparişler
to compile all the suitable markets for buy and place a buy for the shortest timeframe and place a sell for also a shortest timeframe it should work with all brokers and can automatically place a trade as long as its connected to the internet it should inform where the contracts are placed and for how long
Break 30+ USD
i havee an ea that work in tandem with an indicator i created. 1.i want to add a trend filter, using a trend line on a higher timeframe to decide the direction of the market then trades would be taken on a smaller timeframe using the same mss and bos entry. in the event the on the higher timeframe a bullish trendline was drawn then on the smaller timeframe only buy trades would be taken and sell signals ignored. when
I need an experienced developer to convert my MT4 EA based on the Super Trend indicator to MT5. The new EA should also include additional features. Essential modifications: - Incorporate additional indicators: Moving Average and PSAR. - Add custom alerts: Push and sound notifications. - Implement money management rules
I have a custom EA that I need optimized. I need it optimized for many pairs and the set files sent to me. The EA was created a few months ago, it works, but I need it optimized for it to run better
i am looking for an indicator that gives buy sell signal by placing arrows on the chart, signals must not repaint or be placed with an offset, i want it to be accurate enough so i can trade from signal to signal and actually make profit, do any one have a strategy and skill to create such an indicator, and also it is to mql5, ( Important is, It must have No repainting and No offset ), if you know it is something you
hello freelancers i need some one with a profitable ea for gold and dj30 i need the ea to be a scalping ea which places orders with sl and tp of 200 points for each trade and have a winning rate of more than 70 percent. if you have it already please apply for this
I need an EA for magic number that shows three unique numbers in every single candle.Mainly this EA shows the strength of the candle and momentum . More details inbox me
Specification AR Code a grid expert advisor (EA) MQL5 that uses a sort of hedged laddering mechanism . Core Logic Outline: Initial Setup : Open a double trade (Buy & Sell) at the current market price. Set two pending double trades (Buy/Sell limits) at a fixed distance on either side (e.g., ±X pips). On Trigger Event : When price hits one of the pending double trade levels, execute the new double position
Description: I need a professional MetaTrader 5 developer to build a clean, fully editable Expert Advisor (EA) that strictly controls risk based on dollar-loss thresholds per lot size, and includes hard rules for equity protection and trade limits. Trade Management Rules 1. Dollar-Based Auto Close (Per Lot Size) The EA must close each individual XAUUSD trade once its loss in USD reaches a specific threshold tied to
I need someone experienced to develop a trading robot with the criteria's - Heikin ashi candle logic - Buystops under certain conditions - Trailing stop losses at a certain interval - Dynamic position sizing so its able to calculate lot sizes and risk the correct % each trade , - Understand heikin ashi swing high swing low logic to find where to place the stop loss/identify correct entries , - Be able to only make

Proje bilgisi

Bütçe
50 - 1000 USD
Geliştirici için
45 - 900 USD