Initial commit: MQL5 Indicators Collection (MetaTrader 5) - Part 3
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
@@ -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!
|
||||
|
||||
---
|
||||
|
||||
## Files included:
|
||||
### Source Files:
|
||||
- `ssl_channel_chart.mq5`
|
||||
|
||||
### Screenshots:
|
||||

|
||||

|
||||
|
||||
> Made with ❤️ for the trading community.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
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 |
@@ -0,0 +1,115 @@
|
||||
//+------------------------------------------------------------------+
|
||||
//| SSL Channel Chart.mq5 |
|
||||
//| Copyright 2020, MetaQuotes Software Corp. |
|
||||
//| https://www.mql5.com |
|
||||
//+------------------------------------------------------------------+
|
||||
#property copyright "Copyright 2020, MetaQuotes Software Corp."
|
||||
#property link "https://www.mql5.com"
|
||||
|
||||
//------------------------------------------------------------------
|
||||
#property indicator_chart_window
|
||||
#property indicator_buffers 3
|
||||
#property indicator_plots 2
|
||||
#property indicator_label1 "Bears"
|
||||
#property indicator_color1 clrOrange
|
||||
#property indicator_type1 DRAW_LINE
|
||||
#property indicator_width1 2
|
||||
#property indicator_label2 "Bulls"
|
||||
#property indicator_color2 clrAqua
|
||||
#property indicator_type2 DRAW_LINE
|
||||
#property indicator_width2 2
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
||||
//---- input parameters
|
||||
input ENUM_MA_METHOD MA_Method = MODE_SMA; // Method
|
||||
input int Lb = 10;
|
||||
//---- buffers
|
||||
|
||||
double ssld[];
|
||||
double sslu[];
|
||||
double Hlv[];
|
||||
|
||||
int hMAHigh;
|
||||
int hMALow;
|
||||
//+------------------------------------------------------------------+
|
||||
//| Custom indicator initialization function |
|
||||
//+------------------------------------------------------------------+
|
||||
int OnInit()
|
||||
{
|
||||
|
||||
SetIndexBuffer(0, ssld, INDICATOR_DATA);
|
||||
SetIndexBuffer(1, sslu, INDICATOR_DATA);
|
||||
SetIndexBuffer(2, Hlv, INDICATOR_CALCULATIONS);
|
||||
|
||||
hMAHigh = iMA(_Symbol, PERIOD_CURRENT, Lb, 0, MA_Method, PRICE_HIGH);
|
||||
hMALow = iMA(_Symbol, PERIOD_CURRENT, Lb, 0, MA_Method, PRICE_LOW);
|
||||
|
||||
|
||||
if(hMAHigh==INVALID_HANDLE)Print(" Failed to get handle of the iMA indicator");
|
||||
if(hMALow==INVALID_HANDLE)Print(" Failed to get handle of the iMA indicator");
|
||||
|
||||
ArraySetAsSeries(ssld,true);
|
||||
ArraySetAsSeries(sslu,true);
|
||||
ArraySetAsSeries(Hlv,true);
|
||||
//---
|
||||
return(INIT_SUCCEEDED);
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| Custom indicator iteration function |
|
||||
//+------------------------------------------------------------------+
|
||||
int OnCalculate(const int rates_total,
|
||||
const int prev_calculated,
|
||||
const datetime &time[],
|
||||
const double &open[],
|
||||
const double &high[],
|
||||
const double &low[],
|
||||
const double &close[],
|
||||
const long &tick_volume[],
|
||||
const long &volume[],
|
||||
const int &spread[])
|
||||
{
|
||||
//---
|
||||
int counted_bars = prev_calculated;
|
||||
int i,limit;
|
||||
|
||||
double MAHigh[];
|
||||
double MALow[];
|
||||
|
||||
if(counted_bars<0) return(-1);
|
||||
if(counted_bars>0) counted_bars--;
|
||||
|
||||
limit = MathMax(rates_total - counted_bars - Lb, 1);
|
||||
|
||||
|
||||
|
||||
CopyBuffer(hMAHigh, 0, 0, limit+1, MAHigh);
|
||||
CopyBuffer(hMALow, 0, 0, limit+1, MALow);
|
||||
|
||||
for(i=limit; i>=0; i--)
|
||||
{
|
||||
|
||||
Hlv[i]=Hlv[i+1];
|
||||
|
||||
if (close[rates_total-1-i] > MAHigh[limit-i]) Hlv[i]= 1;
|
||||
if (close[rates_total-1-i] < MALow[limit-i]) Hlv[i]= -1;
|
||||
|
||||
if(Hlv[i]==-1)
|
||||
{
|
||||
ssld[i] = MAHigh[limit-i];
|
||||
sslu[i] = MALow[limit-i];
|
||||
}
|
||||
else
|
||||
{
|
||||
ssld[i] = MALow[limit-i];
|
||||
sslu[i] = MAHigh[limit-i];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--- return value of prev_calculated for next call
|
||||
return(rates_total);
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
Reference in New Issue
Block a user