Codes

Check Last Closed Trade (Profit / Type / Symbol etc.) for MetaTrader 5

Select the last closed deal (trade) to further work

Code blocks for "Counters" like Count "X" time and pass for MetaTrader 5

Here are some examples of codes for set counters based on "Count"

A Code block to detect A "New Candle/Bar" using bars history (very effective way) for MetaTrader 5

If you only want to execute your code blocks "only once per bar" it's important to check if there is new bar arrived or not

Code Block for "Trailing Stop" based on current market price. (Ask / Bid) for MetaTrader 5

This code block loops through all opened position and do trailing based on Ask and Bid prices

Simple Code for Detect A "New Bar or New Candle " Received for MetaTrader 5

This code block detects a New Bar or a New Candle when it has received

Forum

Why this completely upside-down results show on Strategy Tester?

All the testing parameter was same. except the modeling. I'm fully confused with these upside-down results. Can someone please tell me why is that? Results of Modeling - "Every Tick" Results of Modeling - Every Tick based on real ticks

How to calculate leverage adjusted lot size ?.

Lot size = Risk Money / ( Stop Loss Distance * Tick Value) This formula retrieves the lot size. Since Price levels are same and tick values are same for every broker that lot size is the common lot size . But the required margin for that lot size could be different due to the leverage of the trading

Why this code block not calculated the lot size correctly?

I use this code block to calculate the lot size. but when it comes to indices the calculation is very different. as an example, this code block calculates lot size for 10,000$ account with 1:500 leverage is around 3.0 lots. but when it comes to balance 6,000$ with 1:100 leverage , the code is

Can we trust the strategy tester?

I'm tested an EA using a VPS for a week. the EA ended up with loses ( -30.00$ ). then I did a back test for same week with same EA and with the same parameters that used to trade on live trading. but the strategy tester showed me positive results ( +280.00$ ). The strategy was developed by me. so

is there any method to verify this Expert.

I coded an expert advisor. it's works on indices, not in currency pairs. but in the verification process, it only be tested on EURUSD pair. which 100% have issues when the EA operation. is there any method to process this EA for a indices

Help me with this code.

I need to create a custom Demo version for my EA., so I used the OnTesterInt(); function and update a flag if the EA was loaded to strategy tester . but the code doesn't works as expected. What I did wrong here?. bool OnTeseter = false ; int OnInit () { if ( TimeCurrent () < ExpireTime) // If

Is this a bug or normal ?. (ArrayInitialize(); function)

I want to reset my arrays. so I use ArrayInitialize(); function. the function has different types. but no matter which type I selected it only shows the char type input parameters. why is that?. The array I want to reset is a double type. I have selected the double type. but still shows the char

How to remove indicators in strategy Tester ?.

My Expert Advisor uses some technical indicator (like RSI) for trading. but the EA loads all the indicators that EA use to trade to the chart when it's on strategy tester . I want not to load any indicator on the strategy tester. How can I achieve this

I need an article series for learn mql5 programming.

I'm interested in MQL5 programming language. So, I need to learn it furthermore. currently I know some basics and have coded some profitable systems as well. but I need to learn furthermore. Do you have any article series to read. I looked in Articles section, but I couldn't find any series of

Should I reset arrays ?.

I use MA50 []; and MA200 []; arrays for my expert advisor. if the EA is 24h in operation, the arrays also fill with Moving average data. so, should I reset these arrays once for a specific period to avoid calculation errors