Initial commit: MQL5 Scripts Collection (MetaTrader 5)
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
# 🚀 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
|
||||
- `apply_template.mq5`
|
||||
|
||||
---
|
||||
> Made with ❤️ for the trading community.
|
||||
@@ -0,0 +1,47 @@
|
||||
//+------------------------------------------------------------------+
|
||||
//| apply_template.mq5 |
|
||||
//| Copyright 2014, byJJ |
|
||||
//| http://ideiasparainvestir.com |
|
||||
//+------------------------------------------------------------------+
|
||||
#property copyright "Copyright 2014, by JJ"
|
||||
#property link "http://ideiasparainvestir.com"
|
||||
#property version "1.00"
|
||||
#property script_show_inputs
|
||||
#property description "Simple Script for Apply Template and/or timeframe in all charts opened"
|
||||
#include <Charts\Chart.mqh>;
|
||||
|
||||
input ENUM_TIMEFRAMES tempo_grafico; // Change TimeFrame - Current = dont changed
|
||||
input string template_name="D"; // Name of Template (without '.tpl')
|
||||
//+------------------------------------------------------------------+
|
||||
//| Script program start function |
|
||||
//+------------------------------------------------------------------+
|
||||
void OnStart()
|
||||
{
|
||||
long currChart,prevChart=ChartFirst();
|
||||
int i=0,limit=100;
|
||||
bool errTemplate;
|
||||
while(i<limit)
|
||||
{
|
||||
currChart=ChartNext(prevChart); // Obter o ID do novo gráfico usando o ID gráfico anterior
|
||||
|
||||
// Se o tempo grafico e diferente aplica a todos
|
||||
if(tempo_grafico!=PERIOD_CURRENT)
|
||||
{
|
||||
ChartSetSymbolPeriod(prevChart,ChartSymbol(prevChart),tempo_grafico);
|
||||
}
|
||||
|
||||
// Aplica a template
|
||||
errTemplate=ChartApplyTemplate(prevChart,template_name+".tpl");
|
||||
if(!errTemplate)
|
||||
{
|
||||
Print("Erro ao adicionar a template a ",ChartSymbol(prevChart),"-> ",GetLastError());
|
||||
}
|
||||
if(currChart<0) break; // Ter atingido o fim da lista de gráfico
|
||||
Print(i,ChartSymbol(currChart)," ID =",currChart);
|
||||
prevChart=currChart;// vamos salvar o ID do gráfico atual para o ChartNext()
|
||||
i++;// Não esqueça de aumentar o contador
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 80 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 153 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 6.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
Reference in New Issue
Block a user