Code for sending orders on opening of new bar

Tarea técnica

I want my EA to perform the same on a live account with tick data than the performance I get when running it in the Strategy Tester under the "Open Prices" model.

That means when I run my normal EA under the Open Prices model in the Strategy Tester I get a certain result - and i want that result to be duplicated when i run the same EA with the code for opening trades at the opening of a new bar under the "every tick" model.

I understand that the following code does not achieve this objective:

bool IsNewCandle() {
   static datetime lastCandleTime;
   if (Time[0] == lastCandleTime) return false;
   lastCandleTime = Time[0];
   return true;
}
void OnTick() {
   if (IsNewCandle()) {
      // rest of logic goes here
   }
}

Please test this properly on a standard MT4  EA before submitting the code.

Han respondido

1
Desarrollador 1
Evaluación
(87)
Proyectos
134
14%
Arbitraje
41
22% / 29%
Caducado
14
10%
Libre
2
Desarrollador 2
Evaluación
(192)
Proyectos
232
30%
Arbitraje
1
100% / 0%
Caducado
9
4%
Libre
3
Desarrollador 3
Evaluación
(1088)
Proyectos
1439
45%
Arbitraje
49
71% / 12%
Caducado
35
2%
Trabaja
4
Desarrollador 4
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
5
Desarrollador 5
Evaluación
(1)
Proyectos
0
0%
Arbitraje
2
0% / 100%
Caducado
0
Libre
6
Desarrollador 6
Evaluación
(2)
Proyectos
3
0%
Arbitraje
1
0% / 100%
Caducado
0
Libre
7
Desarrollador 7
Evaluación
(2423)
Proyectos
3045
66%
Arbitraje
77
48% / 14%
Caducado
340
11%
Libre
8
Desarrollador 8
Evaluación
(4)
Proyectos
4
0%
Arbitraje
1
0% / 100%
Caducado
1
25%
Libre
9
Desarrollador 9
Evaluación
(253)
Proyectos
408
38%
Arbitraje
86
43% / 19%
Caducado
70
17%
Trabaja
10
Desarrollador 10
Evaluación
(87)
Proyectos
114
26%
Arbitraje
7
29% / 57%
Caducado
5
4%
Libre
11
Desarrollador 11
Evaluación
(26)
Proyectos
34
26%
Arbitraje
7
14% / 43%
Caducado
7
21%
Libre
12
Desarrollador 12
Evaluación
(126)
Proyectos
151
48%
Arbitraje
6
83% / 17%
Caducado
2
1%
Libre
13
Desarrollador 13
Evaluación
(66)
Proyectos
143
34%
Arbitraje
10
10% / 60%
Caducado
26
18%
Libre
Solicitudes similares
Hi, i have a tos script i need converted to Ninja script, but someone who knows both coding. Cant be someone who is just going to paste into chat gpt, it requires more understanding for compatibility
Hello, I am looking for a highly skilled and experienced MT4 developer to assist with transferring a strategy currently coded in Pine Script to MetaTrader 4 (MT4). The project requires a professional who can handle this project successfully. I am looking for a dedicated and professional developer who can deliver high-quality results. If you have any questions or need further details about the project, feel free to
Hello, I am looking for a highly skilled and experienced MT5 developer to assist with modifying an existing MT5 file. I am looking for a dedicated and professional developer who can deliver high-quality results. If you have any questions or need further details about the project, feel free to reach out. Thank you for your time and consideration. I look forward to working with the right expert to bring this project to
We are looking for an experienced coder to develop a trading robot that utilizes two main indicators: 1) Brain Trend Signal 2) TMA (Triple Moving Average) Centered Bands. The robot should generate buy and sell signals based on specific conditions and include robust risk management features. Initial Requirements - **Indicators**: 1. Brain Trend Signal 2. TMA Centered Bands - **Timeframes**: - H4/D1 for trend
1. Combination of Market Profiles on daily basis a) this should be combined if the bell curve is similar to the previous day. Rotational day (volume - standard deviation). b) If breakout, new range should be drawn Conclusion: Market profile should be combined on daily after the market is closed 2. Use Vwap indicator, with 0.5 - slow trend, 1.0 - normal trend, 1.5 fast trend. The stop loss should be under the trend
hi this is a question regarding your telegram to metatrader copier. if i buy the premium/lifetime will it work on unlimited accounts? or will you lock in in an account
Hello, I'm looking for an MQL5 developer that can create an MQL5 code that can accurately mark the following: 1. Swing Break of Structure using Horizontal Ray 2. Internal Break of Structure using Horizontal Ray 3. Extreme Supply and Demand zones using Rectangle 4. Decisional Supply and Demand zones using Rectangle 5. Breaker Block zones using Rectangle 6. Buy to sell wick zones using Rectangle 7. Sell to buy wick
Make a 10000 plus script trading Expert advisor with detail and make it flawless with no errors no tiny mistakes and make it in mql 5 language. Make it adjustable for it to be able to trade on its own and not be disturbed and make it study the chart and be able to trade any currency pair. I have zero experience and I would just like to copy and paste the code in MetaTrader. Can you make it be compatible with both
I need a trading bot, My strategy works with the 1hour timeframe .My stop-loss should be put using Atr of the candle multiply by 1.5 then the value will be added or subtracted from my entry depending on if it's a buy or sell and my entry should be a candlestick pattern also in addition to when the 3 Ema corresponds .When the 8Ema is above the 20Ema and they are both above the 100Ema it is a buy and when the 20Ema is
Looking to create EA for forex tradding with strategy as per price action, where order get excuted with proper stop loss and take profit. and order size should change as per privious trade result

Información sobre el proyecto

Presupuesto
48+ USD
Para el ejecutor
43.2 USD
Plazo límite de ejecución
de 1 a 3 día(s)