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
(7)
Projets
12
8%
Arbitrage
3
0% / 67%
En retard
4
33%
Gratuit
2
Développeur 2
Évaluation
(53)
Projets
91
52%
Arbitrage
2
0% / 50%
En retard
1
1%
Gratuit
3
Développeur 3
Évaluation
(98)
Projets
137
52%
Arbitrage
5
40% / 60%
En retard
0
Gratuit
4
Développeur 4
Évaluation
(78)
Projets
246
74%
Arbitrage
7
100% / 0%
En retard
1
0%
Gratuit
Publié : 1 article
5
Développeur 5
Évaluation
(45)
Projets
91
13%
Arbitrage
34
26% / 59%
En retard
37
41%
Gratuit
6
Développeur 6
Évaluation
(57)
Projets
72
22%
Arbitrage
13
46% / 15%
En retard
5
7%
Gratuit
7
Développeur 7
Évaluation
(75)
Projets
124
44%
Arbitrage
14
29% / 50%
En retard
17
14%
Gratuit
8
Développeur 8
Évaluation
(11)
Projets
18
28%
Arbitrage
4
50% / 50%
En retard
1
6%
Gratuit
9
Développeur 9
Évaluation
(58)
Projets
90
43%
Arbitrage
4
0% / 100%
En retard
3
3%
Travail
10
Développeur 10
Évaluation
(568)
Projets
641
41%
Arbitrage
25
48% / 36%
En retard
46
7%
Travail
11
Développeur 11
Évaluation
(318)
Projets
565
35%
Arbitrage
81
31% / 44%
En retard
204
36%
Gratuit
12
Développeur 12
Évaluation
(298)
Projets
478
40%
Arbitrage
105
40% / 24%
En retard
82
17%
Chargé
Publié : 2 codes
13
Développeur 13
Évaluation
(69)
Projets
146
34%
Arbitrage
13
8% / 62%
En retard
26
18%
Gratuit
Publié : 6 codes
14
Développeur 14
Évaluation
(1)
Projets
2
0%
Arbitrage
2
50% / 50%
En retard
0
Gratuit
Commandes similaires
8 cap prop firm passing 30 - 3000 USD
I am looking for an experienced MQL4/MQL5 HFT developer to build or optimize a High-Frequency Trading (HFT) Expert Advisor that can successfully pass proprietary trading firm challenges and perform consistently under live trading conditions with brokers such as 8cap or BlackBull Markets . The developer should have proven experience with HFT execution, ultra-low-latency trading, broker execution, slippage, spreads
Hello, SYSTEM BLUEPRINT READY I am looking for a professional, top-tier MQL5 developer to build a semi-automated Expert Advisor for MetaTrader 5. I have a fully completed, detailed Master Technical Specification Document attached, alongside a formatted 4-column User Input Configuration spreadsheet. And a high level overview with screen shots. Core System Features: - State Machine Architecture (Factor 1 Baseline
Hello, I am looking for an existing, fully backtestable MT5 Expert Advisor or EA portfolio designed specifically for passing an FTMO-style prop-firm evaluation. I am not looking for unrealistic profit claims or a visually perfect backtest. My priority is a statistically defensible probability of passing the challenge while respecting all risk limits. Primary objective The system should be designed for the current
I have a High-Frequency Trading (HFT) Expert Advisor for both MT4 and MT5 designed primarily for US30 (Dow Jones Index) . The EA performs consistently and profitably on demo accounts, but when I run it on an IC Markets Raw or Standard live account, it starts generating losses under what appear to be the same trading conditions. At this time, I cannot provide the source code (.mq4/.mq5). I can only provide the
Version document : 1.0 Plateforme : TradingView Langage : Pine Script v6 Type : Indicateur d'analyse et d'aide à la décision (non-exécutant) 1. Présentation du projet Nom du produit ONYX SR V2 — Intelligent Support & Resistance Scalping System Objectif Créer un indicateur TradingView capable d'identifier automatiquement des opportunités de scalping basées sur : supports et résistances dynamiques ; action du prix ;
I want to build a fundamental news trading bot that trade off economic news data, as we know every economic news data released always have effect on the asset associated with it, so this bot will take a trade instantly based on the news data released either to buy or sell, it will come with good money management and also SL and TP target based on price and pips value
TumiiFX 30 - 20000 USD
1. Use two EMAs: 20 and 50. If EMA 20 is above EMA 50 → uptrend (look for buys) If EMA 20 is below EMA 50 → downtrend (look for sells) 2. Wait for a pullback into the area between the two EMAs. - For buys: price must touch or move between EMA 20 and EMA 50 during the last few candles. - For stils: same idea, but in a downtrend. 3. Entry signal: Buy: a bullish engulfing candle in an uptrend after the pullback
Ниже представлено готовое, технически выверенное Техническое задание (ТЗ) . Вы можете полностью скопировать этот текст и разместить его на бирже фриланса (например, MQL5.com в разделе «Фриланс» или на Smart-Lab). Данное ТЗ написано на профессиональном языке, понятном разработчикам торговых систем для терминала QUIK (на языке Lua) . ТЕХНИЧЕСКОЕ ЗАДАНИЕ (ТЗ) Разработка мультивалютного торгового робота для терминала
Bot 30 - 80 USD
I am looking for an experienced MQL5 developer to create a fully automated Expert Advisor (EA) for MetaTrader 5 based on a Price Action strategy. The bot needs to automatically identify specific candlestick formations and market structure levels, execute trades, and manage risk using a dynamic trailing stop.The EA should monitor the chart for the following price action setup:Market Structure / Trend Filter:The bot
Master mind 30+ USD
Start ↓ Detect Trend (H4) ↓ Confirm Structure (H1) ↓ Wait for Pullback ↓ Check Indicators ↓ Calculate Confidence Score ↓ Score ≥ 80? ├── No → Wait └── Yes ↓ Calculate Lot Size ↓ Place Order ↓ Set Stop Loss ↓ Set Take Profit ↓ Manage Trade ↓ Move to Break-even ↓ Trail Stop ↓ Close Trade. IF Price > EMA200 (H4) AND EMA50 > EMA200 (H4) AND ADX > 25 AND RSI between 55 and 70 AND MACD Main > Signal AND Bullish engulfing

Informations sur le projet

Budget
150+ USD