قديم 26-04-2019, 02:23 AM
  المشاركه #1

عضو هوامير المميز

تاريخ التسجيل: Sep 2006
المشاركات: 3,104
majed2005 غير متواجد حالياً  

مطلوب لو تكرمت معادلة نموذج الهارمونك abcd للايمي بروكر
كما في العنوان جزاكم الله خير

الموضوع الأصلي : اضغط هنا    ||   المصدر : منتدى هوامير البورصة السعودية


رد مع اقتباس
 
 

قديم 18-05-2019, 07:31 AM
  المشاركه #2

عضو هوامير المميز

تاريخ التسجيل: Jul 2006
المشاركات: 392
sosn غير متواجد حالياً  

تفضل



// Gartley 222 Pattern Indi***or Plot
//
// Ported by Daniel Ervi from code originally posted for Wealth-Lab by Mark Conway.
// Based on the August 2003 article in Active Trader Magazine.
//
// Usage: Gartley222(VPFactor, Tolerance, Lookback)
// VPFactor adjusts swing size percentage (Zig Zag)
// Tolerance adjusts percentage tolerance from ideal pattern specifi***ion
// Lookback adjusts volatility calculation
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
//Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
Plot( C, "Close", ParamColor("Color", colorBlack), ParamStyle("Styel",styleCandle,styleCandle|styleBar|styleThick));
_SECTION_END();
_SECTION_BEGIN("Gartley Color");
BullishCo1 = ParamColor("Bullish-1", colorBlue);
BullishCo2 = ParamColor("Bullish-2", colorDarkBlue);
BearishCo1 = ParamColor("Bearish-1", colorRed);
BearishCo2 = ParamColor("Bearish-2", colorDarkRed);
_SECTION_END();
procedure Gartley222(VPFactor, Tolerance, Lookback)
{
F1 = 0.618;
F2 = 0.786;
F3 = 1.27;
F4 = 1.618;
// Setup volatility adjusted reversal array
VP = 100 * ATR(Lookback) / Close;
Reversal = int(VPFactor * VP);
Bar = BarCount-Param("No of Bars",100,20,1000,10); //No of Bars Selected by user
if (BarCount < 100)
{
Bar = 0;
}
// for(Bar = 50; Bar < BarCount; Bar++)
for(Bar; Bar < BarCount; Bar++)
{
// Build Peak and Trough arrays
P1 = Peak(High, Reversal[Bar]);
P1Bar = Bar - PeakBars(High, Reversal[Bar]);
P2 = Peak(High, Reversal[Bar], 2);
P2Bar = Bar - PeakBars(High, Reversal[Bar], 2);
T1 = Trough(Low, Reversal[Bar]);
T1Bar = Bar - TroughBars(Low, Reversal[Bar]);
T2 = Trough(Low, Reversal[Bar], 2);
T2Bar = Bar - TroughBars(Low, Reversal[Bar], 2);
// Test for a bullish 222
// Trough X is T2
// Peak A is P2
// Trough B is T1
// Peak C is P1
// D is the Buy point
D = Low[Bar];
PTValid = (P1Bar[Bar] > T1Bar[Bar]) AND (T1Bar[Bar] > P2Bar[Bar]) AND (P2Bar[Bar] > T2Bar[Bar]);
HLValid = (P1[Bar] < P2[Bar]) AND (T1[Bar] > T2[Bar]) AND (P1[Bar] > T1[Bar]);
InZone = (D < T1[Bar]) AND (D > T2[Bar]);
if(PTValid AND HLValid AND InZone)
{
XA = P2[Bar] - T2[Bar];
AB = P2[Bar] - T1[Bar];
BC = P1[Bar] - T1[Bar];
CD = P1[Bar] - D;
AD = P2[Bar] - D;
ABdXA = AB / XA; // AB should be 61.8% of XA
C1 = (ABdXA > F1 - Tolerance) AND (ABdXA < F1 + Tolerance);
BCdAB = BC / AB; // BC should be 61.8-78.6% of AB
C2 = (BCdAB > F1 - Tolerance) AND (BCdAB < F2 + Tolerance);
CDdBC = CD / BC; // CD should be 127-161.8% of BC}
C3 = (CDdBC > F3 - Tolerance) AND (CDdBC < F4 + Tolerance);
ADdXA = AD / XA; // AD should be 78.6% of XA}
C4 = (ADdXA > F2 - Tolerance) AND (ADdXA < F2 + Tolerance);
if(C1 AND C2 AND C3 AND C4)
{
// Bullish Gartley found. Draw pattern.
PlotXA = LineArray(T2Bar[Bar], T2[Bar], P2Bar[Bar], P2[Bar]);
Plot(PlotXA, "", BullishCo1, styleLine + styleThick);
PlotAB = LineArray(P2Bar[Bar], P2[Bar], T1Bar[Bar], T1[Bar]);
Plot(PlotAB, "", BullishCo1, styleLine + styleThick);
PlotBC = LineArray(T1Bar[Bar], T1[Bar], P1Bar[Bar], P1[Bar]);
Plot(PlotBC, "", BullishCo1, styleLine + styleThick);
PlotCD = LineArray(P1Bar[Bar], P1[Bar], Bar, D);
Plot(PlotCD, "", BullishCo1, styleLine + styleThick);
PlotBD = LineArray(T1Bar[Bar], T1[Bar], Bar, D);
Plot(PlotBD, "", BullishCo2, styleSwingDots );
PlotXD = LineArray(T2Bar[Bar], T2[Bar], Bar, D);
Plot(PlotXD, "", BullishCo2, styleSwingDots );
PlotXB = LineArray(T2Bar[Bar], T2[Bar], T1Bar[Bar], T1[Bar]);
Plot(PlotXB, "", BullishCo2, styleSwingDots );
}
}
// Test for a bearish 222
// Peak X is P2
// Trough A is T2
// Peak B is P1
// Trough C is T1
// D is the Buy point
D = High[Bar];
PTValid = (T1Bar[Bar] > P1Bar[Bar]) AND (P1Bar[Bar] > T2Bar[Bar]) AND (T2Bar[Bar] > P2Bar[Bar]);
HLValid = (T1[Bar] > T2[Bar]) AND (P1[Bar] < P2[Bar]) AND (T1[Bar] < P1[Bar]);
InZone = (D > P1[Bar]) AND (D < P2[Bar]);
if(PTValid AND HLValid AND InZone)
{
XA = P2[Bar] - T2[Bar];
AB = P1[Bar] - T2[Bar];
BC = P1[Bar] - T1[Bar];
CD = D - T1[Bar];
AD = D - T2[Bar];
ABdXA = AB / XA; // AB should be 61.8% of XA
C1 = (ABdXA > F1 - Tolerance) AND (ABdXA < F1 + Tolerance);
BCdAB = BC / AB; // BC should be 61.8-78.6% of AB
C2 = (BCdAB > F1 - Tolerance) AND (BCdAB < F2 + Tolerance);
CDdBC = CD / BC; // CD should be 127-161.8% of BC}
C3 = (CDdBC > F3 - Tolerance) AND (CDdBC < F4 + Tolerance);
ADdXA = AD / XA; // AD should be 78.6% of XA}
C4 = (ADdXA > F2 - Tolerance) AND (ADdXA < F2 + Tolerance);
if(C1 AND C2 AND C3 AND C4)
{
// Bearish Gartley found. Draw pattern.
PlotXA = LineArray(P2Bar[Bar], P2[Bar], T2Bar[Bar], T2[Bar]);
Plot(PlotXA, "", BearishCo1, styleLine + styleThick);
PlotAB = LineArray(T2Bar[Bar], T2[Bar], P1Bar[Bar], P1[Bar]);
Plot(PlotAB, "", BearishCo1, styleLine + styleThick);
PlotBC = LineArray(P1Bar[Bar], P1[Bar], T1Bar[Bar], T1[Bar]);
Plot(PlotBC, "", BearishCo1, styleLine + styleThick);
PlotCD = LineArray(T1Bar[Bar], T1[Bar], Bar, D);
Plot(PlotCD, "", BearishCo1, styleLine + styleThick);
PlotBD = LineArray(P1Bar[Bar], P1[Bar], Bar, D);
Plot(PlotBD, "", BearishCo2, styleSwingDots );
PlotXD = LineArray(P2Bar[Bar], P2[Bar], Bar, D);
Plot(PlotXD, "", BearishCo2, styleSwingDots );
PlotXB = LineArray(P2Bar[Bar], P2[Bar], P1Bar[Bar], P1[Bar]);
Plot(PlotXB, "", BearishCo2, styleSwingDots );
}
}
}
}
Gartley222(1.0, 0.3, 2);



رد مع اقتباس
قديم 19-05-2019, 11:29 AM
  المشاركه #3

عضو هوامير المميز

تاريخ التسجيل: Sep 2006
المشاركات: 3,104
majed2005 غير متواجد حالياً  

اقتباس:
المشاركة الأصلية كتبت بواسطة sosn مشاهدة المشاركة
تفضل



// gartley 222 pattern indi***or plot
//
// ported by daniel ervi from code originally posted for wealth-lab by mark conway.
// based on the august 2003 article in active trader magazine.
//
// usage: Gartley222(vpfactor, tolerance, lookback)
// vpfactor adjusts swing size percentage (zig zag)
// tolerance adjusts percentage tolerance from ideal pattern specifi***ion
// lookback adjusts volatility calculation
_section_begin("price");
setchartoptions(0,chartshowarrows|chartshowdates);
_n(title = strformat("{{name}} - {{interval}} {{date}} open %g, hi %g, lo %g, close %g (%.1f%%) {{values}}", o, h, l, c, selectedvalue( roc( c, 1 ) ) ));
//plot( c, "close", paramcolor("color", colorblack ), stylenotitle | paramstyle("style") | getpricestyle() );
plot( c, "close", paramcolor("color", colorblack), paramstyle("styel",stylecandle,stylecandle|stylebar|stylethick));
_section_end();
_section_begin("gartley color");
bullishco1 = paramcolor("bullish-1", colorblue);
bullishco2 = paramcolor("bullish-2", colordarkblue);
bearishco1 = paramcolor("bearish-1", colorred);
bearishco2 = paramcolor("bearish-2", colordarkred);
_section_end();
procedure gartley222(vpfactor, tolerance, lookback)
{
f1 = 0.618;
f2 = 0.786;
f3 = 1.27;
f4 = 1.618;
// setup volatility adjusted reversal array
vp = 100 * atr(lookback) / close;
reversal = int(vpfactor * vp);
bar = barcount-param("no of bars",100,20,1000,10); //no of bars selected by user
if (barcount < 100)
{
bar = 0;
}
// for(bar = 50; bar < barcount; bar++)
for(bar; bar < barcount; bar++)
{
// build peak and trough arrays
p1 = peak(high, reversal[bar]);
p1bar = bar - peakbars(high, reversal[bar]);
p2 = peak(high, reversal[bar], 2);
p2bar = bar - peakbars(high, reversal[bar], 2);
t1 = trough(low, reversal[bar]);
t1bar = bar - troughbars(low, reversal[bar]);
t2 = trough(low, reversal[bar], 2);
t2bar = bar - troughbars(low, reversal[bar], 2);
// test for a bullish 222
// trough x is t2
// peak a is p2
// trough b is t1
// peak c is p1
// d is the buy point
d = low[bar];
ptvalid = (p1bar[bar] > t1bar[bar]) and (t1bar[bar] > p2bar[bar]) and (p2bar[bar] > t2bar[bar]);
hlvalid = (p1[bar] < p2[bar]) and (t1[bar] > t2[bar]) and (p1[bar] > t1[bar]);
inzone = (d < t1[bar]) and (d > t2[bar]);
if(ptvalid and hlvalid and inzone)
{
xa = p2[bar] - t2[bar];
ab = p2[bar] - t1[bar];
bc = p1[bar] - t1[bar];
cd = p1[bar] - d;
ad = p2[bar] - d;
abdxa = ab / xa; // ab should be 61.8% of xa
c1 = (abdxa > f1 - tolerance) and (abdxa < f1 + tolerance);
bcdab = bc / ab; // bc should be 61.8-78.6% of ab
c2 = (bcdab > f1 - tolerance) and (bcdab < f2 + tolerance);
cddbc = cd / bc; // cd should be 127-161.8% of bc}
c3 = (cddbc > f3 - tolerance) and (cddbc < f4 + tolerance);
addxa = ad / xa; // ad should be 78.6% of xa}
c4 = (addxa > f2 - tolerance) and (addxa < f2 + tolerance);
if(c1 and c2 and c3 and c4)
{
// bullish gartley found. Draw pattern.
Plotxa = linearray(t2bar[bar], t2[bar], p2bar[bar], p2[bar]);
plot(plotxa, "", bullishco1, styleline + stylethick);
plotab = linearray(p2bar[bar], p2[bar], t1bar[bar], t1[bar]);
plot(plotab, "", bullishco1, styleline + stylethick);
plotbc = linearray(t1bar[bar], t1[bar], p1bar[bar], p1[bar]);
plot(plotbc, "", bullishco1, styleline + stylethick);
plotcd = linearray(p1bar[bar], p1[bar], bar, d);
plot(plotcd, "", bullishco1, styleline + stylethick);
plotbd = linearray(t1bar[bar], t1[bar], bar, d);
plot(plotbd, "", bullishco2, styleswingdots );
plotxd = linearray(t2bar[bar], t2[bar], bar, d);
plot(plotxd, "", bullishco2, styleswingdots );
plotxb = linearray(t2bar[bar], t2[bar], t1bar[bar], t1[bar]);
plot(plotxb, "", bullishco2, styleswingdots );
}
}
// test for a bearish 222
// peak x is p2
// trough a is t2
// peak b is p1
// trough c is t1
// d is the buy point
d = high[bar];
ptvalid = (t1bar[bar] > p1bar[bar]) and (p1bar[bar] > t2bar[bar]) and (t2bar[bar] > p2bar[bar]);
hlvalid = (t1[bar] > t2[bar]) and (p1[bar] < p2[bar]) and (t1[bar] < p1[bar]);
inzone = (d > p1[bar]) and (d < p2[bar]);
if(ptvalid and hlvalid and inzone)
{
xa = p2[bar] - t2[bar];
ab = p1[bar] - t2[bar];
bc = p1[bar] - t1[bar];
cd = d - t1[bar];
ad = d - t2[bar];
abdxa = ab / xa; // ab should be 61.8% of xa
c1 = (abdxa > f1 - tolerance) and (abdxa < f1 + tolerance);
bcdab = bc / ab; // bc should be 61.8-78.6% of ab
c2 = (bcdab > f1 - tolerance) and (bcdab < f2 + tolerance);
cddbc = cd / bc; // cd should be 127-161.8% of bc}
c3 = (cddbc > f3 - tolerance) and (cddbc < f4 + tolerance);
addxa = ad / xa; // ad should be 78.6% of xa}
c4 = (addxa > f2 - tolerance) and (addxa < f2 + tolerance);
if(c1 and c2 and c3 and c4)
{
// bearish gartley found. Draw pattern.
Plotxa = linearray(p2bar[bar], p2[bar], t2bar[bar], t2[bar]);
plot(plotxa, "", bearishco1, styleline + stylethick);
plotab = linearray(t2bar[bar], t2[bar], p1bar[bar], p1[bar]);
plot(plotab, "", bearishco1, styleline + stylethick);
plotbc = linearray(p1bar[bar], p1[bar], t1bar[bar], t1[bar]);
plot(plotbc, "", bearishco1, styleline + stylethick);
plotcd = linearray(t1bar[bar], t1[bar], bar, d);
plot(plotcd, "", bearishco1, styleline + stylethick);
plotbd = linearray(p1bar[bar], p1[bar], bar, d);
plot(plotbd, "", bearishco2, styleswingdots );
plotxd = linearray(p2bar[bar], p2[bar], bar, d);
plot(plotxd, "", bearishco2, styleswingdots );
plotxb = linearray(p2bar[bar], p2[bar], p1bar[bar], p1[bar]);
plot(plotxb, "", bearishco2, styleswingdots );
}
}
}
}
gartley222(1.0, 0.3, 2);
جزاك الله خير



رد مع اقتباس
إضافة رد


الكلمات الدلالية (Tags)
للايمي, مطلوب, معادلة, نموذج, الهارمونك, بروكر, تكرمت

أدوات الموضوع

تعليمات المشاركة
لا تستطيع إضافة مواضيع جديدة
لا تستطيع الرد على المواضيع
لا تستطيع إرفاق ملفات
لا تستطيع تعديل مشاركاتك

BB code is متاحة
كود [IMG] متاحة
كود HTML معطلة

الانتقال السريع



12:09 PM