Apply 1r1 EURUSD Level 1 Fix ...
This commit is contained in:
@@ -4703,6 +4703,356 @@ public:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Cycles Switched to Bullish or not ...
|
||||||
|
bool IsCyclesSwitchedToBullish(
|
||||||
|
int barIndex, // Bar Index
|
||||||
|
ENUM_X_MARKET_CYCLES &cycles[] //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
int cyclesCount = ArraySize(cycles);
|
||||||
|
result = IsValidSize(cyclesCount);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int cIndex = barIndex;
|
||||||
|
int pIndex = cIndex + 1;
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL cBars[];
|
||||||
|
XOHCL pBars[];
|
||||||
|
for (int i = 0; i < cyclesCount; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XOHCL iCBar;
|
||||||
|
XOHCL iPBar;
|
||||||
|
|
||||||
|
//
|
||||||
|
switch (cycles[i])
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// CURRENT ...
|
||||||
|
case X_MARKET_CYCLE_UNKNOWN:
|
||||||
|
result = CAsOHCL(iCBar, cIndex);
|
||||||
|
break;
|
||||||
|
//
|
||||||
|
// SHORT ...
|
||||||
|
case X_MARKET_CYCLE_SHORT:
|
||||||
|
result = SAsOHCL(iCBar, cIndex);
|
||||||
|
break;
|
||||||
|
//
|
||||||
|
// MEDIUM ...
|
||||||
|
case X_MARKET_CYCLE_MEDIUM:
|
||||||
|
result = MAsOHCL(iCBar, cIndex);
|
||||||
|
break;
|
||||||
|
//
|
||||||
|
// LONG ...
|
||||||
|
case X_MARKET_CYCLE_LONG:
|
||||||
|
result = LAsOHCL(iCBar, cIndex);
|
||||||
|
break;
|
||||||
|
//
|
||||||
|
// HIND ...
|
||||||
|
case X_MARKET_CYCLE_HIND:
|
||||||
|
result = HAsOHCL(iCBar, cIndex);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
AddRef(
|
||||||
|
iCBar,
|
||||||
|
cBars //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
switch (cycles[i])
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// CURRENT ...
|
||||||
|
case X_MARKET_CYCLE_UNKNOWN:
|
||||||
|
result = CAsOHCL(iPBar, pIndex);
|
||||||
|
break;
|
||||||
|
//
|
||||||
|
// SHORT ...
|
||||||
|
case X_MARKET_CYCLE_SHORT:
|
||||||
|
result = SAsOHCL(iPBar, pIndex);
|
||||||
|
break;
|
||||||
|
//
|
||||||
|
// MEDIUM ...
|
||||||
|
case X_MARKET_CYCLE_MEDIUM:
|
||||||
|
result = MAsOHCL(iPBar, pIndex);
|
||||||
|
break;
|
||||||
|
//
|
||||||
|
// LONG ...
|
||||||
|
case X_MARKET_CYCLE_LONG:
|
||||||
|
result = LAsOHCL(iPBar, pIndex);
|
||||||
|
break;
|
||||||
|
//
|
||||||
|
// HIND ...
|
||||||
|
case X_MARKET_CYCLE_HIND:
|
||||||
|
result = HAsOHCL(iPBar, pIndex);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
AddRef(
|
||||||
|
iPBar,
|
||||||
|
pBars //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int cBarsCount = ArraySize(cBars);
|
||||||
|
int pBarsCount = ArraySize(pBars);
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
IsValidSize(cBarsCount) &&
|
||||||
|
cBarsCount == cyclesCount &&
|
||||||
|
//
|
||||||
|
IsValidSize(pBarsCount) &&
|
||||||
|
pBarsCount == cyclesCount
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCIndexBullish = true;
|
||||||
|
for (int i = 0; i < cBarsCount; i++)
|
||||||
|
{
|
||||||
|
isCIndexBullish = isCIndexBullish && cBars[i].IsBullish();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isPIndexBullish = true;
|
||||||
|
for (int i = 0; i < pBarsCount; i++)
|
||||||
|
{
|
||||||
|
isPIndexBullish = isPIndexBullish && pBars[i].IsBullish();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isCIndexBullish &&
|
||||||
|
!isPIndexBullish;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Cycles Switched to Bearish or not ...
|
||||||
|
bool IsCyclesSwitchedToBearish(
|
||||||
|
int barIndex, // Bar Index
|
||||||
|
ENUM_X_MARKET_CYCLES &cycles[] //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
int cyclesCount = ArraySize(cycles);
|
||||||
|
result = IsValidSize(cyclesCount);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int cIndex = barIndex;
|
||||||
|
int pIndex = cIndex + 1;
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL cBars[];
|
||||||
|
XOHCL pBars[];
|
||||||
|
for (int i = 0; i < cyclesCount; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XOHCL iCBar;
|
||||||
|
XOHCL iPBar;
|
||||||
|
|
||||||
|
//
|
||||||
|
switch (cycles[i])
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// CURRENT ...
|
||||||
|
case X_MARKET_CYCLE_UNKNOWN:
|
||||||
|
result = CAsOHCL(iCBar, cIndex);
|
||||||
|
break;
|
||||||
|
//
|
||||||
|
// SHORT ...
|
||||||
|
case X_MARKET_CYCLE_SHORT:
|
||||||
|
result = SAsOHCL(iCBar, cIndex);
|
||||||
|
break;
|
||||||
|
//
|
||||||
|
// MEDIUM ...
|
||||||
|
case X_MARKET_CYCLE_MEDIUM:
|
||||||
|
result = MAsOHCL(iCBar, cIndex);
|
||||||
|
break;
|
||||||
|
//
|
||||||
|
// LONG ...
|
||||||
|
case X_MARKET_CYCLE_LONG:
|
||||||
|
result = LAsOHCL(iCBar, cIndex);
|
||||||
|
break;
|
||||||
|
//
|
||||||
|
// HIND ...
|
||||||
|
case X_MARKET_CYCLE_HIND:
|
||||||
|
result = HAsOHCL(iCBar, cIndex);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
AddRef(
|
||||||
|
iCBar,
|
||||||
|
cBars //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
switch (cycles[i])
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// CURRENT ...
|
||||||
|
case X_MARKET_CYCLE_UNKNOWN:
|
||||||
|
result = CAsOHCL(iPBar, pIndex);
|
||||||
|
break;
|
||||||
|
//
|
||||||
|
// SHORT ...
|
||||||
|
case X_MARKET_CYCLE_SHORT:
|
||||||
|
result = SAsOHCL(iPBar, pIndex);
|
||||||
|
break;
|
||||||
|
//
|
||||||
|
// MEDIUM ...
|
||||||
|
case X_MARKET_CYCLE_MEDIUM:
|
||||||
|
result = MAsOHCL(iPBar, pIndex);
|
||||||
|
break;
|
||||||
|
//
|
||||||
|
// LONG ...
|
||||||
|
case X_MARKET_CYCLE_LONG:
|
||||||
|
result = LAsOHCL(iPBar, pIndex);
|
||||||
|
break;
|
||||||
|
//
|
||||||
|
// HIND ...
|
||||||
|
case X_MARKET_CYCLE_HIND:
|
||||||
|
result = HAsOHCL(iPBar, pIndex);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
AddRef(
|
||||||
|
iPBar,
|
||||||
|
pBars //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int cBarsCount = ArraySize(cBars);
|
||||||
|
int pBarsCount = ArraySize(pBars);
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
IsValidSize(cBarsCount) &&
|
||||||
|
cBarsCount == cyclesCount &&
|
||||||
|
//
|
||||||
|
IsValidSize(pBarsCount) &&
|
||||||
|
pBarsCount == cyclesCount
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCIndexBearish = true;
|
||||||
|
for (int i = 0; i < cBarsCount; i++)
|
||||||
|
{
|
||||||
|
isCIndexBearish = isCIndexBearish && cBars[i].IsBearish();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isPIndexBearish = true;
|
||||||
|
for (int i = 0; i < pBarsCount; i++)
|
||||||
|
{
|
||||||
|
isPIndexBearish = isPIndexBearish && pBars[i].IsBearish();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isCIndexBearish &&
|
||||||
|
!isPIndexBearish;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check All Cycles Switched to Bullish or not ...
|
||||||
|
bool IsSwitchedToBullish(
|
||||||
|
int barIndex // Bar Index
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_MARKET_CYCLES cycles[];
|
||||||
|
int cyclesCount = GetAllMarketCycles(cycles);
|
||||||
|
result = IsValidSize(cyclesCount);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = IsCyclesSwitchedToBullish(
|
||||||
|
barIndex,
|
||||||
|
cycles //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check All Cycles Switched to Bearish or not ...
|
||||||
|
bool IsSwitchedToBearish(
|
||||||
|
int barIndex // Bar Index
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_MARKET_CYCLES cycles[];
|
||||||
|
int cyclesCount = GetAllMarketCycles(cycles);
|
||||||
|
result = IsValidSize(cyclesCount);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = IsCyclesSwitchedToBearish(
|
||||||
|
barIndex,
|
||||||
|
cycles //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Conditions ...
|
// Conditions ...
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,114 @@
|
|||||||
|
//+------------------------------------------------------------------+
|
||||||
|
//| Decision_Candles_Colored.mq5 |
|
||||||
|
//| Copyright 2021, MetaQuotes Ltd. |
|
||||||
|
//| https://www.mql5.com |
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
#property copyright "Mohamed"
|
||||||
|
#property link "https://www.mql5.com/en/code/50992"
|
||||||
|
#property version "1.10"
|
||||||
|
#property strict
|
||||||
|
#property indicator_chart_window
|
||||||
|
#property indicator_buffers 8
|
||||||
|
#property indicator_plots 2
|
||||||
|
|
||||||
|
#property indicator_type1 DRAW_CANDLES
|
||||||
|
#property indicator_color1 clrBlue, clrAqua
|
||||||
|
#property indicator_style1 STYLE_SOLID
|
||||||
|
#property indicator_width1 1
|
||||||
|
|
||||||
|
#property indicator_type2 DRAW_CANDLES
|
||||||
|
#property indicator_color2 clrRed, clrDarkOrange
|
||||||
|
#property indicator_style2 STYLE_SOLID
|
||||||
|
#property indicator_width2 1
|
||||||
|
|
||||||
|
input double dcpercent = 50; // Decision Candle Body/range Percentage
|
||||||
|
|
||||||
|
double buff0[];
|
||||||
|
double buff1[];
|
||||||
|
double buff2[];
|
||||||
|
double buff3[];
|
||||||
|
|
||||||
|
double buff4[];
|
||||||
|
double buff5[];
|
||||||
|
double buff6[];
|
||||||
|
double buff7[];
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
//| Custom indicator initialization function |
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
int OnInit()
|
||||||
|
{
|
||||||
|
//--- indicator buffers mapping
|
||||||
|
|
||||||
|
IndicatorSetString(INDICATOR_SHORTNAME, "DCandles");
|
||||||
|
|
||||||
|
SetIndexBuffer(0, buff0, INDICATOR_DATA);
|
||||||
|
SetIndexBuffer(1, buff1, INDICATOR_DATA);
|
||||||
|
SetIndexBuffer(2, buff2, INDICATOR_DATA);
|
||||||
|
SetIndexBuffer(3, buff3, INDICATOR_DATA);
|
||||||
|
|
||||||
|
SetIndexBuffer(4, buff4, INDICATOR_DATA);
|
||||||
|
SetIndexBuffer(5, buff5, INDICATOR_DATA);
|
||||||
|
SetIndexBuffer(6, buff6, INDICATOR_DATA);
|
||||||
|
SetIndexBuffer(7, buff7, INDICATOR_DATA);
|
||||||
|
|
||||||
|
for(int in = 0; in < 8; in++)PlotIndexSetInteger(in, PLOT_SHOW_DATA, false);
|
||||||
|
|
||||||
|
//---
|
||||||
|
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 start = prev_calculated;
|
||||||
|
|
||||||
|
if(start >= rates_total)start = rates_total - 1;
|
||||||
|
if(start < 0)start = 0;
|
||||||
|
|
||||||
|
for(int i = start; i < rates_total; i++)
|
||||||
|
{
|
||||||
|
buff0[i] = EMPTY_VALUE;
|
||||||
|
buff1[i] = EMPTY_VALUE;
|
||||||
|
buff2[i] = EMPTY_VALUE;
|
||||||
|
buff3[i] = EMPTY_VALUE;
|
||||||
|
buff4[i] = EMPTY_VALUE;
|
||||||
|
buff5[i] = EMPTY_VALUE;
|
||||||
|
buff6[i] = EMPTY_VALUE;
|
||||||
|
buff7[i] = EMPTY_VALUE;
|
||||||
|
|
||||||
|
bool DC = (high[i] - low[i]) * dcpercent / 100 <= fabs(close[i] - open[i]);
|
||||||
|
bool up = DC && close[i] > open[i];
|
||||||
|
bool dn = DC && close[i] < open[i];
|
||||||
|
|
||||||
|
if(up)
|
||||||
|
{
|
||||||
|
buff0[i] = open[i];
|
||||||
|
buff1[i] = high[i];
|
||||||
|
buff2[i] = low[i];
|
||||||
|
buff3[i] = close[i];
|
||||||
|
}
|
||||||
|
if(dn)
|
||||||
|
{
|
||||||
|
buff4[i] = open[i];
|
||||||
|
buff5[i] = high[i];
|
||||||
|
buff6[i] = low[i];
|
||||||
|
buff7[i] = close[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--- return value of prev_calculated for next call
|
||||||
|
return(rates_total);
|
||||||
|
}
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
|
||||||
+13390
-1
File diff suppressed because it is too large
Load Diff
+12612
-1
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+7603
-1
File diff suppressed because it is too large
Load Diff
@@ -350,6 +350,14 @@ public:
|
|||||||
//
|
//
|
||||||
// Detecting Signals ...
|
// Detecting Signals ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCHHKFullSwitchedToBullish =
|
||||||
|
chhkHelper.IsSwitchedToBullish(cIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCHHKFullSwitchedToBearish =
|
||||||
|
chhkHelper.IsSwitchedToBearish(cIndex);
|
||||||
|
|
||||||
//
|
//
|
||||||
result = hasLong || hasShort;
|
result = hasLong || hasShort;
|
||||||
if (!result)
|
if (!result)
|
||||||
@@ -650,11 +658,11 @@ private:
|
|||||||
chhkInputs.ignoreShadows = true;
|
chhkInputs.ignoreShadows = true;
|
||||||
|
|
||||||
//
|
//
|
||||||
chhkInputs.showCurrent = false;
|
chhkInputs.showCurrent = true;
|
||||||
chhkInputs.showShort = false;
|
chhkInputs.showShort = true;
|
||||||
chhkInputs.showMedium = false;
|
chhkInputs.showMedium = true;
|
||||||
chhkInputs.showLong = false;
|
chhkInputs.showLong = true;
|
||||||
chhkInputs.showHind = false;
|
chhkInputs.showHind = true;
|
||||||
|
|
||||||
//
|
//
|
||||||
chhkHelper = new XSCXCHHKHelper();
|
chhkHelper = new XSCXCHHKHelper();
|
||||||
|
|||||||
Reference in New Issue
Block a user