Average entry price line for multiple positions (exist and the pending positions,too)

MQL4 指标

工作已完成

执行时间2 分钟

指定

I have an avg price indicator wich shows a thick line at the average entry price.

this line exactly same as the initial opening price at the first position,

and shifting towards between the more new positions, showing the cummulated new average price of the all positions. (untill the close.)

all of this is a very simple code ~40 rows,

  • but it have a problem:
    something make slowly the MT4.
    the first part of the job:
    fix this bug which makes it slowlier..

and the second part is:

  • I would like a new function:
    when I place a pending order, then appear a new line (a dotted with same colour) showing the estimated average price with the new pending (limit or stop) order position.
    so the indicator always shows a dotted line, when I place a pending order, and a thick line, when I have already opened positions, too..
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Coral

int gi_76 = 25;
double gda_80[];

int init() {
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, gda_80);
   SetIndexDrawBegin(0, gi_76);
   return (0);
}

int start() {
   int li_4;
   bool li_32;
   int li_12 = IndicatorCounted();
   double ld_16 = 0;
   double ld_24 = 0;
   if (Bars <= gi_76) return (0);
   if (li_12 < 1) for (int li_8 = 0; li_8 <= gi_76; li_8++) gda_80[Bars - li_8] = EMPTY_VALUE;
   int li_36 = Bars - li_12;
   for (li_8 = Bars; li_8 >= 0; li_8--) {
      li_32 = FALSE;
      li_4 = OrdersTotal();
      ld_24 = 0;
      ld_16 = 0;
      if (li_4 > 0) {
         for (int li_0 = 0; li_0 < li_4; li_0++) {
            OrderSelect(li_0, SELECT_BY_POS, MODE_TRADES);
            if (OrderSymbol() == Symbol()) {
               if (OrderType() == OP_BUY || OrderType() == OP_SELL) {
                  li_32 = TRUE;
                  ld_24 += OrderLots();
                  ld_16 += OrderOpenPrice() * OrderLots();
               }
            }
         }
      }
      if (li_32 && ld_24 != 0.0) {
         Comment("\n\nLOTs = " + DoubleToStr(ld_24, 4) + " | AVG price = " + DoubleToStr(ld_16 / ld_24, 4) + "   -- (c)");
         gda_80[li_8] = ld_16 / ld_24;
      } else {
         Comment("\n\nLOTs = 0 | AVG price = -,  (c)");
         gda_80[li_8] = EMPTY_VALUE;
      }
   }
   return (0);
}

反馈

1
开发者 1
等级
(215)
项目
302
79%
仲裁
4
25% / 0%
逾期
62
21%
空闲
2
开发者 2
等级
(1235)
项目
2820
80%
仲裁
156
22% / 43%
逾期
488
17%
空闲
相似订单
The idea of the trading system is as follows: Market entries are performed when the 2 moving averages intersect, the candlestick touches or breaks through the opposite moving average line of the moving average that just crossed but the overall trend has remained the same. The trend is determined by the MACD based on the settings 34 for fast EMA 144 for slow EMA and 9 for MACD SMA. When the MACD is an above the zero
Hello, I bought an EA who has SL but it is not trailing.I need someone who can attach trailing SL to this EA or if it is possible to implement trailing in the EA? I do not have EA code, I bought it and I am using it
Below is the pine eidtor script convert it to MQL5 coding language and create bot based on following condition 1. This all should be on 5-minute chart timeframe 2. For Buy side, buy after closing of second candle when buy signal is given and exit buy position when sell signal is given. 3. For sell side, sell after closing of second candle when sell signal is given and exit sell position when buy signal will be given
I would like the better volume indicator 1.6 in a scanner format. Scanning multiple timeframe and pairs of which can be picked. Would like it to provide all standard noticatioons and also if pressed to go to the a template timeframe and pair
Descripción: Necesito duplicar un indicador detector de cambio de polaridad para el activo Boom 1000 en MetaTrader 5 (MT5). El indicador debe identificar de manera precisa los cambios de polaridad en el mercado y duplicar la funcionalidad para asegurar una detección redundante. Especificaciones clave: El indicador debe generar una señal visual clara en el gráfico (flechas o líneas) cada vez que se detecte un cambio
Poverty 30+ USD
``` def moving_average_crossover(prices, short_window, long_window): short_ma = prices.rolling(window=short_window).mean() long_ma = prices.rolling(window=long_window).mean() signals = np.where(short_ma > long_ma, 1, 0) signals = np.where(short_ma < long_ma, -1, signals) return signals # Example usage: prices = pd.Series([...]) # Replace with your price data short_window = 50 long_window = 200 signals
Brief description. mt4 must be connected via binary.com API. Only for binary trade. Forex pair . Rise/Fall option only. Maximum trade limited options should be given. Profit option should be given. Martingale system. Compounding system Candlestick time counter should be given. There will be two types of signals. A candle stick will come with an arrow symbol. Arrow symbol will appear below another chart. You can
Veltoor sniper 35+ USD
I wanna create trading robot so that it can trade for me during busy hours cause I sometimes miss opportunity to enter my trades because I'm being busy during the day . So I'd like to have a system for me
**Job Title: Experienced Developer Needed for High-Performance Scalping Trading Robot** **Job Description:** We are seeking an experienced and highly skilled developer to create a cutting-edge trading robot specifically designed for scalping strategies. The ideal candidate will have a deep understanding of trading algorithms, extensive experience in financial markets, and a proven track record of developing
Good day, I am looking for a COT report indicator that shows the weekly change in MT4. change in MT4. Number Value Indicator: Speculators (Commercials) Plus minus percent change Tool (exe file ? to load csv... ?). Just for simple updating... Unfortunately I could not find a useful indicator on the net. Please simply offer who has already realised such projects. Thanks

项目信息

预算
10 - 20 USD
开发人员
9 - 18 USD
截止日期
 1  2 天