code blocks for "counters" like count "x" time and pass

code blocks for "counters" like count "x" time and pass
Download ALL MT5 experts (1592)
YouTube Video Thumbnail



Similar MetaTrader Tools

code blocks for "counters" like count "x" time and pass

Info

The code blocks for "counters" like count "x" time and pass is a Expert Advisor for MetaTrader 5 that 01. count "x" times and then pass.

Usage

This tool is typically used for automated trading on major forex pairs and gold.

Platform

This Expert Advisor works exclusively on MetaTrader 5 (both build 600+ and newer versions).

Setup

Place the downloaded file in MQL5/Experts folder via File ? Open Data Folder in MetaTrader 5.


How to Install and Use code blocks for "counters" like count "x" time and pass

1. Installation: Open the "File" menu, select "Open Data Folder," navigate to MQL/Experts, paste your file, and restart the terminal.

2. Activation: Drag the EA from the Navigator onto a chart, ensure "Allow live trading" is checked in the Common tab, and verify the AutoTrading button is green.

3. Optimization: Right-click your chart, choose "Expert List," click "Properties" to adjust inputs, and save your preferred setup as a set file for future use.

4. Maintenance: Regularly check the "Experts" tab in the terminal window to monitor trade logs and potential execution errors.

Frequently Asked Questions

Q: Why is my EA not opening trades? A: Check the "AutoTrading" button, ensure "Allow live trading" is enabled, and verify your broker allows automated trading on your account type.

Q: Can I run multiple EAs on one chart? A: No, each chart can only host one active EA; however, you can open multiple charts for different currency pairs to run several EAs.

Q: What does the "smiley face" icon mean? A: A smiley face in the top-right corner of the chart indicates the EA is successfully running; a frowny face means it is disabled.

What this tool does

01.

Typical Use Case

This Expert Advisor excels in automated trading and technical analysis on MetaTrader 5.

Compatible Platform & Setup

This Expert Advisor works on MetaTrader 5. Place the file in the MQL5/Experts folder and restart the terminal.

Description & Settings

Related: viral (1 m+ views) 4 hour range strategy coded and tested - another powerful expert for MetaTrader 5 traders.


01. count "x" times and then pass.

Also recommended: morse code - similar expert with strong performance on MetaTrader 5.


step 01
- created a variable for set the
count limit.
you can use it as an
input parameter
as well of optimization in your code.

step 02
- create another variable to store the counted limit (how many times it has been counted).

step 03
- once the
counter
and your
count
limit is equals, that means it's time to pass the code block specified by you.

step 04 -
once the code passed, be sure to
reset the counter
as well. otherwise, it will count for infinite (in this case). you can set filtering conditions to the counter block as well. like, >> "if this is true, then count once."
02. pass "x" times and then wait "x" times then pass.
this method can be use as like wait and pass, pass and wait.

step 01
- created a variable for set the
count limit
and
wait limit
you can use them as an
input parameters
as well of optimization in your code.

step 02
- create another variable to store the counted limit & wait limits (how many times it has been counted and waited).

step 03
- once the
counter
and your
count
limit is equals, that means it's time to pass the code block specified by you.

step 04 -
once the waiter and your count wait limit is equals, that means it's time to wait for a little.

step 04 -
once the waiting limit is reached, be sure to
reset the counter and
waiter
as well. otherwise, it will seese to work (in this case). you can set
filtering conditions
to the counter block and waiter blocks as well. like, >> "if this is true, wait a bit"
special -:
you can code the
"pass x times and stop"
by modifying the above code by
removing the waiting code block.
then it will count for specific number and stop works until the counter is rested. you can reset it anywhere in your code if you create these variables in global scale. (global variables)

You may also like: mq l5 programming for traders – source codes from the book. part 1 - excellent alternative for expert users on MetaTrader 5.

Source Code

input int count = 50; // Set the counting limit as an input
input int wait = 50; // Set the waiting limit as an input
int Counter; // counter variable default value is "0"
int Waiter; // Waiting variable default value is "0"
int OnInit()
{
return(INIT_SUCCEEDED);
}
void OnDeinit(const int reason)
{

.......

Leave your opinion, ask a question, share some knowledge

Limitations & Risk Warning

  • This tool is provided for educational and testing purposes only.
  • Past performance does not guarantee future results.
  • Trading involves substantial risk of loss. Use on a demo account first.
  • Results may vary depending on market conditions, broker, and settings.
  • We recommend thorough backtesting and forward testing before using with real funds.
© ROBOTFX Free educational tools by RobotFX. Use entirely at your own risk; we are not liable for any financial losses incurred.