Build Me A Simple Hedging Strategy

Lavoro terminato

Tempo di esecuzione 2 giorni
Feedback del cliente
Did good quality work and on time. The EA and source code looks well done.
Feedback del dipendente
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

Specifiche

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.


  

Con risposta

1
Sviluppatore 1
Valutazioni
(6)
Progetti
12
8%
Arbitraggio
1
0% / 100%
In ritardo
4
33%
Gratuito
2
Sviluppatore 2
Valutazioni
(47)
Progetti
81
52%
Arbitraggio
1
0% / 0%
In ritardo
1
1%
In elaborazione
3
Sviluppatore 3
Valutazioni
(97)
Progetti
135
52%
Arbitraggio
4
50% / 50%
In ritardo
0
In elaborazione
4
Sviluppatore 4
Valutazioni
(64)
Progetti
198
72%
Arbitraggio
4
100% / 0%
In ritardo
1
1%
Gratuito
5
Sviluppatore 5
Valutazioni
(42)
Progetti
88
14%
Arbitraggio
31
29% / 55%
In ritardo
36
41%
In elaborazione
6
Sviluppatore 6
Valutazioni
(57)
Progetti
72
22%
Arbitraggio
13
46% / 15%
In ritardo
5
7%
Gratuito
7
Sviluppatore 7
Valutazioni
(74)
Progetti
121
43%
Arbitraggio
12
33% / 50%
In ritardo
17
14%
Gratuito
8
Sviluppatore 8
Valutazioni
(10)
Progetti
17
24%
Arbitraggio
3
67% / 33%
In ritardo
2
12%
Gratuito
9
Sviluppatore 9
Valutazioni
(47)
Progetti
72
44%
Arbitraggio
3
0% / 100%
In ritardo
1
1%
In elaborazione
10
Sviluppatore 10
Valutazioni
(568)
Progetti
641
41%
Arbitraggio
22
55% / 32%
In ritardo
47
7%
In elaborazione
11
Sviluppatore 11
Valutazioni
(249)
Progetti
447
34%
Arbitraggio
57
35% / 37%
In ritardo
165
37%
Occupato
12
Sviluppatore 12
Valutazioni
(261)
Progetti
427
38%
Arbitraggio
86
44% / 19%
In ritardo
71
17%
Caricato
13
Sviluppatore 13
Valutazioni
(67)
Progetti
144
34%
Arbitraggio
10
10% / 60%
In ritardo
26
18%
Gratuito
14
Sviluppatore 14
Valutazioni
(1)
Progetti
2
0%
Arbitraggio
1
100% / 0%
In ritardo
0
In elaborazione
Ordini simili
Hey greetings am in need of a developer that can convert my simple tradingview indicator to MT4 I have the source code of the indicator and is also a public indicator on Tradingview site Kindly bid and let started
Preciso de um EA que abra ordens a mercado a partir de um indicador, Ele precisa obter take e stop loss fixos, spread máximo, horários de início e final das operações, meta e stop diário, martingale, painel e a função no script para que eu possa ceder o EA apartir do id do mt4 de terceiros
can you help me with Ctrader i need modification on the linkhttps://docs.google.com/document/d/1fggk49xWbnwahtfOlE-U7G6muZB1FT8eWmftGiY7R-s/edit?usp=sharing can you assist with cTrader modifications to enhance functionality and improve performance. do text me if you a professional on it i will be looking forward to your response best regards
Hello, I’m looking for assistance with creating or customizing a TradingView indicator to suit my trading needs. If you have experience in this area, please reach out. Your help would be greatly appreciated. Thanks
I need an expert to help me convert chopzone traingview pinescript to mt4, I need an expert to get it done for me on between 1 to 2 days i hope this will be done by then, i will attach the file and my budget is $30 as of minimum here
Good programmer need to use 1 indicator convert to expert advisor. kennel Kennel indicator-- upper channel signal = Sell Kennel indicator-- Lower channel signal = Buy Entry on New candle or Bar after close of Signal candle lot size-- Take profit--- Stoploss--- Trail start--- Trail step--- Max spread = 200 Hedge of signal = true/false multiplier = percentage Risk = percentage. magic-- CHECK OUT THE LINK
CORREÇÃO NOTIFICAÇÕES Ø O indicador muda a cor dos candles e da MA200 quando ocorre as entradas e é somente nesse momento que ele deve enviar notificação de entrada porem está enviando em outros momentos que não atende as condições conforme imagem abaixo. Ø Sempre que abro o MT5, mudo o time frame ou a plataforma perde conexão o indicador me envia notificações de entradas passadas, o indicador deve enviar
Seb’s EA 2024/25 200 - 500 USD
Primary Agreement Description Details: This EA Strategy is to run on MT4. It has parameters for 2 MA's and 3 momentum indicators along with 22 "variable / constant rules & settings" on 1 time-frame (5 Min). There are 3 versions required to cater for 3 different Instruments (3 US Indexes). The only differences will be the position sizes, Stop levels & Macd bands. There are 3 entry conditions with 3 exit conditions
**Description:** I am looking for an experienced MQL4 programmer to develop a sophisticated Expert Advisor (EA) for MetaTrader 4 (MT4) using a **Hidden Markov Model (HMM)** to predict market trends for forex trading. The EA will be used for live trading on forex pairs like EUR/USD and should incorporate statistical modeling with advanced machine learning algorithms. ### **Requirements:** - **Strong MQL4 Expertise**
Using the Fibonacci retracement strategy to open trade exit trade and also set TP and SL. Each level on Fibonacci are predetermined to open a position and increase the lot size (Martigale) as market price go again the previous opened position. I have a clear details on the strategy which I will share you once you respond to this

Informazioni sul progetto

Budget
150+ USD
Per lo sviluppatore
135 USD