Initial commit: MQL5 Scripts Collection (MetaTrader 5)
This commit is contained in:
BIN
Binary file not shown.
|
After Width: | Height: | Size: 101 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 101 KiB |
@@ -0,0 +1,21 @@
|
||||
# 🚀 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
|
||||
- `scirpt-count-consecutive-bull-bear.mq5`
|
||||
|
||||
---
|
||||
> 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.8 KiB |
+105
@@ -0,0 +1,105 @@
|
||||
//+------------------------------------------------------------------+
|
||||
//| Scirpt-Count-Consecutive-Bull-Bear.mq5 |
|
||||
//| Copyright 2024,Rosh Jardine |
|
||||
//| https://www.mql5.com/en/users/roshjardine |
|
||||
//+------------------------------------------------------------------+
|
||||
#property copyright "Copyright 2024,Rosh Jardine"
|
||||
#property link "https://www.mql5.com/en/users/roshjardine"
|
||||
#property version "1.00"
|
||||
//+------------------------------------------------------------------+
|
||||
//| Script program start function |
|
||||
//+------------------------------------------------------------------+
|
||||
void OnStart()
|
||||
{
|
||||
//---
|
||||
int count_in = 0;
|
||||
count_in = CONSECUTIVE_BB(true,150);
|
||||
Print("highest bull consecutive = ",IntegerToString(count_in));
|
||||
count_in = CONSECUTIVE_BB(false,150);
|
||||
Print("highest bear consecutive = ",IntegerToString(count_in));
|
||||
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
int CONSECUTIVE_BB(bool param_count_bull_bo,int param_look_back_in)
|
||||
{
|
||||
int look_back_in = (param_look_back_in<2) ? 3 : param_look_back_in;
|
||||
//--- for testing purpose only
|
||||
string pattern_text = "";
|
||||
for (int i=1;i<=look_back_in;i++)
|
||||
{
|
||||
if (iClose(_Symbol,PERIOD_CURRENT,i)>iOpen(_Symbol,PERIOD_CURRENT,i))
|
||||
{
|
||||
pattern_text += "a";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iClose(_Symbol,PERIOD_CURRENT,i)<iOpen(_Symbol,PERIOD_CURRENT,i))
|
||||
{
|
||||
pattern_text += "b";
|
||||
}
|
||||
else
|
||||
{
|
||||
pattern_text += "c";
|
||||
}
|
||||
}
|
||||
}
|
||||
Print("pattern_text=",pattern_text);
|
||||
string consecutive_text = ""; string last_consecutive_text = ""; string highest_consecutive_text = "";
|
||||
if (param_count_bull_bo)
|
||||
{
|
||||
for (int i=1;i<look_back_in-1;i++)
|
||||
{
|
||||
if (
|
||||
iClose(_Symbol,PERIOD_CURRENT,i)>iOpen(_Symbol,PERIOD_CURRENT,i) &&
|
||||
iClose(_Symbol,PERIOD_CURRENT,i+1)>iOpen(_Symbol,PERIOD_CURRENT,i+1)
|
||||
)
|
||||
{
|
||||
consecutive_text += "a";
|
||||
last_consecutive_text = consecutive_text;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (StringLen(last_consecutive_text)>StringLen(highest_consecutive_text))
|
||||
{
|
||||
Print("last_consecutive_text bull=",last_consecutive_text);
|
||||
highest_consecutive_text = last_consecutive_text;
|
||||
}
|
||||
consecutive_text = "";
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
Print("highest_consecutive_text bull=",highest_consecutive_text);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i=1;i<look_back_in-1;i++)
|
||||
{
|
||||
if (
|
||||
iClose(_Symbol,PERIOD_CURRENT,i)<iOpen(_Symbol,PERIOD_CURRENT,i) &&
|
||||
iClose(_Symbol,PERIOD_CURRENT,i+1)<iOpen(_Symbol,PERIOD_CURRENT,i+1)
|
||||
)
|
||||
{
|
||||
consecutive_text += "b";
|
||||
last_consecutive_text = consecutive_text;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (StringLen(last_consecutive_text)>StringLen(highest_consecutive_text))
|
||||
{
|
||||
Print("last_consecutive_text bear=",last_consecutive_text);
|
||||
highest_consecutive_text = last_consecutive_text;
|
||||
}
|
||||
consecutive_text = "";
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
Print("highest_consecutive_text bear=",highest_consecutive_text);
|
||||
}
|
||||
//--- include the first predecessor +1, count only successors return string length
|
||||
return(StringLen(highest_consecutive_text)+1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
Reference in New Issue
Block a user