النتائج 1 إلى 3 من 3
الموضوع: استفسار بسيط لكن ضروري
- 30-05-2012, 12:44 AM #1
استفسار بسيط لكن ضروري
السلام عليكم ورحمة الله وبركاتهانا كان عندي استفسار بشأن المؤشر الموجود في المرفقات هل اشارته اكيدة وئابته اي هل يظهر السهم بع اعلاق الشمعو ولا يعيد رسم نفسه وهل هناك مؤشرات افضل منه في اكتشاف الدايفرجنس ارجو المساعدة ولكم جزيل الشكر والإمتنان .وبالتوفق للجميع ان شاء اللهآخر تعديل بواسطة kmalex14 ، 30-05-2012 الساعة 12:50 AM
- 31-05-2012, 07:56 AM #2
رد:استفسار بسيط لكن ضروري
السلام عليكم ورحمة الله وبركاته
المؤشر مغلق الكود
ممكن تعمل باكتست إكسبرت لايف وتضع المؤشر لتراقب إشاراته
أو ممكن إذا أحد الشباب لديه برنامج فك صيغة المؤشرات يساعدك
بالتوفيق بإذن الله
والسلام عليكم ورحمة الله وبركاته
- 31-05-2012, 08:17 AM #3
رد:استفسار بسيط لكن ضروري
المؤشر بضيغة mql4
كود PHP:/*
[]
Website: http://purebeam.biz
E-mail : [email protected]
*/
#property copyright "Copyright © 2007, FX5"
#property link "[email protected]"
#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 LimeGreen
#property indicator_color2 FireBrick
#property indicator_color3 Green
#property indicator_color4 Red
#property indicator_color5 Black
extern string separator1 = "*** OSMA Settings ***";
extern int rsiperiod = 7;
int g_period_88 = 3;
int g_period_92 = 6;
int g_period_96 = 3;
extern string separator2 = "*** Indicator Settings";
extern double positiveSensitivity = 0.0001;
extern double negativeSensitivity = -0.0001;
extern double historyBarsCount = 0.0;
extern bool drawDivergenceLines = FALSE;
double g_ibuf_136[];
double g_ibuf_140[];
double g_ibuf_144[];
double g_ibuf_148[];
double g_ibuf_152[];
double g_ibuf_156[];
double g_ibuf_160[];
int gi_164;
int init() {
IndicatorBuffers(7);
SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 2);
SetIndexBuffer(0, g_ibuf_136);
SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 2);
SetIndexBuffer(1, g_ibuf_140);
SetIndexStyle(2, DRAW_ARROW);
SetIndexBuffer(2, g_ibuf_144);
SetIndexArrow(2, 233);
SetIndexStyle(3, DRAW_ARROW);
SetIndexBuffer(3, g_ibuf_148);
SetIndexArrow(3, 234);
SetIndexStyle(4, DRAW_NONE);
SetIndexBuffer(4, g_ibuf_152);
SetIndexBuffer(5, g_ibuf_156);
SetIndexBuffer(6, g_ibuf_160);
SetIndexDrawBegin(0, g_period_96);
SetIndexDrawBegin(1, g_period_96);
IndicatorDigits(MarketInfo(Symbol(), MODE_DIGITS) + 2.0);
IndicatorShortName("RSI_Divergence(" + rsiperiod + ")");
if (historyBarsCount <= 0.0 || historyBarsCount > Bars) gi_164 = Bars;
else gi_164 = historyBarsCount;
return (0);
}
int deinit() {
string l_name_4;
for (int li_0 = ObjectsTotal() - 1; li_0 >= 0; li_0--) {
l_name_4 = ObjectName(li_0);
if (StringSubstr(l_name_4, 0, 14) == "DivergenceLine") ObjectDelete(l_name_4);
}
return (0);
}
int start() {
int l_ind_counted_0 = IndicatorCounted();
if (l_ind_counted_0 < 0) l_ind_counted_0 = 0;
CalculateOsMA(l_ind_counted_0);
CalculateDivergence(l_ind_counted_0);
return (0);
}
void CalculateDivergence(int ai_0) {
int li_16;
double ld_20;
int li_28;
int li_32;
int li_36;
int li_40;
double ld_44;
double ld_52;
double ld_60;
double ld_68;
int li_76;
int li_80;
int li_84;
int li_88;
double l_high_92;
double l_high_100;
double l_low_108;
double l_low_116;
double ld_4 = 50.0 * (1 / MathPow(10, MarketInfo(Symbol(), MODE_DIGITS) + 2.0));
for (int li_12 = gi_164 - ai_0; li_12 >= 0; li_12--) {
g_ibuf_148[li_12] = EMPTY_VALUE;
g_ibuf_144[li_12] = EMPTY_VALUE;
li_16 = GetFirstPeakOrTrough(li_12);
ld_20 = g_ibuf_152[li_16];
if (ld_20 > 0.0) {
li_28 = GetIndicatorLastPeak(li_12);
li_32 = GetIndicatorLastTrough(li_28);
li_36 = GetIndicatorLastPeak(li_32);
li_40 = GetIndicatorLastTrough(li_36);
} else {
li_32 = GetIndicatorLastTrough(li_12);
li_28 = GetIndicatorLastPeak(li_32);
li_40 = GetIndicatorLastTrough(li_28);
li_36 = GetIndicatorLastPeak(li_40);
}
if (li_28 == -1 || li_36 == -1 || li_32 == -1 || li_40 == -1) continue;
ld_44 = g_ibuf_152[li_28];
ld_52 = g_ibuf_152[li_36];
ld_60 = g_ibuf_152[li_32];
ld_68 = g_ibuf_152[li_40];
li_76 = li_28;
li_80 = li_36;
li_84 = li_32;
li_88 = li_40;
l_high_92 = High[li_76];
l_high_100 = High[li_80];
l_low_108 = Low[li_84];
l_low_116 = Low[li_88];
if ((l_high_92 > l_high_100 && ld_44 < ld_52) || (l_high_92 < l_high_100 && ld_44 > ld_52)) {
g_ibuf_148[li_28] = g_ibuf_136[li_28] + ld_4;
if (drawDivergenceLines) {
PriceDrawLine(Time[li_76], Time[li_80], l_high_92, l_high_100, Red);
IndicatorDrawLine(Time[li_28], Time[li_36], ld_44, ld_52, Red);
}
} else {
if ((l_low_108 < l_low_116 && ld_60 > ld_68) || (l_low_108 > l_low_116 && ld_60 < ld_68)) {
g_ibuf_144[li_32] = g_ibuf_140[li_32] - ld_4;
if (drawDivergenceLines) {
PriceDrawLine(Time[li_84], Time[li_88], l_low_108, l_low_116, Green);
IndicatorDrawLine(Time[li_32], Time[li_40], ld_60, ld_68, Green);
}
}
}
}
}
void CalculateOsMA(int ai_0) {
for (int li_4 = Bars - ai_0; li_4 >= 0; li_4--) g_ibuf_156[li_4] = iMA(NULL, 0, g_period_88, 0, MODE_EMA, PRICE_CLOSE, li_4) - iMA(NULL, 0, g_period_92, 0, MODE_EMA, PRICE_CLOSE, li_4);
for (li_4 = Bars - ai_0; li_4 >= 0; li_4--) {
g_ibuf_160[li_4] = iMAOnArray(g_ibuf_156, Bars, g_period_96, 0, MODE_SMA, li_4);
g_ibuf_152[li_4] = 2.0 * (iRSI(NULL, 0, rsiperiod, PRICE_CLOSE, li_4) - 50.0);
if (g_ibuf_152[li_4] > 0.0) {
g_ibuf_136[li_4] = g_ibuf_152[li_4];
g_ibuf_140[li_4] = 0;
} else {
if (g_ibuf_152[li_4] < 0.0) {
g_ibuf_140[li_4] = g_ibuf_152[li_4];
g_ibuf_136[li_4] = 0;
} else {
g_ibuf_136[li_4] = 0;
g_ibuf_140[li_4] = 0;
}
}
}
}
int GetPositiveRegionStart(int ai_0) {
for (int li_ret_8 = ai_0 + 1; li_ret_8 < Bars; li_ret_8++)
if (g_ibuf_152[li_ret_8] >= g_ibuf_152[li_ret_8 - 1] && g_ibuf_152[li_ret_8] >= g_ibuf_152[li_ret_8 + 1] && g_ibuf_152[li_ret_8] >= g_ibuf_152[li_ret_8 + 2] && g_ibuf_152[li_ret_8] > positiveSensitivity) return (li_ret_8);
return (-1);
}
int GetNegativeRegionStart(int ai_0) {
for (int li_ret_4 = ai_0 + 1; li_ret_4 < Bars; li_ret_4++)
if (g_ibuf_152[li_ret_4] <= g_ibuf_152[li_ret_4 - 1] && g_ibuf_152[li_ret_4] <= g_ibuf_152[li_ret_4 + 1] && g_ibuf_152[li_ret_4] <= g_ibuf_152[li_ret_4 + 2] && g_ibuf_152[li_ret_4] < negativeSensitivity) return (li_ret_4);
return (-1);
}
int GetFirstPeakOrTrough(int ai_0) {
for (int li_ret_4 = ai_0 + 1; li_ret_4 < Bars; li_ret_4++) {
if ((g_ibuf_152[li_ret_4] >= g_ibuf_152[li_ret_4 - 1] && g_ibuf_152[li_ret_4] >= g_ibuf_152[li_ret_4 + 1] && g_ibuf_152[li_ret_4] >= g_ibuf_152[li_ret_4 + 2] && g_ibuf_152[li_ret_4] > positiveSensitivity) ||
(g_ibuf_152[li_ret_4] <= g_ibuf_152[li_ret_4 - 1] && g_ibuf_152[li_ret_4] <= g_ibuf_152[li_ret_4 + 1] && g_ibuf_152[li_ret_4] <= g_ibuf_152[li_ret_4 + 2] && g_ibuf_152[li_ret_4] < negativeSensitivity)) return (li_ret_4);
}
return (-1);
}
int GetIndicatorLastPeak(int ai_0) {
int li_4 = GetPositiveRegionStart(ai_0);
if (li_4 == -1) return (-1);
bool li_ret_8 = FALSE;
double ld_12 = 0;
for (int li_20 = li_4; li_20 < Bars; li_20++) {
if (g_ibuf_152[li_20] > ld_12 && g_ibuf_152[li_20] >= g_ibuf_152[li_20 - 1] && g_ibuf_152[li_20] >= g_ibuf_152[li_20 + 1] && g_ibuf_152[li_20] >= g_ibuf_152[li_20 +
2] && g_ibuf_152[li_20] > positiveSensitivity) {
ld_12 = g_ibuf_152[li_20];
li_ret_8 = li_20;
}
if (g_ibuf_152[li_20] < 0.0) break;
}
return (li_ret_8);
}
int GetIndicatorLastTrough(int ai_0) {
int li_4 = GetNegativeRegionStart(ai_0);
if (li_4 == -1) return (-1);
bool li_ret_8 = FALSE;
double ld_12 = 0;
for (int li_20 = li_4; li_20 < Bars; li_20++) {
if (g_ibuf_152[li_20] < ld_12 && g_ibuf_152[li_20] <= g_ibuf_152[li_20 - 1] && g_ibuf_152[li_20] <= g_ibuf_152[li_20 + 1] && g_ibuf_152[li_20] <= g_ibuf_152[li_20 +
2] && g_ibuf_152[li_20] < negativeSensitivity) {
ld_12 = g_ibuf_152[li_20];
li_ret_8 = li_20;
}
if (g_ibuf_152[li_20] > 0.0) break;
}
return (li_ret_8);
}
void PriceDrawLine(int a_datetime_0, int a_datetime_4, double a_price_8, double a_price_16, color a_color_24) {
string l_name_28 = "DivergenceLine# " + DoubleToStr(a_datetime_0, 0);
ObjectDelete(l_name_28);
ObjectCreate(l_name_28, OBJ_TREND, 0, a_datetime_0, a_price_8, a_datetime_4, a_price_16, 0, 0);
ObjectSet(l_name_28, OBJPROP_RAY, FALSE);
ObjectSet(l_name_28, OBJPROP_COLOR, a_color_24);
}
void IndicatorDrawLine(int a_datetime_0, int a_datetime_4, double a_price_8, double a_price_16, color a_color_24) {
string l_name_32;
int l_window_28 = WindowFind("FX5_Divergence(" + g_period_88 + "," + g_period_92 + "," + g_period_96 + ")");
if (l_window_28 >= 0) {
l_name_32 = "DivergenceLine$# " + DoubleToStr(a_datetime_0, 0);
ObjectDelete(l_name_32);
ObjectCreate(l_name_32, OBJ_TREND, l_window_28, a_datetime_0, a_price_8, a_datetime_4, a_price_16, 0, 0);
ObjectSet(l_name_32, OBJPROP_RAY, FALSE);
ObjectSet(l_name_32, OBJPROP_COLOR, a_color_24);
}
}