Build Me A Simple Hedging Strategy

Tâche terminée

Temps d'exécution 2 jours
Commentaires du client
Did good quality work and on time. The EA and source code looks well done.
Commentaires de l'employé
the customer treats you like real humen he is so understanding ,kind,and fun to work with .will work love with him again next time

Spécifications

Me and my friend had a bet that a strategy he heard about does not not work. I have code logic for my EA in Python and It does not work. But my friend claim I code it wrong said it should be built in MT4 because they is the FX standards. 

I can provide the source code in Python.  The EA is quite simple.  In each tick it check each currency and decides check if the current order is filled if the order is filled the EA submits a new Stop Order for the currency.     

I would like the source code of the final product for me to compile and execute

Here is the logic of the EA.  There are no indicators.  The logic is a bit complex, but the math is very simple.  Basically it enters a trade.  If the trade goes again you it enters a short position. Keeps entering addtional long and short positions until the trade either hits the stop loss or profit target.  The stop loss for the buy trade is the profit target for the sell trade. Also the stop loss for the sell trade is the profit target for the buy trade. So this means when a stop loss or profit target is hit all the trades close together.

What make it a bit more complex is he wants to test the stratgy with a bullish and bearish strategies and want to test for multiple currencies at one.

   

The solution will need the following inputs.

Tickers: 

  • This is a list of tickers to execute the strategy on.  Each ticker should be separated by as space.

Pip Units:

  • this is number of pips the profit target and stop loss. This is a space separated list as each ticker will have a different profit target and stop loss value.

Lot Units:

  • this is the number of lots the to be used by the ticker. This is a space separated list as each ticker will have a different lot size value.

Directions:

  • this will specify if the the ticker is to be trade Bullish, Bearish or Both. This is a space separated list as each ticker could be traded Bullish, Bearish or Both.

Bullish Magic Numbers:

  • This is the magic number used by the ticker when trading the Bullish Strategy.  This is a list because each ticker will have its own magic number.

Bearish Magic Numbers:

  • This is the magic number used by the ticker when trading the Bearish Strategy.  This is a list because each ticker will have its own magic number.

Trade Units:

  • This is the scaling table used to know how big position to open based on the trading rules.  Again this is a space separated list of floating point numbers.

Take Profit Ratio

  • This is the take profit relative to the pip units.  This is a space separated list as each ticker will have it's own ratio.

Stop Loss Ratio

  • This is the stop loss relative to the pip units.  This is a space separated list as each ticker will have it's own ratio.



During the initialization these inputs will need to be converted in to arrays.


There will need to be a loop on the OnTick event where it loops through each ticker.  With in the loop it will do the following

Get the Bullish strategy Magic Number for the current Ticker in the loop from the array

If Has Open Positions

  • Count the number of Open Positions for the Magic Number 
  • While counting the open positions for the magic number. Get the Profit Target, Stop Loss of the first Open Position
  • Set the max of returned Profit Target and Stop Loss as Profit Target
  • Set the min of returned Profit Target and Stop Loss as Stop Loss
  • Set the entry price as the stop loss + (pip units * (stop loss ratio + 1))
  • Set the hedge price as the stop loss + (pip units * (stop loss ratio))

If No Open Positions and Has Unfilled Orders

  • Count the number of Unfilled Orders for the Magic Number \
  • While counting the unfilled positions for the magic number. Get the Stop Price, Profit Target of the first unfilled Order
  • Set the max of returned Profit Target and Stop Loss as Profit Target
  • Set the min of returned Profit Target and Stop Loss as Stop Loss
  • Set the entry price as the stop loss + (pip units * (stop loss ratio + 1))
  • Set the hedge price as the stop loss + (pip units * (stop loss ratio))

If there are no open positions and has unfilled order

  • should check the Stop Price is no more than 1 pip away from current price.  
  • If the current price is more than one pip away from the stop price should cancel the unfilled order.  The unfilled order count should be reduced by one.

 If there are no open positions and no unfilled orders.

  • The Entry Price should be calculated point above the current price.
  • It will calculate the Take Profit as Entry Price + (pip units * take profit ratio). 
  • It will calculate the Hedge Price as Entry Price - pip units
  • It will calculate the Stop Loss as Entry Price - (pip units * stop loss ratio)

If there are no unfilled orders will 

  • This ensures there is never more than one unfilled order per magic number

calculate the lots multiplier as the trade units[open positions + 1]
        calculate the opening units as lot units times lots multiplier


  • The trade quantity should be calculated as the lot units * trade unnts 

  • If the number of current open position is positive will open a buy stop order
  • If the number of current open position is negative will open a sell stop order

Each Order that is executed will be a Stop Order with a Ticker, Stop Price, Quantity, Take Profit, Stop Loss, Magic Number.

where 

  • Quantity is the  the opening units and the is times minus 1 for sell stop 
  • Stop Price is the Entry Price for Buy Stop and Hedge Price for Sell Stop
  • The Take Profit and Stop Loss are swapped around for Sell Stop trades 


The logic above is for a bullish strategy and want to repeat for a bearish strategy but in reverse.


Also would like on the chart white circle and squares for buy and sell for open bullish strategy positions with blue lines connecting to the close point.  Fore the bearish strategy would like red line connecting to the target. But what ever you think looks good. 

The strategy should be quite simple there is not complex math.  However the Inputs have to be loaded into arrays and the arrays need to be accessed to get the values.  But that is about it.


  

Répondu

1
Développeur 1
Évaluation
(6)
Projets
12
8%
Arbitrage
1
0% / 100%
En retard
4
33%
Gratuit
2
Développeur 2
Évaluation
(46)
Projets
75
49%
Arbitrage
1
0% / 0%
En retard
1
1%
Travail
3
Développeur 3
Évaluation
(97)
Projets
135
52%
Arbitrage
4
50% / 50%
En retard
0
Travail
4
Développeur 4
Évaluation
(61)
Projets
186
73%
Arbitrage
4
100% / 0%
En retard
1
1%
Gratuit
5
Développeur 5
Évaluation
(42)
Projets
88
14%
Arbitrage
30
30% / 53%
En retard
36
41%
Travail
6
Développeur 6
Évaluation
(57)
Projets
72
22%
Arbitrage
13
46% / 15%
En retard
5
7%
Gratuit
7
Développeur 7
Évaluation
(74)
Projets
121
43%
Arbitrage
12
33% / 50%
En retard
17
14%
Gratuit
8
Développeur 8
Évaluation
(10)
Projets
15
27%
Arbitrage
3
67% / 33%
En retard
0
Gratuit
9
Développeur 9
Évaluation
(45)
Projets
67
45%
Arbitrage
3
0% / 100%
En retard
0
Chargé
10
Développeur 10
Évaluation
(568)
Projets
641
41%
Arbitrage
21
57% / 29%
En retard
47
7%
Travail
11
Développeur 11
Évaluation
(243)
Projets
429
34%
Arbitrage
54
37% / 39%
En retard
156
36%
Occupé
12
Développeur 12
Évaluation
(256)
Projets
415
38%
Arbitrage
86
44% / 19%
En retard
70
17%
Occupé
13
Développeur 13
Évaluation
(66)
Projets
143
34%
Arbitrage
10
10% / 60%
En retard
26
18%
Gratuit
14
Développeur 14
Évaluation
(1)
Projets
2
0%
Arbitrage
1
100% / 0%
En retard
0
Gratuit
Commandes similaires
Hello, I‘m interested in an indicator to predict the next candles probability (bullish or bearish). But honestly I have no idea how to do this. Would be interested in your opinion how we can create such an indicator. Please let me know if you‘ve done similar work
Profitable EA HFT 50 - 300 USD
From a long time i am searching for a profitable EA i have lost a lot , and now i have only 300$ to buy a profitable EA , i wish to say with 0 losses but some or most traders they don't want to hear this i am really tired of searching for a programmer to just create me a profitable EA with the least losses or zero losses maybe nearly 1 year i am searching i just need an HFT EA that can work very well on MT4,MT5
There are six conditions in total . source code from an existing expert will be provided to aid the completion of this job . - Install the following by the Panel (copy paste form my existing Expert ) 1. Pips Lost : number of pips lost ( monthly reset ) 2. Pips Gained : number of pips gained ( monthly reset ) 3. Have a black background to avoid the
i need copy trader EA simple .. includes the reversal copy and include the persentage of the contracte to be copied i need it simple to use and very fast to copy
Hello The EA will work on particular zone choose by the user and can mark it on any TF and with some rules can open trades and mange the trade by some unique rules. the EA need to check the difference by RSI as well and with some extra rules . developer should have good attitude and good communication (englsih) with high performence and knowledge with coding EA. # MANUAL ZONE MARKING # THREE TYPES OF ENTRIES (
у нас есть стратегия, нам нужно написать mql5-код ​​для тестера стратегий МТ5,Цена договорная. Мой контакт @abbosaliyev из Telegram Программист должен знать РУССКИЙ ИЛИ УЗБЕКСКИЙ язык. Задание: разработать тестер, который использует шаблон условий на открытие и проверит весь исторический график на всех доступных таймфреймах. Остальная информация будет предоставлена ​​после согласования цены
There are six conditions in total . source code from an existing expert will be provided to aid the completion of this job . - Install the following by the Panel (copy paste form my existing Expert ) 1. Pips Lost : number of pips lost ( monthly reset ) 2. Pips Gained : number of pips gained ( monthly reset ) 3. Have a black background to avoid the
New york session based strategy 9:30 open Price takes out buy side or sell side liquidity Usually using 15min high and lows 5m entry Price takes out that high/low and price must close strongly back into the zone Is price is above price we have a sell bias vis versa for buys Sl is at the high or low with option for “offset” for cushion Tp is usually the opposite High or low. Would like the option for set pips-points &
Utilizing the MQL5 MetaEditor Wizard, I created an Expert Advisor, having the following Signal indicators: I was able to optimize the EA and reached a backtest with the following specifications: I was able to reach a profit level of 30K, as indicated below. However, the Bot is not without faults and following the backtest, I started a forward test with real live data and the results were not so great. The EA took a
Hey greetings. Am in need of a developer that has already made profitable MT4 or MT5 EA that I can buy with the backtesting and proven result. How is the draw down ? What is the winning rate ? Kindly reply and let proceed

Informations sur le projet

Budget
150+ USD
Pour le développeur
135 USD