last ... Om EURUSD ...
This commit is contained in:
+163
-94
@@ -37,33 +37,43 @@
|
||||
|
||||
//
|
||||
input group "Ribbon 1";
|
||||
input int fast1Length = 3; // Fast
|
||||
input int slow1Length = 5; // Slow
|
||||
input int fast1Length = 20; // Fast
|
||||
input int slow1Length = 50; // Slow
|
||||
input ENUM_APPLIED_PRICE r1AppliedTo = PRICE_HIGH; // Applied To
|
||||
|
||||
//
|
||||
input group "Ribbon 2";
|
||||
input int fast2Length = 8; // Fast
|
||||
input int slow2Length = 13; // Slow
|
||||
input int fast2Length = 20; // Fast
|
||||
input int slow2Length = 50; // Slow
|
||||
input ENUM_APPLIED_PRICE r2AppliedTo = PRICE_OPEN; // Applied To
|
||||
|
||||
//
|
||||
input group "Ribbon 3";
|
||||
input int fast3Length = 21; // Fast
|
||||
input int slow3Length = 34; // Slow
|
||||
input int fast3Length = 20; // Fast
|
||||
input int slow3Length = 50; // Slow
|
||||
input ENUM_APPLIED_PRICE r3AppliedTo = PRICE_CLOSE; // Applied To
|
||||
|
||||
//
|
||||
input group "Ribbon 4";
|
||||
input int fast4Length = 55; // Fast
|
||||
input int slow4Length = 89; // Slow
|
||||
input int fast4Length = 20; // Fast
|
||||
input int slow4Length = 50; // Slow
|
||||
input ENUM_APPLIED_PRICE r4AppliedTo = PRICE_MEDIAN; // Applied To
|
||||
|
||||
//
|
||||
input group "Ribbon 5";
|
||||
input int fast5Length = 144; // Fast
|
||||
input int slow5Length = 233; // Slow
|
||||
input int fast5Length = 20; // Fast
|
||||
input int slow5Length = 50; // Slow
|
||||
input ENUM_APPLIED_PRICE r5AppliedTo = PRICE_TYPICAL; // Applied To
|
||||
|
||||
//
|
||||
input group "Ribbon 6";
|
||||
input int fast6Length = 20; // Fast
|
||||
input int slow6Length = 50; // Slow
|
||||
input ENUM_APPLIED_PRICE r6AppliedTo = PRICE_LOW; // Applied To
|
||||
|
||||
//
|
||||
input group "Calculation";
|
||||
input ENUM_MA_METHOD ribbonMode = MODE_EMA; // Mode
|
||||
input ENUM_APPLIED_PRICE ribbonAppliedTo = PRICE_CLOSE; // Applied To
|
||||
input ENUM_MA_METHOD ribbonMode = MODE_EMA; // Mode
|
||||
|
||||
//
|
||||
input group "Presentation";
|
||||
@@ -93,8 +103,8 @@ input bool showRibbon = false; // Show Ribbon
|
||||
#property indicator_chart_window
|
||||
|
||||
//
|
||||
#property indicator_buffers 12
|
||||
#property indicator_plots 12
|
||||
#property indicator_buffers 14
|
||||
#property indicator_plots 14
|
||||
|
||||
//
|
||||
// PLOTTED Buffers ...
|
||||
@@ -188,63 +198,85 @@ double fast5Buffer[];
|
||||
#property indicator_width7 1
|
||||
|
||||
//
|
||||
// SLOW ...
|
||||
#define fast6BufferIndex 7
|
||||
double fast6Buffer[];
|
||||
|
||||
//
|
||||
#define slow1BufferIndex 7
|
||||
double slow1Buffer[];
|
||||
|
||||
//
|
||||
#property indicator_label8 "XMRB 1 S"
|
||||
#property indicator_label8 "XMRB 6 F"
|
||||
#property indicator_type8 DRAW_LINE
|
||||
#property indicator_color8 clrPlum
|
||||
#property indicator_color8 clrAquamarine
|
||||
#property indicator_style8 STYLE_DOT
|
||||
#property indicator_width8 1
|
||||
|
||||
//
|
||||
#define slow2BufferIndex 8
|
||||
double slow2Buffer[];
|
||||
// SLOW ...
|
||||
|
||||
//
|
||||
#property indicator_label9 "XMRB 2 S"
|
||||
#define slow1BufferIndex 8
|
||||
double slow1Buffer[];
|
||||
|
||||
//
|
||||
#property indicator_label9 "XMRB 1 S"
|
||||
#property indicator_type9 DRAW_LINE
|
||||
#property indicator_color9 clrPlum
|
||||
#property indicator_style9 STYLE_DOT
|
||||
#property indicator_width9 1
|
||||
|
||||
//
|
||||
#define slow3BufferIndex 9
|
||||
double slow3Buffer[];
|
||||
#define slow2BufferIndex 9
|
||||
double slow2Buffer[];
|
||||
|
||||
//
|
||||
#property indicator_label10 "XMRB 3 S"
|
||||
#property indicator_label10 "XMRB 2 S"
|
||||
#property indicator_type10 DRAW_LINE
|
||||
#property indicator_color10 clrPlum
|
||||
#property indicator_style10 STYLE_DOT
|
||||
#property indicator_width10 1
|
||||
|
||||
//
|
||||
#define slow4BufferIndex 10
|
||||
double slow4Buffer[];
|
||||
#define slow3BufferIndex 10
|
||||
double slow3Buffer[];
|
||||
|
||||
//
|
||||
#property indicator_label11 "XMRB 4 S"
|
||||
#property indicator_label11 "XMRB 3 S"
|
||||
#property indicator_type11 DRAW_LINE
|
||||
#property indicator_color11 clrPlum
|
||||
#property indicator_style11 STYLE_DOT
|
||||
#property indicator_width11 1
|
||||
|
||||
//
|
||||
#define slow5BufferIndex 11
|
||||
double slow5Buffer[];
|
||||
#define slow4BufferIndex 11
|
||||
double slow4Buffer[];
|
||||
|
||||
//
|
||||
#property indicator_label12 "XMRB 5 S"
|
||||
#property indicator_label12 "XMRB 4 S"
|
||||
#property indicator_type12 DRAW_LINE
|
||||
#property indicator_color12 clrPlum
|
||||
#property indicator_style12 STYLE_DOT
|
||||
#property indicator_width12 1
|
||||
|
||||
//
|
||||
#define slow5BufferIndex 12
|
||||
double slow5Buffer[];
|
||||
|
||||
//
|
||||
#property indicator_label13 "XMRB 5 S"
|
||||
#property indicator_type13 DRAW_LINE
|
||||
#property indicator_color13 clrPlum
|
||||
#property indicator_style13 STYLE_DOT
|
||||
#property indicator_width13 1
|
||||
|
||||
//
|
||||
#define slow6BufferIndex 13
|
||||
double slow6Buffer[];
|
||||
|
||||
//
|
||||
#property indicator_label14 "XMRB 6 S"
|
||||
#property indicator_type14 DRAW_LINE
|
||||
#property indicator_color14 clrPlum
|
||||
#property indicator_style14 STYLE_DOT
|
||||
#property indicator_width14 1
|
||||
|
||||
//
|
||||
// END Buffers ...
|
||||
//
|
||||
@@ -262,6 +294,7 @@ int fast2MaHandler = INVALID_HANDLE;
|
||||
int fast3MaHandler = INVALID_HANDLE;
|
||||
int fast4MaHandler = INVALID_HANDLE;
|
||||
int fast5MaHandler = INVALID_HANDLE;
|
||||
int fast6MaHandler = INVALID_HANDLE;
|
||||
|
||||
//
|
||||
int slow1MaHandler = INVALID_HANDLE;
|
||||
@@ -269,6 +302,7 @@ int slow2MaHandler = INVALID_HANDLE;
|
||||
int slow3MaHandler = INVALID_HANDLE;
|
||||
int slow4MaHandler = INVALID_HANDLE;
|
||||
int slow5MaHandler = INVALID_HANDLE;
|
||||
int slow6MaHandler = INVALID_HANDLE;
|
||||
|
||||
//
|
||||
// END Global Definitions: Variables, Properties and etc ...
|
||||
@@ -341,6 +375,7 @@ void OnDeinit(const int reason)
|
||||
IndicatorRelease(fast3MaHandler);
|
||||
IndicatorRelease(fast4MaHandler);
|
||||
IndicatorRelease(fast5MaHandler);
|
||||
IndicatorRelease(fast6MaHandler);
|
||||
|
||||
//
|
||||
IndicatorRelease(slow1MaHandler);
|
||||
@@ -348,41 +383,23 @@ void OnDeinit(const int reason)
|
||||
IndicatorRelease(slow3MaHandler);
|
||||
IndicatorRelease(slow4MaHandler);
|
||||
IndicatorRelease(slow5MaHandler);
|
||||
IndicatorRelease(slow6MaHandler);
|
||||
}
|
||||
|
||||
//
|
||||
// Calculating what we want ...
|
||||
int OnCalculate(
|
||||
//
|
||||
// total Candles on chart ...
|
||||
const int rates_total,
|
||||
//
|
||||
// total calculated Candles on charts ...
|
||||
const int prev_calculated,
|
||||
//
|
||||
// history of Candles Open Time ...
|
||||
const datetime &time[],
|
||||
//
|
||||
// history of Candles Open Price ...
|
||||
const double &open[],
|
||||
//
|
||||
// history of Candles High Price ...
|
||||
const double &high[],
|
||||
//
|
||||
// history of Candles Low Price ...
|
||||
const double &low[],
|
||||
//
|
||||
// history of Candles Close Price ...
|
||||
const double &close[],
|
||||
//
|
||||
// history of Tick Volumes on Candle ...
|
||||
const long &tick_volume[],
|
||||
//
|
||||
// history of Trade Volumes ...
|
||||
const long &volume[],
|
||||
//
|
||||
// history of Candles Spread Price ...
|
||||
const int &spread[])
|
||||
const int rates_total, // Total Bars on Chart ...
|
||||
const int prev_calculated, // Total Calculated Bars on Charts ...
|
||||
const datetime &time[], // History of Open Time ...
|
||||
const double &open[], // History of Open Price ...
|
||||
const double &high[], // History of High Price ...
|
||||
const double &low[], // History of Low Price ...
|
||||
const double &close[], // History of Close Price ...
|
||||
const long &tick_volume[], // History of Tick Volumes on Bar ...
|
||||
const long &volume[], // History of Trade Volumes ...
|
||||
const int &spread[] // History of Spread Price ...
|
||||
)
|
||||
{
|
||||
//
|
||||
// Prepare Buffers ...
|
||||
@@ -407,23 +424,28 @@ int OnCalculate(
|
||||
int fast3MaCalculatedBars = BarsCalculated(fast3MaHandler);
|
||||
int fast4MaCalculatedBars = BarsCalculated(fast4MaHandler);
|
||||
int fast5MaCalculatedBars = BarsCalculated(fast5MaHandler);
|
||||
int fast6MaCalculatedBars = BarsCalculated(fast6MaHandler);
|
||||
//
|
||||
int slow1MaCalculatedBars = BarsCalculated(slow1MaHandler);
|
||||
int slow2MaCalculatedBars = BarsCalculated(slow2MaHandler);
|
||||
int slow3MaCalculatedBars = BarsCalculated(slow3MaHandler);
|
||||
int slow4MaCalculatedBars = BarsCalculated(slow4MaHandler);
|
||||
int slow5MaCalculatedBars = BarsCalculated(slow5MaHandler);
|
||||
int slow6MaCalculatedBars = BarsCalculated(slow6MaHandler);
|
||||
if (
|
||||
fast1MaCalculatedBars < maxLength ||
|
||||
fast2MaCalculatedBars < maxLength ||
|
||||
fast3MaCalculatedBars < maxLength ||
|
||||
fast4MaCalculatedBars < maxLength ||
|
||||
fast5MaCalculatedBars < maxLength ||
|
||||
fast6MaCalculatedBars < maxLength ||
|
||||
slow1MaCalculatedBars < maxLength ||
|
||||
slow2MaCalculatedBars < maxLength ||
|
||||
slow3MaCalculatedBars < maxLength ||
|
||||
slow4MaCalculatedBars < maxLength ||
|
||||
slow5MaCalculatedBars < maxLength)
|
||||
slow5MaCalculatedBars < maxLength ||
|
||||
slow6MaCalculatedBars < maxLength //
|
||||
)
|
||||
{
|
||||
return prev_calculated;
|
||||
}
|
||||
@@ -439,23 +461,28 @@ int OnCalculate(
|
||||
int copiedFast3Mas = CopyBuffer(fast3MaHandler, 0, 0, limit, fast3Buffer);
|
||||
int copiedFast4Mas = CopyBuffer(fast4MaHandler, 0, 0, limit, fast4Buffer);
|
||||
int copiedFast5Mas = CopyBuffer(fast5MaHandler, 0, 0, limit, fast5Buffer);
|
||||
int copiedFast6Mas = CopyBuffer(fast6MaHandler, 0, 0, limit, fast6Buffer);
|
||||
//
|
||||
int copiedSlow1Mas = CopyBuffer(slow1MaHandler, 0, 0, limit, slow1Buffer);
|
||||
int copiedSlow2Mas = CopyBuffer(slow2MaHandler, 0, 0, limit, slow2Buffer);
|
||||
int copiedSlow3Mas = CopyBuffer(slow3MaHandler, 0, 0, limit, slow3Buffer);
|
||||
int copiedSlow4Mas = CopyBuffer(slow4MaHandler, 0, 0, limit, slow4Buffer);
|
||||
int copiedSlow5Mas = CopyBuffer(slow5MaHandler, 0, 0, limit, slow5Buffer);
|
||||
int copiedSlow6Mas = CopyBuffer(slow6MaHandler, 0, 0, limit, slow6Buffer);
|
||||
if (
|
||||
copiedFast1Mas <= 0 ||
|
||||
copiedFast2Mas <= 0 ||
|
||||
copiedFast3Mas <= 0 ||
|
||||
copiedFast4Mas <= 0 ||
|
||||
copiedFast5Mas <= 0 ||
|
||||
copiedFast6Mas <= 0 ||
|
||||
copiedSlow1Mas <= 0 ||
|
||||
copiedSlow2Mas <= 0 ||
|
||||
copiedSlow3Mas <= 0 ||
|
||||
copiedSlow4Mas <= 0 ||
|
||||
copiedSlow5Mas <= 0)
|
||||
copiedSlow5Mas <= 0 ||
|
||||
copiedSlow6Mas <= 0 //
|
||||
)
|
||||
{
|
||||
return prev_calculated;
|
||||
}
|
||||
@@ -487,19 +514,17 @@ bool ValidateInputs()
|
||||
bool result =
|
||||
//
|
||||
(fast1Length > 2 &&
|
||||
fast2Length > fast1Length &&
|
||||
fast3Length > fast2Length &&
|
||||
fast4Length > fast3Length &&
|
||||
fast5Length > fast4Length &&
|
||||
fast2Length > 2 &&
|
||||
fast3Length > 2 &&
|
||||
fast4Length > 2 &&
|
||||
fast5Length > 2 &&
|
||||
fast6Length > 2 &&
|
||||
slow1Length > fast1Length &&
|
||||
slow2Length > fast2Length &&
|
||||
slow3Length > fast3Length &&
|
||||
slow4Length > fast4Length &&
|
||||
slow5Length > fast5Length &&
|
||||
slow2Length > slow1Length &&
|
||||
slow3Length > slow2Length &&
|
||||
slow4Length > slow3Length &&
|
||||
slow5Length > slow4Length
|
||||
slow6Length > fast6Length
|
||||
//
|
||||
)
|
||||
//
|
||||
@@ -525,6 +550,7 @@ int ExtractMaxLengthOfInputs()
|
||||
result = MathMax(result, fast3Length);
|
||||
result = MathMax(result, fast4Length);
|
||||
result = MathMax(result, fast5Length);
|
||||
result = MathMax(result, fast6Length);
|
||||
|
||||
//
|
||||
result = MathMax(result, slow1Length);
|
||||
@@ -532,6 +558,7 @@ int ExtractMaxLengthOfInputs()
|
||||
result = MathMax(result, slow3Length);
|
||||
result = MathMax(result, slow4Length);
|
||||
result = MathMax(result, slow5Length);
|
||||
result = MathMax(result, slow6Length);
|
||||
|
||||
//
|
||||
return result;
|
||||
@@ -551,35 +578,42 @@ bool InitializeMas()
|
||||
fast1Length,
|
||||
0,
|
||||
ribbonMode,
|
||||
ribbonAppliedTo);
|
||||
r1AppliedTo);
|
||||
fast2MaHandler = iMA(
|
||||
_Symbol,
|
||||
_Period,
|
||||
fast2Length,
|
||||
0,
|
||||
ribbonMode,
|
||||
ribbonAppliedTo);
|
||||
r2AppliedTo);
|
||||
fast3MaHandler = iMA(
|
||||
_Symbol,
|
||||
_Period,
|
||||
fast3Length,
|
||||
0,
|
||||
ribbonMode,
|
||||
ribbonAppliedTo);
|
||||
r3AppliedTo);
|
||||
fast4MaHandler = iMA(
|
||||
_Symbol,
|
||||
_Period,
|
||||
fast4Length,
|
||||
0,
|
||||
ribbonMode,
|
||||
ribbonAppliedTo);
|
||||
r4AppliedTo);
|
||||
fast5MaHandler = iMA(
|
||||
_Symbol,
|
||||
_Period,
|
||||
fast5Length,
|
||||
0,
|
||||
ribbonMode,
|
||||
ribbonAppliedTo);
|
||||
r5AppliedTo);
|
||||
fast6MaHandler = iMA(
|
||||
_Symbol,
|
||||
_Period,
|
||||
fast6Length,
|
||||
0,
|
||||
ribbonMode,
|
||||
r6AppliedTo);
|
||||
|
||||
//
|
||||
slow1MaHandler = iMA(
|
||||
@@ -588,35 +622,42 @@ bool InitializeMas()
|
||||
slow1Length,
|
||||
0,
|
||||
ribbonMode,
|
||||
ribbonAppliedTo);
|
||||
r1AppliedTo);
|
||||
slow2MaHandler = iMA(
|
||||
_Symbol,
|
||||
_Period,
|
||||
slow2Length,
|
||||
0,
|
||||
ribbonMode,
|
||||
ribbonAppliedTo);
|
||||
r2AppliedTo);
|
||||
slow3MaHandler = iMA(
|
||||
_Symbol,
|
||||
_Period,
|
||||
slow3Length,
|
||||
0,
|
||||
ribbonMode,
|
||||
ribbonAppliedTo);
|
||||
r3AppliedTo);
|
||||
slow4MaHandler = iMA(
|
||||
_Symbol,
|
||||
_Period,
|
||||
slow4Length,
|
||||
0,
|
||||
ribbonMode,
|
||||
ribbonAppliedTo);
|
||||
r4AppliedTo);
|
||||
slow5MaHandler = iMA(
|
||||
_Symbol,
|
||||
_Period,
|
||||
slow5Length,
|
||||
0,
|
||||
ribbonMode,
|
||||
ribbonAppliedTo);
|
||||
r5AppliedTo);
|
||||
slow6MaHandler = iMA(
|
||||
_Symbol,
|
||||
_Period,
|
||||
slow6Length,
|
||||
0,
|
||||
ribbonMode,
|
||||
r6AppliedTo);
|
||||
|
||||
//
|
||||
result =
|
||||
@@ -625,19 +666,13 @@ bool InitializeMas()
|
||||
fast3MaHandler != INVALID_HANDLE &&
|
||||
fast4MaHandler != INVALID_HANDLE &&
|
||||
fast5MaHandler != INVALID_HANDLE &&
|
||||
fast6MaHandler != INVALID_HANDLE &&
|
||||
slow1MaHandler != INVALID_HANDLE &&
|
||||
slow2MaHandler != INVALID_HANDLE &&
|
||||
slow3MaHandler != INVALID_HANDLE &&
|
||||
slow4MaHandler != INVALID_HANDLE &&
|
||||
slow5MaHandler != INVALID_HANDLE;
|
||||
|
||||
//
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
string message = "Error Initializing Handlers ...";
|
||||
Print(message);
|
||||
}
|
||||
slow5MaHandler != INVALID_HANDLE &&
|
||||
slow6MaHandler != INVALID_HANDLE;
|
||||
|
||||
//
|
||||
return result;
|
||||
@@ -706,6 +741,13 @@ void DefineBuffers()
|
||||
PlotIndexSetInteger(fast5BufferIndex, PLOT_DRAW_BEGIN, maxLength);
|
||||
PlotIndexSetInteger(fast5BufferIndex, PLOT_DRAW_TYPE, ribbonDrawType);
|
||||
|
||||
//
|
||||
ArraySetAsSeries(fast6Buffer, true);
|
||||
SetIndexBuffer(fast6BufferIndex, fast6Buffer, INDICATOR_DATA);
|
||||
PlotIndexSetInteger(fast6BufferIndex, PLOT_SHOW_DATA, showRibbon);
|
||||
PlotIndexSetInteger(fast6BufferIndex, PLOT_DRAW_BEGIN, maxLength);
|
||||
PlotIndexSetInteger(fast6BufferIndex, PLOT_DRAW_TYPE, ribbonDrawType);
|
||||
|
||||
//
|
||||
ArraySetAsSeries(slow1Buffer, true);
|
||||
SetIndexBuffer(slow1BufferIndex, slow1Buffer, INDICATOR_DATA);
|
||||
@@ -740,6 +782,13 @@ void DefineBuffers()
|
||||
PlotIndexSetInteger(slow5BufferIndex, PLOT_SHOW_DATA, showRibbon);
|
||||
PlotIndexSetInteger(slow5BufferIndex, PLOT_DRAW_BEGIN, maxLength);
|
||||
PlotIndexSetInteger(slow5BufferIndex, PLOT_DRAW_TYPE, ribbonDrawType);
|
||||
|
||||
//
|
||||
ArraySetAsSeries(slow6Buffer, true);
|
||||
SetIndexBuffer(slow6BufferIndex, slow6Buffer, INDICATOR_DATA);
|
||||
PlotIndexSetInteger(slow6BufferIndex, PLOT_SHOW_DATA, showRibbon);
|
||||
PlotIndexSetInteger(slow6BufferIndex, PLOT_DRAW_BEGIN, maxLength);
|
||||
PlotIndexSetInteger(slow6BufferIndex, PLOT_DRAW_TYPE, ribbonDrawType);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -764,6 +813,16 @@ void CalculateBuffers(
|
||||
double fast3Value = fast3Buffer[bar_index];
|
||||
double fast4Value = fast4Buffer[bar_index];
|
||||
double fast5Value = fast5Buffer[bar_index];
|
||||
double fast6Value = fast6Buffer[bar_index];
|
||||
|
||||
//
|
||||
double fasts[] = {
|
||||
fast1Value,
|
||||
fast2Value,
|
||||
fast3Value,
|
||||
fast4Value,
|
||||
fast5Value,
|
||||
fast6Value};
|
||||
|
||||
//
|
||||
double slow1Value = slow1Buffer[bar_index];
|
||||
@@ -771,13 +830,23 @@ void CalculateBuffers(
|
||||
double slow3Value = slow3Buffer[bar_index];
|
||||
double slow4Value = slow4Buffer[bar_index];
|
||||
double slow5Value = slow5Buffer[bar_index];
|
||||
double slow6Value = slow6Buffer[bar_index];
|
||||
|
||||
//
|
||||
double fastValue = (fast1Value + fast2Value + fast3Value + fast4Value + fast5Value) / 5;
|
||||
double slows[] = {
|
||||
slow1Value,
|
||||
slow2Value,
|
||||
slow3Value,
|
||||
slow4Value,
|
||||
slow5Value,
|
||||
slow6Value};
|
||||
|
||||
//
|
||||
double fastValue = GetAverage(fasts);
|
||||
fastMaBuffer[bar_index] = fastValue;
|
||||
|
||||
//
|
||||
double slowValue = (slow1Value + slow2Value + slow3Value + slow4Value + slow5Value) / 5;
|
||||
double slowValue = GetAverage(slows);
|
||||
slowMaBuffer[bar_index] = slowValue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user