Class-driven Averaging Subroutine - position averaging function, opening positions against the trend

MQL5 エキスパート

仕事が完了した

実行時間43 日
開発者からのフィードバック
Great customer. Clear instructions. Thanks. Look forward to more jobs in the future.

指定

Develop a class-driven sub-routine that can be implemented in a variety of existing Expert Advisor with minimum complications of integration. It should implement a good OOP concept for reusability and derive sub-mechanisms.

This sub-routine will work on algorithms running on MT5 terminal; we may need to develop an expert advisor opening a long or short position for test. This subroutine purpose is to implement a strategy of averaging down.

This is that we open:

BUY 1 LOT EURUSD at 1.19209

This sub-routine will open automatically

BUY 1.3 LOT EURUSD at 1.19172 with a comment "Level_1"

Resulting on an average price in EURUSD of 1.19195 at 2.30 LOT, so this sub will draw a BLUE line at this average level. RED if SELL position.

Attention: For different LOT of positions, the average price is calculated using a mathematical formula.

Finally, will open automatically if the price continue against:

BUY 1.69 LOT EURUSD at 1.19078 with a comment "Level_2"

This next average level as is not open yet so will draw a line in "Bisque" color with the parameters of the averager sub-routine in this case the LOT factor increases to a 30% or 1.3X and the amount of PIPs in the following format:  1.30X/1.69N/94p indicating the average %, resulting lot size and pips in distance.

If this average level is triggered then the average price of the EURUSD position is 1.19145 at 3.99 LOT.

The PIPs difference between 1.19209 and 1.19172 and the next 1.19145 is provided as a parameter for the sub-routine.

The averager sub-routine will have a maximum amount of positions to open. And a FLOOR parameter that sets the minimum distance, this distance can be set in price or points. If in the example below we set a price floor of 1.19130 the next level provided can not be 1.19145 and will be floored at 1.19130. If we set a points floor of 70 pips the next level can not be 67 pips as provided and will be floored at 70 pips.

The subroutine will increase distance in the same way to increase volume, this is that an increment can be set of a 10% or 1.1X added to the distance provided.

If the instrument maximun volume is 50, and the next average down is 56. We will fraction the order in 50 (the max.) and another position at the same price level at 6, with the same comment. If the broker have a maxium limit of positions and can not open, we will pop-up a message alterting with the limitation of opening new positions. 

Finally, the sub-routine will use a time delay to evaluate if a different distance in pips is supplied.

Inputs:

AveragerFunc(
             bool AverageUSE=true,
             int Distance=1,
             ENUM MinDistType=1, //1-Price, 2-Points
             double MinDistVal=0,
             bool UseCalcDelay=true,
             ENUM CalcDelay=1M, //1M,2M,5M,15M,1H,1D,1W, TF defaults in example
             DistanceFactor=1.1, //points + 10% in this case
             LotsFactor=1.3, //volume + 30% in this case
             MaxOrders=10, //maximum of averaging positions
             string s="Averager " //default comment for opening positions and concatenate
             )

Output of the subroutine will be:
LOTs BUY:        2.3             //actual volume size
LONG Avg:       1.19195       //actual average
LONG N Avg:    1.19145       //next average

The average calculation have to take into account any commission and swap charges in any given period. So if this positions stays for more than a day and a swap is charged, have to be reflected in the resulting average price every day.

Attached an image of the horizontal lines.

応答済み

1
開発者 1
評価
(27)
プロジェクト
43
7%
仲裁
18
6% / 78%
期限切れ
26
60%
2
開発者 2
評価
(169)
プロジェクト
204
30%
仲裁
25
40% / 44%
期限切れ
12
6%
類似した注文
I need a MetaTrader 5 Expert Advisor (EA) built based on a clear, rule-based strategy for XAUUSD on the M5 timeframe. Indicators used: EMA 50 (Exponential, Close) EMA 200 (Exponential, Close) RSI (14) Stochastic Oscillator (14,3,3) BUY rules: Price above EMA 50 and EMA 200 RSI between 10 and 25 Stochastic crosses upward from below 20 Bullish candle close SELL rules: Price below EMA 50 and EMA 200 RSI between 80 and
IF no open trades AND trading session is London or New York THEN IF price > EMA50 AND price > EMA200 SET trade_direction = BUY ELSE IF price < EMA50 AND price < EMA200 SET trade_direction = SELL ELSE EXIT (do nothing) IF trade_direction = BUY AND RSI >= 10 AND RSI <= 25 AND Stochastic_K crosses above Stochastic_D AND candle closes bullish THEN Open BUY trade Set Stop Loss Set Take
Nhân bản vô tính 30 - 70 USD
Tôi có 1 mt4 được chia sẻ, bạn có ai giúp tôi sao chép chiến lược của mỗi cái này không? Đặc biệt: _ phù hợp tài khoản vốn nhỏ _ vào nhiều lệnh _ không có tính năng né tin nhưng dù có tin ra thì vẫn giao dịch an toàn. I have an MT4 trading platform that was shared with me. Can anyone help me copy the trading strategies for each of these platforms? Specifically: _ Suitable for small capital accounts _ Allows for
Platform: MT5 | Instrument: XAUUSD | Broker: IC Markets (ECN) Style: High-speed scalping / short-term momentum | Timeframes: M1 & M5 | Operation: Fully automated, 24/5 Overview We seek an experienced MQL5 developer to build a fast, reliable EA for live trading. The EA must: Detect symbol specifications automatically (digits, tick size, contract size) Operate continuously without manual intervention Follow logical
I want recovery zone system to attach with any other ea on chart to manage per trade by zone recovery strategy with management of sl tp to cover in profits or neutral
Monthly >Previous month High and Low.High is Resistance and Low is Support level Daily > Demand and supply zones. Demand Below Support Level and Supply Above Resistance Level. 4HOUR >Up-Tren,Down-Trend and Cosolodation >Market Structure CHOCH,BOS >3 phase movement HH,HL and LL,LH. Entry
Our EA was martiangle on EURUSD that double lot size in every 20 pips we want to change parameters for what to do in trending market so we want devloper who can help us to modify the and guide us what parameters we can change in trending market
We are looking for an experienced cTrader (cAlgo) developer to port and implement AI Gold Sniper , an advanced automated trading system originally built for MT4/MT5, to cTrader . System Overview: AI Gold Sniper is a XAU/USD (Gold) trading EA that uses GPT-4o AI , deep learning (CNN), recurrent networks (RNN), and natural language processing (NLP) to analyze: Historical price data Macroeconomic indicators (interest
EA Development mentor 30 - 40 USD
am looking for a Mentor that has verifiable experience trading forex and commodities. Somebody who has a couple years experience in failures and successes. I am not a beginner. I have modest success already with discretionary trading. I have had an EA created that is very promising. It has extensive testing with very good results. The idea would be to work together advancing the existing EA and build additional EA's
Existing EA 30 USD
I’m looking to acquire an existing, profitable Expert Advisor (EA) with full source code to add to our client investment portfolio. To be clear, this is not a request to develop or design a new strategy. If you already have an EA that is proven, consistent, and production-ready, I’m open to reviewing it immediately. Please apply only if you meet all the requirements below. Submissions without a proper introduction or

プロジェクト情報

予算
150+ USD
締め切り
最低 1 最高 10 日