Initial commit: MQL5 Scripts Collection (MetaTrader 5)
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
# 🚀 Unlock the Power of Trading!
|
||||
|
||||
Welcome to this open-source trading project. Here you will find powerful tools to enhance your trading journey. If you find this project useful, please consider starring ⭐, sharing, or donating to support further development!
|
||||
|
||||
---
|
||||
|
||||
**Support the project:**
|
||||
- Star this repository on GitHub
|
||||
- Share it with your trading friends
|
||||
- [Donate here](https://www.paypal.com/donate/?hosted_button_id=YOUR_BUTTON_ID) to help us grow!
|
||||
|
||||
---
|
||||

|
||||

|
||||
|
||||
## Source Files
|
||||
- `watch_launcher.mq5`
|
||||
|
||||
---
|
||||
> Made with ❤️ for the trading community.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
@@ -0,0 +1,97 @@
|
||||
//+------------------------------------------------------------------+
|
||||
//| Market_Watch_Launcher.mq5 |
|
||||
//+------------------------------------------------------------------+
|
||||
//| This file is free software; you can redistribute it and/or |
|
||||
//| modify it under the terms of the GNU General Public License as |
|
||||
//| published by the Free Software Foundation (www.fsf.org); either |
|
||||
//| version 2 of the License, or (at your option) any later version. |
|
||||
//| |
|
||||
//| This program is distributed in the hope that it will be useful, |
|
||||
//| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
//| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
//| GNU General Public License for more details. |
|
||||
//+------------------------------------------------------------------+
|
||||
#property script_show_inputs
|
||||
#property version "1.00"
|
||||
//+------------------------------------------------------------------+
|
||||
//| |
|
||||
//+------------------------------------------------------------------+
|
||||
#property description " This script opens all market watch symbols with the default template"
|
||||
#property description "using the selected period. Save prefferred template as default.tpl to have all"
|
||||
#property description " charts open with same template of your choice. Happy Trading."
|
||||
//+------------------------------------------------------------------+
|
||||
//| |
|
||||
//+------------------------------------------------------------------+
|
||||
#include <Trade\SymbolInfo.mqh>
|
||||
enum spread {
|
||||
up_to_10, // 10 or less
|
||||
up_to_20, // 20 or less
|
||||
up_to_30, // 30 or less
|
||||
up_to_40, // 40 or less
|
||||
up_to_50, //50 or less
|
||||
up_to_100, // 100 or less
|
||||
all_values // Full marketwatch
|
||||
};
|
||||
//---
|
||||
input ENUM_TIMEFRAMES Time_frame = NULL;
|
||||
input spread Max_spread = all_values;
|
||||
CSymbolInfo m_symbol;
|
||||
string Pair;
|
||||
//+------------------------------------------------------------------+
|
||||
//| Script program start function |
|
||||
//+------------------------------------------------------------------+
|
||||
void OnStart() {
|
||||
// loop through market watch and open symbols fitting specifications
|
||||
for(int i = 0; i < SymbolsTotal(true); i++) {
|
||||
Pair = SymbolName(i, true);
|
||||
if(Pair == SymbolName(i, true)) {
|
||||
if(m_symbol.Name(Pair)) {
|
||||
int spread_limit = maxSpread(Max_spread);
|
||||
//---
|
||||
if(spread_limit == -1)
|
||||
ChartOpen(Pair, Time_frame);
|
||||
else if(m_symbol.Spread() < spread_limit)
|
||||
ChartOpen(Pair, Time_frame);
|
||||
}
|
||||
}
|
||||
if(i == 0) {
|
||||
ChartClose(0);
|
||||
}
|
||||
}
|
||||
//--- The task was completed successfully.
|
||||
//--- Close the script and print some info for the user
|
||||
Print("Task Complete. Closing...");
|
||||
return;
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
//| process user input n |
|
||||
//+------------------------------------------------------------------+
|
||||
const int maxSpread(spread value) {
|
||||
int result;
|
||||
switch(value) {
|
||||
case up_to_10:
|
||||
result = 10;
|
||||
break;
|
||||
case up_to_20:
|
||||
result = 20;
|
||||
break;
|
||||
case up_to_30:
|
||||
result = 30;
|
||||
break;
|
||||
case up_to_40:
|
||||
result = 40;
|
||||
break;
|
||||
case up_to_50:
|
||||
result = 50;
|
||||
break;
|
||||
case up_to_100:
|
||||
result = 100;
|
||||
break;
|
||||
default:
|
||||
result = -1;
|
||||
break;
|
||||
}
|
||||
//--- return value
|
||||
return result;
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
Reference in New Issue
Block a user