لتبليغ الإدارة عن موضوع أو رد مخالف يرجى الضغط على هذه الأيقونة الموجودة على يمين المشاركة لتطبيق قوانين المنتدى


سجل من هنا
العودة   هوامير البورصة السعودية > >
التسجيل اضف الموقع لمفضلتك بحث جوجل فوركس هوامير التقويم البحث مشاركات اليوم اجعل كافة الأقسام مقروءة
 

هذي معادلات للهيرمونك للايمي بروكر

منتدى التحليل الفني والاساسي



إضافة رد
 
أدوات الموضوع انواع عرض الموضوع
قديم 22-05-2010, 01:46 AM  
#1
bnm
عضو هوامير المميز
 
تاريخ التسجيل: Jan 2007
المشاركات: 24

هذي معادلات للهيرمونك للايمي بروكر

_SECTION_BEGIN("Gartley Tool");
Gartley=ParamToggle("Gartley","OFF|ON",1);
Trg=ParamToggle("Show Targets","Yes|No",1);

Type=ParamToggle("Label","ABCD|PRICE",1);
Snap=ParamToggle("Snap","Yes|No",1);

if(Gartley==1)
{
SetBarsRequired( -2, -2 );
bi = BarIndex();
bis = SelectedValue( bi );

symbol = Name();
tframe = Interval();
chartID = GetChartID();
Xname = "X" + chartID + symbol + tframe;
Yname = "Y" + chartID + symbol + tframe;

LeftButton = GetCursorMouseButtons() & 1;
a = Nz(StaticVarGet("counter"));
if ( leftButton )
{
StaticVarSet("counter", a+1);

x = GetCursorXPosition( );
y = GetCursorYPosition( );
StaticVarSet( Xname + bis, x );
StaticVarSet( Yname + bis, y );

}


j = 0;
dt = DateTime();
shapePlot = 0;
shapePos = Null;
xx = yy = Null;
FirstVisibleBar = Status( "FirstVisibleBar" );
Lastvisiblebar = Status( "LastVisibleBar" );
for ( i = FirstVisibleBar; i <Lastvisiblebar AND i<BarCount; i++ )
{
x = StaticVarGet( Xname + i );
y = StaticVarGet( Yname + i );

if ( x == dt[i] AND snap==0)
{
shapePlot[i] = 1;
shapePos[i] = IIf(abs(H[i]-y) < abs(L[i]-y), H[i], L[i]);
xx[j] = i;
yy[j] = IIf(abs(H[i]-y) < abs(L[i]-y), H[i], L[i]);
j++;
}
else if ( x == dt[i] AND snap==1)
{
shapePlot[i] = 1;
shapePos[i] = y;
xx[j] = i;
yy[j] = y;
j++;
}

}



shape = shapeSmallCircle;
PlotShapes( shapePlot*shape, colorRed, 0, shapePos, 0 );
Values=ParamToggle("Segment Values","No|Yes",1);
vr=ParamToggle("R1","No|Yes",1);
vr2=ParamToggle("R2","No|Yes",0);
vr3=ParamToggle("R3","No|Yes",1);

for ( i = 1; i <= j ; i++ )

{
if(i==1 AND Type==0)
{
PlotText("X ",xx[i-1]-2,yy[i-1],colorWhite);
}
if(i==2 AND Type==0)
{
PlotText("A ",xx[i-1]-2,yy[i-1],colorWhite);
}
if(i==3 AND Type==0)
{
PlotText("B ",xx[i-1]-2,yy[i-1],colorWhite);
}
if(i==4 AND Type==0)
{
PlotText("C ",xx[i-1]+2,yy[i-1],colorWhite);
}
if(i==5 AND Type==0)
{
PlotText("D ",xx[i-1]+2,yy[i-1],colorWhite);
}
if(i==6 AND Type==0)
{
PlotText("E ",xx[i-1]+2,yy[i-1],colorWhite);
}
if(i==7 AND Type==0)
{
PlotText("F ",xx[i-1]+2,yy[i-1],colorWhite);
}
if(i==8 AND Type==0)
{
PlotText("G ",xx[i-1]+2,yy[i-1],colorWhite);
}
if(Type==1)
{
PlotText(""+yy[i-1],xx[i-1]+2,yy[i-1],colorWhite);
}



Plot( LineArray( xx[i-1], yy[i-1], xx[i], yy[i] ), "", colorBlue, styleThick );
XA=yy[i]-yy[i-1];
AB=yy[i]-yy[i+1];
AD=yy[i]-yy[i+3];
BC=yy[i+1]-yy[i+2];
CD=yy[i+2]-yy[i+3];
r=CD/XA;
r2=AB/XA;
r3=XA/BC;

if(Trg==0)
{
target1=yy[i+3]+AD*0.618;
Line1=LineArray(xx[i+2],target1,BarCount-1,target1);
Plot(Line1,"",colorYellow,styleDashed|styleNoRescale);

target2=yy[i+3]+AD*1.272;
Line2=LineArray(xx[i+2],target2,BarCount-1,target2);
Plot(Line2,"",colorYellow,styleDashed|styleNoRescale);

target3=yy[i+3]+AD*2.618;
Line3=LineArray(xx[i+2],target3,BarCount-1,target3);
Plot(Line3,"",colorYellow,styleDashed|styleNoRescale);
}



if(vr==1)
{
PlotText(""+Prec(abs(r2), 2 )+" ("+(abs(xx[i-1]-XX[i+1]))+")",XX[i-1]+int((xx[i+1]-XX[i-1])/2),yy[i-1]+((yy[i+1]-yy[i-1])/2),colorBlack,colorYellow);
Plot( LineArray( xx[i-1], yy[i-1], xx[i+1], yy[i+1] ), "", colorBlue, styleDashed );
}
if(vr2==1)
{
PlotText(""+Prec(abs(r3), 2 )+" ("+(abs(xx[i-1]-XX[i+2]))+")",XX[i-1]+int((xx[i+2]-XX[i-1])/2),yy[i-1]+((yy[i+2]-yy[i-1])/2),colorBlack,colorYellow);
Plot( LineArray( xx[i-1], yy[i-1], xx[i+2], yy[i+2] ), "", colorBlue, styleDashed );
}
if(vr3==1)
{
PlotText(""+Prec(abs(r), 2 )+" ("+(abs(xx[i-1]-XX[i+3]))+")",XX[i-1]+int((xx[i+3]-XX[i-1])/2),yy[i-1]+((yy[i+3]-yy[i-1])/2),colorBlack,colorYellow);
Plot( LineArray( xx[i-1], yy[i-1], xx[i+3], yy[i+3] ), "", colorBlue, styleDashed );
}
if(Values==1)
{
PlotText(""+Prec(abs(XA), 2 ),XX[i-1]+int((xx[i]-xx[i-1])/2),yy[i-1]+XA/2,colorBlack,colorWhite);
}

}

if ( GetCursorMouseButtons() == 12 )
{

for ( i = 0; i < BarCount; i++ )

{
StaticVarRemove("counter");
StaticVarRemove( Xname + i );
StaticVarRemove( Yname + i );
RequestTimedRefresh(1,True );

}
}

}
_SECTION_END();

_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() );
_SECTION_END();
bnm غير متواجد حالياً   رد مع اقتباس
قديم 22-05-2010, 05:07 AM   #2
أحمـــد الكبيسي
محلل فني
 
تاريخ التسجيل: Dec 2009
المشاركات: 6,041

رد: هذي معادلات للهيرمونك للايمي بروكر

اسعفنا بمعادلة للميتاستوك
أحمـــد الكبيسي غير متواجد حالياً   رد مع اقتباس
قديم 22-05-2010, 06:17 PM   #3
طفشان نت
كاتب مميز
 
تاريخ التسجيل: Aug 2005
المشاركات: 5,295

رد: هذي معادلات للهيرمونك للايمي بروكر

يا ريت تتاكد من المعادله بيعطيك خطا عن اسطر target 1 2 3
طفشان نت غير متواجد حالياً   رد مع اقتباس
قديم 22-05-2010, 08:28 PM   #4
bnm
عضو هوامير المميز
 
تاريخ التسجيل: Jan 2007
المشاركات: 24

رد: هذي معادلات للهيرمونك للايمي بروكر

اقتباس:
المشاركة الأصلية كتبت بواسطة طفشان نت مشاهدة المشاركة
يا ريت تتاكد من المعادله بيعطيك خطا عن اسطر target 1 2 3
يارت بس تنسخ المعادله مضبوط
وبعدين تسحب مؤشر الشموع وتفلته فوق المعادله
وبعدين اذا لقيت هيرمونك تحدده بل ماوس وبتشوف المعادله تشتغل
bnm غير متواجد حالياً   رد مع اقتباس
قديم 22-05-2010, 08:30 PM   #5
bnm
عضو هوامير المميز
 
تاريخ التسجيل: Jan 2007
المشاركات: 24

رد: هذي معادلات للهيرمونك للايمي بروكر

/* HARMONIC PATTERN DETECTION


Automatic Detection of Harmonic Patterns - Gartley, Bat, Butterfly and Crab.

Zig Zag is not used in this AFL. It is based on fractals

Contact - joy.edakad@gmail.com

*/



_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", colorWhite ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("Gartley");

GBmin = Param("Swing B Min.",0.55,0.3,1,0.01);
GBmax = Param("Swing B Max.",0.72,0.4,1,0.01);
GCmin = Param("Swing C Min.",0.38,0.3,1.27,0.01);
GCmax = Param("Swing C Max.",1.0,0.4,1.27,0.01);
GDmin = Param("Swing D Min.(XA)",0.55,0.3,1,0.01);
GDmax = Param("Swing D Max.(XA)",1.0,0.4,1.0,0.01);

_SECTION_END();

_SECTION_BEGIN("Bat");

BatBmin = Param("Swing B Min.",0.38,0.3,1,0.01);
BatBmax = Param("Swing B Max.",0.55,0.4,1,0.01);
BatCmin = Param("Swing C Min.",0.38,0.3,1.62,0.01);
BatCmax = Param("Swing C Max.",1.27,0.4,1.62,0.01);
BatDmin = Param("Swing D Min.(XA)",0.5,0.3,1,0.01);
BatDmax = Param("Swing D Max.(XA)",1.0,0.4,1.0,0.01);

_SECTION_END();

_SECTION_BEGIN("Butterfly");

BtBmin = Param("Swing B Min.",0.55,0.3,1,0.01);
BtBmax = Param("Swing B Max.",0.9,0.4,1,0.01);
BtCmin = Param("Swing C Min.",0.38,0.3,1.62,0.01);
BtCmax = Param("Swing C Max.",1.27,0.4,1.62,0.01);
BtDmin = Param("Swing D Min.(XA)",1,1,1.8,0.01);
//BtDmax = Param("Swing D Max.(XA)",1.38,1,1.8,0.01);
BtDmax = Param("Swing D Max.(XA)",1.8,1,1.8,0.01); // Max D of Butterfly = (1.0 - 1.618)

_SECTION_END();

_SECTION_BEGIN("Crab");

CBmin = Param("Swing B Min.",0.38,0.3,1,0.01);
CBmax = Param("Swing B Max.",0.65,0.4,1,0.01);
CCmin = Param("Swing C Min.",0.38,0.3,1.62,0.01);
CCmax = Param("Swing C Max.",1.270,0.4,1.62,0.01);
CDmin = Param("Swing D Min.(XA)",1.25,1,1.8,0.01);
CDmax = Param("Swing D Max.(XA)",1.8,1,2,0.01);

_SECTION_END();

_SECTION_BEGIN("Patterns");

//strength = Param("Strength",5,2,15,1);
strength = Param("BARS of each LINE",5,2,15,1); // So luong bar cho moi duong XA, AB, BC,
bu = ParamToggle("Bullish Pattern","Off|On",1); // So bar/lines se quyet dinh. mo^ hinh` duoc ve the' nao`
be = ParamToggle("Bearish Pattern","Off|On",1);

bi = Cum(1)-1;

function GetTop(bars)
{
Top = H == HHV(H,2*bars) AND Ref(HHV(H,bars),bars) < H;
Top = Top AND LastValue(bi)-ValueWhen(Top,bi) > bars;
return Top;
}

function GetValley(bars)
{
Valley = L == LLV(L,2*bars) AND Ref(LLV(L,bars),bars) > L;
Valley = Valley AND LastValue(bi)-ValueWhen(Valley,bi) > bars;
return Valley;
}


// Build fractals array

P1 = GetTop(strength); // so' bar cho 1 duong` XA, AB, BC, CD
V1 = GetValley(Strength);

P1 = IIf(P1,IIf(ValueWhen(P1,bi,2) < ValueWhen(V1,bi),P1,IIf(ValueWhen(P1,H,2) > H,False,P1)),P1);
P1 = IIf(P1 AND ValueWhen(P1,bi,0) > bi,IIf(ValueWhen(P1,bi,0) < ValueWhen(V1,bi,0),IIf(ValueWhen(P1,H,0) >= H,False,P1),P1),P1);
V1 = IIf(V1,IIf(ValueWhen(V1,bi,2) < ValueWhen(P1,bi),V1,IIf(ValueWhen(V1,L,2)<L,False,V1)),V1);
V1 = IIf(V1 AND ValueWhen(V1,bi,0) > bi ,IIf(ValueWhen(V1,bi,0) < ValueWhen(P1,bi,0),IIf(ValueWhen(V1,L,0) <= L, False,V1),V1),V1);


P1H1 = ValueWhen(P1,H);
P1Bar1 = ValueWhen(P1,bi);
P1H2 = ValueWhen(P1,H,2);
P1Bar2 = ValueWhen(P1,bi,2);
V1L1 = ValueWhen(V1,L);
V1Bar1 = ValueWhen(V1,bi);
V1L2 = ValueWhen(V1,L,2);
V1Bar2 = ValueWhen(V1,bi,2);


//============================================
// Bullish Patterns
//============================================

PTvalid = (P1Bar1 > V1Bar1 AND V1Bar1 > P1Bar2 AND P1bar2 > V1Bar2) AND P1; // Peaks and troughs are in order

// 4 swings of developing Gartley/Bat etc.

BullGartley4 = PTvalid AND (P1H2-V1L1)/(P1H2-V1L2) > GBmin AND (P1H2-V1L1)/(P1H2-V1L2) < GBmax
AND (P1H1-V1L1)/(P1H2-V1L1) > GCMin AND (P1H1-V1L1)/(P1H2-V1L1) < GCMax;

BullBat4 = PTvalid AND (P1H2-V1L1)/(P1H2-V1L2) > BatBmin AND (P1H2-V1L1)/(P1H2-V1L2) < BatBmax
AND (P1H1-V1L1)/(P1H2-V1L1) > BatCMin AND (P1H1-V1L1)/(P1H2-V1L1) < BatCMax;

BullButterfly4 = PTvalid AND (P1H2-V1L1)/(P1H2-V1L2) > BtBmin AND (P1H2-V1L1)/(P1H2-V1L2) < BtBMax
AND (P1H1-V1L1)/(P1H2-V1L1) > BtCmin AND (P1H1-V1L1)/(P1H2-V1L1) < BtCmax;

BullCrab4 = PTvalid AND (P1H2-V1L1)/(P1H2-V1L2) >CBmin AND (P1H2-V1L1)/(P1H2-V1L2) < CBmax
AND (P1H1-V1L1)/(P1H2-V1L1) > CCmin AND (P1H1-V1L1)/(P1H2-V1L1) < CCmax;


// Bullish Gartley/Bat found. D retacement level is not evaluated

strPattern = "";
BullGartley = IIf(LowestSince(BullGartley4,L) < ValueWhen(BullGartley4,P1H2)-(ValueWhen(BullGartley4,P1H2)-ValueWhen(BullGartley4,V1L2))*GDmin AND
LowestSince(bullGartley4,L) > ValueWhen(BullGartley4,P1H2)-(ValueWhen(BullGartley4,P1H2)-ValueWhen(BullGartley4,V1L2))*GDmax AND
HighestSince(BullGartley4,H) <= ValueWhen(BullGartley4,P1H1 ) AND
LowestSince(bullGartley4,L)==L, True,False);
BullGartley = BullGartley AND LowestSince(BullGartley4,L) < ValueWhen(BullGartley4,V1L1);

strPattern = WriteIf(BullGartley,"BULLISH GARTLEY",strPattern);


BullBat = IIf(LowestSince(BullBat4,L) < ValueWhen(BullBat4,P1H2)-(ValueWhen(BullBat4,P1H2)-ValueWhen(BullBat4,V1L2))*BatDmin AND
LowestSince(BullBat4,L) > ValueWhen(BullBat4,P1H2)-(ValueWhen(BullBat4,P1H2)-ValueWhen(BullBat4,V1L2))*BatDmax AND
HighestSince(BullBat4,H) <= ValueWhen(BullBat4,P1H1 ) AND
LowestSince(BullBat4,L)==L, True,False);
BullBat = BullBat AND LowestSince(BullCrab4,L) < ValueWhen(BullCrab4,V1L1);
strPattern = WriteIf(BullBat,"BULLISH BAT",strPattern );


BullCrab = IIf(LowestSince(BullCrab4,L) < ValueWhen(BullCrab4,P1H2)-(ValueWhen(BullCrab4,P1H2)-ValueWhen(BullCrab4,V1L2))*CDmin AND
LowestSince(BullCrab4,L) > ValueWhen(BullCrab4,P1H2)-(ValueWhen(BullCrab4,P1H2)-ValueWhen(BullCrab4,V1L2))*CDmax AND
HighestSince(BullCrab4,H) <= ValueWhen(BullCrab4,P1H1 ) AND
LowestSince(bullGartley4,L)==L, True,False);
BullCrab = BullCrab AND LowestSince(BullCrab4,L) < ValueWhen(BullCrab4,V1L2);
strPattern = WriteIf(BullCrab ,"BULLISH CRAB",strPattern );

BullButterfly = IIf(LowestSince(BullButterfly4,L) < ValueWhen(BullButterfly4,P1H2)-(ValueWhen(BullButterfly4,P1H2)-ValueWhen(BullButterfly4,V1L2))*BtDMin AND
LowestSince(BullButterfly4,L) > ValueWhen(BullButterfly4,P1H2)-(ValueWhen(BullButterfly4,P1H2)-ValueWhen(BullButterfly4,V1L2))*BtDmax AND
HighestSince(BullButterfly4,H) <= ValueWhen(BullButterfly4,P1H1 ) AND
LowestSince(bullButterfly4,L)==L, True,False);
BullButterfly = BullButterfly AND LowestSince(BullButterfly4,L) < ValueWhen(BullButterfly4,V1L2);
strPattern = WriteIf(BullButterfly ,"BULLISH BUTTERFLY",strPattern );

// to remove redumbdent lines

BullHar4 = BullGartley4 OR BullButterfly4 OR BullBat4 OR BullCrab4 ;
BullHar = BullGartley OR BullButterfly OR BullBat OR BullCrab ;

Point4 = IIf(BullHar,ValueWhen(BullHar4,bi),Null);
BullHar = IIf(BullHar, IIf(Point4 == ValueWhen(BullHar,point4,0) AND ValueWhen(BullHar,bi,0) > bi ,False,BullHar),BullHar);

X = ValueWhen(BullHar4,V1L2);
Xbar = ValueWhen(BullHar4,V1Bar2);
A = ValueWhen(BullHar4,P1H2);
Abar = ValueWhen(BullHar4,P1bar2);
B = ValueWhen(BullHar4,V1L1);
Bbar = ValueWhen(BullHar4,V1bar1);
C1 = ValueWhen(BullHar4,P1H1);
C1bar = ValueWhen(BullHar4,P1bar1);
D = ValueWhen(BullHar,L);
Dbar = ValueWhen(BullHar,bi);
ABdXA = (A-B)/(A-X);
BCdAB = (C1-B)/(A-B);
ADdXA = (A-D)/(A-X);
BCdCD = (C1-D)/(C1-B);

PlotPattern = Dbar > C1bar;
if(LastValue(PlotPattern) AND bu)
{
// Ve cac duong XA, AB, BC, CD
Plot( LineArray(LastValue(Xbar),LastValue(X),LastValue(Abar),LastValue(A)),"",colorB lue,styleThick);
Plot(LineArray(LastValue(Abar),LastValue(A),LastValue(Bbar),LastValue(B)),"",c olorBlue,styleThick);
Plot(LineArray(LastValue(Bbar),LastValue(B),LastValue(C1bar),LastValue(C1)),"" ,colorBlue,styleThick);
Plot(LineArray(LastValue(C1bar),LastValue(C1),LastValue(Dbar),LastValue(D)),"" ,colorBlue,styleThick);
Plot(LineArray(LastValue(Xbar),LastValue(X),LastValue(Bbar),LastValue(B)),"",c olorBlue,styleDashed);
Plot(LineArray(LastValue(Xbar),LastValue(X),LastValue(Abar),LastValue(A)),"",c olorBlue,styleThick);
Plot(LineArray(LastValue(Abar),LastValue(A),LastValue(C1bar),LastValue(C1)),"" ,colorBlue,styleDashed);
Plot(LineArray(LastValue(Bbar),LastValue(B),LastValue(Dbar),LastValue(D)),"",c olorBlue,styleDashed);
Plot(LineArray(LastValue(Xbar),LastValue(X),LastValue(Dbar),LastValue(D)),"",c olorBlue,styleDashed);

// Ve cac gia tri Fibo
PlotText(NumToStr(LastValue(ABdXA),1.2),(LastValue(Bbar)+LastValue(Xbar))/2,(LastValue(B)+LastValue(X))/2,colorBlue);
PlotText(NumToStr(LastValue(BCdAB),1.2),(LastValue(C1bar)+LastValue(Abar))/2,(LastValue(C1)+LastValue(A))/2,colorBlue);
PlotText(NumToStr(LastValue(ADdXA),1.2) ,(LastValue(Dbar)+LastValue(Xbar))/2,(LastValue(D)+LastValue(X))/2,colorBlue);
PlotText(NumToStr(LastValue(BCdCD),1.2),(LastValue(Bbar)+LastValue(Dbar))/2,(LastValue(B)+LastValue(D))/2,colorBlue);

//---------- Viet cac diem X, A, B, C, D: by binhnd---------------------
xlech = 0;
ylech = 2;
Colortext = colorWhite;

PlotText("X",LastValue(Xbar) + xlech, LastValue(X) - ylech, Colortext );
PlotText("A",LastValue(Abar) + xlech, LastValue(A) + ylech, Colortext );
PlotText("B",LastValue(Bbar) + xlech, LastValue(B) - ylech, Colortext );
PlotText("C",LastValue(C1bar) + xlech, LastValue(C1) + ylech, Colortext );
PlotText("D",LastValue(Dbar) + xlech, LastValue(D) - ylech, Colortext );

//--------- Viet thuyet minh mo hinh: by binhnd--------------
if (strPattern!="")
{
strPattern = "Pattern: " + strPattern;
toadoX = (LastValue(Dbar)+LastValue(Xbar))/2;
toadoY = (LastValue(D)+LastValue(X))/2;

PlotText(strPattern,toadoX,toadoY-1,Colortext);
}
}

//======================================================
//========== Bearish Patterns
//======================================================


PTvalid = (V1Bar1 > P1Bar1 AND P1Bar1 > V1Bar2 AND V1Bar2 > P1Bar2) AND V1;

// Swing 4

BearGartley4 = PTvalid AND (P1H1-V1L2)/(P1H2-V1L2) > GBmin AND (P1H1-V1L2)/(P1H2-V1L2) < GBmax AND
(P1H1-V1L1)/(P1H1-V1L2) > GCmin AND (P1H1-V1L1)/(P1H1-V1L2) < GCmax;

BearBat4 = PTvalid AND (P1H1-V1L2)/(P1H2-V1L2) > BatBmin AND (P1H1-V1L2)/(P1H2-V1L2) < BatBmax AND
(P1H1-V1L1)/(P1H1-V1L2) > BatCmin AND (P1H1-V1L1)/(P1H1-V1L2) < BatCmax;

BearButterfly4 = PTvalid AND (P1H1-V1L2)/(P1H2-V1L2) > BtBmin AND (P1H1-V1L2)/(P1H2-V1L2) < BtBmax AND
(P1H1-V1L1)/(P1H1-V1L2) > BtCmin AND (P1H1-V1L1)/(P1H1-V1L2) < BtCmax;

BearCrab4 = PTvalid AND (P1H1-V1L2)/(P1H2-V1L2) > CBmin AND (P1H1-V1L2)/(P1H2-V1L2) < CBmax AND
(P1H1-V1L1)/(P1H1-V1L2) > CCmin AND (P1H1-V1L1)/(P1H1-V1L2) < CCmax;

//-------------------------------
// Poin D of Bearish

strPattern = "";
BearGartley = IIf(HighestSince(bearGartley4,H) > ValueWhen(BearGartley4,V1L2) + (ValueWhen(BearGartley4,P1H2) - ValueWhen(BearGartley4,V1L2))*GDmin AND
HighestSince(bearGartley4,H) < ValueWhen(BearGartley4,V1L2) + (ValueWhen(BearGartley4,P1H2) - ValueWhen(BearGartley4,V1L2))*GDMax AND
LowestSince(BearGartley4,L) >= ValueWhen(BearGartley4,V1L1 ) AND
HighestSince(BearGartley4,H) == H, True, False);
BearGartley = BearGartley AND HighestSince(BearGartley4,H) > ValueWhen(BearGartley4,P1H1);
strPattern =WriteIf(BearGartley ,"BEARISH GARTLEY",strPattern );

BearBat = IIf((HighestSince(BearBat4,H) > ValueWhen(BearBat4,V1L2) + (ValueWhen(BearBat4,P1H2) - ValueWhen(BearBat4,V1L2))*BatDmin AND
HighestSince(BearBat4,H) < ValueWhen(BearBat4,V1L2) + (ValueWhen(BearBat4,P1H2) - ValueWhen(BearBat4,V1L2))*BatDMax AND
LowestSince(BearBat4,L) >= ValueWhen(BearBat4,V1L1 ) AND
HighestSince(BearBat4,H) == H), True, False);
BearBat = BearBat AND HighestSince(BearBat4,H) > ValueWhen(BearBat4,P1H1);
strPattern =WriteIf(BearBat ,"BEARISH BAT",strPattern );


BearButterfly = IIf(HighestSince(BearButterfly4,H) > ValueWhen(BearButterfly4,V1L2) + (ValueWhen(BearButterfly4,P1H2) - ValueWhen(BearButterfly4,V1L2))*BtDmin AND
HighestSince(BearButterfly4,H) < ValueWhen(BearButterfly4,V1L2) + (ValueWhen(BearButterfly4,P1H2) - ValueWhen(BearButterfly4,V1L2))*BtDMax AND
LowestSince(BearButterfly4,L) >= ValueWhen(BearButterfly4,V1L1 ) AND
HighestSince(BearButterfly4,H) == H, True, False);
BearButterfly = BearButterfly AND HighestSince(BearButterfly4,H) > ValueWhen(BearButterfly4,P1H2);
strPattern =WriteIf(BearButterfly, "BEARISH BUTTERFLY",strPattern );

BearCrab = IIf(HighestSince(BearCrab4,H) > ValueWhen(BearCrab4,V1L2) + (ValueWhen(BearCrab4,P1H2) - ValueWhen(BearCrab4,V1L2))*CDmin AND
HighestSince(BearCrab4,H) < ValueWhen(BearCrab4,V1L2) + (ValueWhen(BearCrab4,P1H2) - ValueWhen(BearCrab4,V1L2))*CDMax AND
LowestSince(BearCrab4,L) >= ValueWhen(BearCrab4,V1L1 ) AND
HighestSince(BearCrab4,H) == H, True, False);
BearCrab =BearCrab AND HighestSince(BearCrab4,H) > ValueWhen(BearCrab4,P1H2);
strPattern =WriteIf(BearCrab , "BEARISH CRAB",strPattern );


BearHar4 = BearGartley4 OR BearButterfly4 OR BearBat4 OR BearCrab4 ;
BearHar = BearGartley OR BearButterfly OR BearBat OR BearCrab ;

Point4 = IIf(BearHar,ValueWhen(BearHar4,bi),Null);
BearHar = IIf(BearHar, IIf(Point4 == ValueWhen(BearHar,point4,0) AND ValueWhen(BearHar,bi,0) > bi ,False,BearHar),BearHar);

X = ValueWhen(BearHar4,P1H2);
Xbar = ValueWhen(BearHar4,P1Bar2);
A = ValueWhen(BearHar4,V1L2);
Abar = ValueWhen( BearHar4,V1bar2);
B = ValueWhen(BearHar4,P1H1);
Bbar = ValueWhen(BearHar4,P1bar1);
C1 = ValueWhen(BearHar4,V1L1);
C1bar = ValueWhen(BearHar4,V1bar1);
D = ValueWhen(BearHar,H);
Dbar = ValueWhen(BearHar,bi);

ABdXA = (B-A)/(X-A);
BCdAB = (B-C1)/(B-A);
ADdXA = (D-A)/(X-A);
BCdCD = (D-C1)/(B-C1);

PlotPattern = Dbar > C1bar;

if(LastValue(Plotpattern) AND be)

{
// Ve duong XA, AB, BC
Plot( LineArray(LastValue(Xbar),LastValue(X),LastValue(Abar),LastValue(A)),"",colorR ed,styleThick);
Plot(LineArray(LastValue(Abar),LastValue(A),LastValue(Bbar),LastValue(B)),"",c olorRed,styleThick);
Plot(LineArray(LastValue(Bbar),LastValue(B),LastValue(C1bar),LastValue(C1)),"" ,colorRed,styleThick);
Plot(LineArray(LastValue(C1bar),LastValue(C1),LastValue(Dbar),LastValue(D)),"" ,colorRed,styleThick);
Plot(LineArray(LastValue(Xbar),LastValue(X),LastValue(Bbar),LastValue(B)),"",c olorRed,styleDashed);
Plot(LineArray(LastValue(Xbar),LastValue(X),LastValue(Abar),LastValue(A)),"",c olorRed,styleThick);
Plot(LineArray(LastValue(Abar),LastValue(A),LastValue(C1bar),LastValue(C1)),"" ,colorRed,styleDashed);
Plot(LineArray(LastValue(Bbar),LastValue(B),LastValue(Dbar),LastValue(D)),"",c olorRed,styleDashed);
Plot(LineArray(LastValue(Xbar),LastValue(X),LastValue(Dbar),LastValue(D)),"",c olorRed,styleDashed);

// Viet cac gia tri Fibo tren duong XA, AB, BC
PlotText(NumToStr(LastValue(ABdXA),1.2),(LastValue(Bbar)+LastValue(Xbar))/2,(LastValue(B)+LastValue(X))/2,colorRed);
PlotText(NumToStr(LastValue(BCdAB),1.2),(LastValue(C1bar)+LastValue(Abar))/2,(LastValue(C1)+LastValue(A))/2,colorRed);
PlotText(NumToStr(LastValue(BCdCD),1.2) ,(LastValue(Dbar)+LastValue(Bbar))/2,(LastValue(D)+LastValue(B))/2,colorRed);
PlotText(NumToStr(LastValue(ADdXA),1.2) ,(LastValue(Dbar)+LastValue(Xbar))/2,(LastValue(D)+LastValue(X))/2,colorRed);

//---------- Viet cac diem X, A, B, C, D: by binhnd---------------------
xlech = -1;
ylech = 1;
Colortext = colorYellow;

PlotText("X",LastValue(Xbar) + xlech, LastValue(X) + ylech, Colortext );
PlotText("A",LastValue(Abar) + xlech, LastValue(A) - ylech, Colortext );
PlotText("B",LastValue(Bbar) + xlech, LastValue(B) + ylech, Colortext );
PlotText("C",LastValue(C1bar) + xlech, LastValue(C1) - ylech, Colortext );
PlotText("D",LastValue(Dbar) + xlech, LastValue(D) + ylech, Colortext );

//--------- Viet thuyet minh mo hinh: by binhnd--------------
if (strPattern!="")
{
strPattern = "Pattern: " + strPattern;
toadoaX = (LastValue(Dbar)+LastValue(Xbar))/2;
toadoY = (LastValue(D)+LastValue(X))/2;

PlotText(strPattern,toadoaX,toadoY+2,Colortext);
}



//-----------------------------------------------------------------------


}




plotFractals = ParamToggle("Plot Fractals","Off|On",0); // Show diem ho^~ tro. va` khang' cu. ko?
if(PlotFractals)
{
PlotShapes(shapeSmallCircle*P1,colorRed,0,H,10);
PlotShapes(shapeSmallCircle*V1,colorBlue,0,L,-10);
}

_SECTION_BEGIN("Background");
SetChartOptions(0,chartShowArrows|chartShowDates);
if( ParamToggle("Tooltip shows", "All Values|Only Prices" ) )
{
ToolTip=StrFormat("Open: %g\nHigh: %g\nLow: %g\nClose: %g
(%.1f%%)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1
)));
}

SetChartBkColor(ParamColor("Outer panel color ",colorBlack)); // color of outer border
SetChartBkGradientFill( ParamColor("Inner panel color upper half",colorDarkTeal),
ParamColor("Inner panel color lower half",colorBlack)//color of inner panel
,ParamColor("behind Text Color", colorYellow));
_SECTION_END();
bnm غير متواجد حالياً   رد مع اقتباس
قديم 22-05-2010, 08:33 PM   #6
bnm
عضو هوامير المميز
 
تاريخ التسجيل: Jan 2007
المشاركات: 24

رد: هذي معادلات للهيرمونك للايمي بروكر

/* HARMONIC PATTERN DETECTION


Automatic Detection of Harmonic Patterns - Gartley, Bat, Butterfly and Crab.

Zig Zag is not used in this AFL. It is based on fractals

Contact - joy.edakad@gmail.com

*/



_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() );
_SECTION_END();

_SECTION_BEGIN("Gartley");

GBmin = Param("Swing B Min.",0.55,0.3,1,0.01);
GBmax = Param("Swing B Max.",0.72,0.4,1,0.01);
GCmin = Param("Swing C Min.",0.38,0.3,1.27,0.01);
GCmax = Param("Swing C Max.",1.0,0.4,1.27,0.01);
GDmin = Param("Swing D Min.(XA)",0.55,0.3,1,0.01);
GDmax = Param("Swing D Max.(XA)",1.0,0.4,1.0,0.01);

_SECTION_END();

_SECTION_BEGIN("Bat");

BatBmin = Param("Swing B Min.",0.38,0.3,1,0.01);
BatBmax = Param("Swing B Max.",0.55,0.4,1,0.01);
BatCmin = Param("Swing C Min.",0.38,0.3,1.62,0.01);
BatCmax = Param("Swing C Max.",1.27,0.4,1.62,0.01);
BatDmin = Param("Swing D Min.(XA)",0.5,0.3,1,0.01);
BatDmax = Param("Swing D Max.(XA)",1.0,0.4,1.0,0.01);

_SECTION_END();

_SECTION_BEGIN("Butterfly");

BtBmin = Param("Swing B Min.",0.55,0.3,1,0.01);
BtBmax = Param("Swing B Max.",0.9,0.4,1,0.01);
BtCmin = Param("Swing C Min.",0.38,0.3,1.62,0.01);
BtCmax = Param("Swing C Max.",1.27,0.4,1.62,0.01);
BtDmin = Param("Swing D Min.(XA)",1,1,1.8,0.01);
BtDmax = Param("Swing D Max.(XA)",1.38,1,1.8,0.01);

_SECTION_END();

_SECTION_BEGIN("Crab");

CBmin = Param("Swing B Min.",0.38,0.3,1,0.01);
CBmax = Param("Swing B Max.",0.65,0.4,1,0.01);
CCmin = Param("Swing C Min.",0.38,0.3,1.62,0.01);
CCmax = Param("Swing C Max.",1.270,0.4,1.62,0.01);
CDmin = Param("Swing D Min.(XA)",1.25,1,1.8,0.01);
CDmax = Param("Swing D Max.(XA)",1.8,1,2,0.01);

_SECTION_END();

_SECTION_BEGIN("Patterns");

strength = Param("Strength",5,2,15,1);
bu = ParamToggle("Bullish Pattern","Off|On",1);
be = ParamToggle("Bearish Pattern","Off|On",1);

bi = Cum(1)-1;

function GetTop(bars)
{
Top = H == HHV(H,2*bars) AND Ref(HHV(H,bars),bars) < H;
Top = Top AND LastValue(bi)-ValueWhen(Top,bi) > bars;
return Top;
}

function GetValley(bars)
{
Valley = L == LLV(L,2*bars) AND Ref(LLV(L,bars),bars) > L;
Valley = Valley AND LastValue(bi)-ValueWhen(Valley,bi) > bars;
return Valley;
}


// Build fractals array

P1 = GetTop(strength);
V1 = GetValley(Strength);

P1 = IIf(P1,IIf(ValueWhen(P1,bi,2) < ValueWhen(V1,bi),P1,IIf(ValueWhen(P1,H,2) > H,False,P1)),P1);
//P1 = IIf(P1 AND ValueWhen(P1,bi,0) > bi,IIf(ValueWhen(P1,bi,0) < ValueWhen(V1,bi,0),IIf(ValueWhen(P1,H,0) >= H,False,P1),P1),P1);
P1 = IIf(P1 AND ValueWhen(P1,bi,0) > bi AND NOT(ValueWhen(V1,bi,0) > 0 AND ValueWhen(V1,bi,0)<ValueWhen(P1,bi,0)),IIf(ValueWhen(P1,H)<=ValueWhen(P1,H,0), False,P1),P1);


V1 = IIf(V1,IIf(ValueWhen(V1,bi,2) < ValueWhen(P1,bi),V1,IIf(ValueWhen(V1,L,2)<L,False,V1)),V1);
//V1 = IIf(V1 AND ValueWhen(V1,bi,0) > bi ,IIf(ValueWhen(V1,bi,0) < ValueWhen(P1,bi,0),IIf(ValueWhen(V1,L,0) <= L, False,V1),V1),V1);
V1 = IIf(V1 AND ValueWhen(V1,bi,0) > bi AND NOT(ValueWhen(P1,bi,0) > bi AND ValueWhen(P1,bi,0)<ValueWhen(V1,bi,0)) , IIf(ValueWhen(V1,L)>=ValueWhen(V1,L,0),False,V1),V1);


P1H1 = ValueWhen(P1,H);
P1Bar1 = ValueWhen(P1,bi);
P1H2 = ValueWhen(P1,H,2);
P1Bar2 = ValueWhen(P1,bi,2);
V1L1 = ValueWhen(V1,L);
V1Bar1 = ValueWhen(V1,bi);
V1L2 = ValueWhen(V1,L,2);
V1Bar2 = ValueWhen(V1,bi,2);


//Bullish Patterns

PTvalid = (P1Bar1 > V1Bar1 AND V1Bar1 > P1Bar2 AND P1bar2 > V1Bar2) AND P1; // Peaks and troughs are in order

// 4 swings of developing Gartley/Bat etc.

BullGartley4 = PTvalid AND (P1H2-V1L1)/(P1H2-V1L2) > GBmin AND (P1H2-V1L1)/(P1H2-V1L2) < GBmax
AND (P1H1-V1L1)/(P1H2-V1L1) > GCMin AND (P1H1-V1L1)/(P1H2-V1L1) < GCMax;

BullBat4 = PTvalid AND (P1H2-V1L1)/(P1H2-V1L2) > BatBmin AND (P1H2-V1L1)/(P1H2-V1L2) < BatBmax
AND (P1H1-V1L1)/(P1H2-V1L1) > BatCMin AND (P1H1-V1L1)/(P1H2-V1L1) < BatCMax;

BullButterfly4 = PTvalid AND (P1H2-V1L1)/(P1H2-V1L2) > BtBmin AND (P1H2-V1L1)/(P1H2-V1L2) < BtBMax
AND (P1H1-V1L1)/(P1H2-V1L1) > BtCmin AND (P1H1-V1L1)/(P1H2-V1L1) < BtCmax;

BullCrab4 = PTvalid AND (P1H2-V1L1)/(P1H2-V1L2) >CBmin AND (P1H2-V1L1)/(P1H2-V1L2) < CBmax
AND (P1H1-V1L1)/(P1H2-V1L1) > CCmin AND (P1H1-V1L1)/(P1H2-V1L1) < CCmax;


// Bullish Gartley/Bat found. D retacement level is not evaluated

BullGartley = IIf(LowestSince(BullGartley4,L) < ValueWhen(BullGartley4,P1H2)-(ValueWhen(BullGartley4,P1H2)-ValueWhen(BullGartley4,V1L2))*GDmin AND
LowestSince(bullGartley4,L) > ValueWhen(BullGartley4,P1H2)-(ValueWhen(BullGartley4,P1H2)-ValueWhen(BullGartley4,V1L2))*GDmax AND
HighestSince(BullGartley4,H) <= ValueWhen(BullGartley4,P1H1 ) AND
LowestSince(bullGartley4,L)==L, True,False);
BullGartley = BullGartley AND LowestSince(BullGartley4,L) < ValueWhen(BullGartley4,V1L1);

BullBat = IIf(LowestSince(BullBat4,L) < ValueWhen(BullBat4,P1H2)-(ValueWhen(BullBat4,P1H2)-ValueWhen(BullBat4,V1L2))*BatDmin AND
LowestSince(BullBat4,L) > ValueWhen(BullBat4,P1H2)-(ValueWhen(BullBat4,P1H2)-ValueWhen(BullBat4,V1L2))*BatDmax AND
HighestSince(BullBat4,H) <= ValueWhen(BullBat4,P1H1 ) AND
LowestSince(BullBat4,L)==L, True,False);
BullBat = BullBat AND LowestSince(BullCrab4,L) < ValueWhen(BullCrab4,V1L1);


BullCrab = IIf(LowestSince(BullCrab4,L) < ValueWhen(BullCrab4,P1H2)-(ValueWhen(BullCrab4,P1H2)-ValueWhen(BullCrab4,V1L2))*CDmin AND
LowestSince(BullCrab4,L) > ValueWhen(BullCrab4,P1H2)-(ValueWhen(BullCrab4,P1H2)-ValueWhen(BullCrab4,V1L2))*CDmax AND
HighestSince(BullCrab4,H) <= ValueWhen(BullCrab4,P1H1 ) AND
LowestSince(bullGartley4,L)==L, True,False);
BullCrab = BullCrab AND LowestSince(BullCrab4,L) < ValueWhen(BullCrab4,V1L2);


BullButterfly = IIf(LowestSince(BullButterfly4,L) < ValueWhen(BullButterfly4,P1H2)-(ValueWhen(BullButterfly4,P1H2)-ValueWhen(BullButterfly4,V1L2))*BtDMin AND
LowestSince(BullButterfly4,L) > ValueWhen(BullButterfly4,P1H2)-(ValueWhen(BullButterfly4,P1H2)-ValueWhen(BullButterfly4,V1L2))*BtDmax AND
HighestSince(BullButterfly4,H) <= ValueWhen(BullButterfly4,P1H1 ) AND
LowestSince(bullButterfly4,L)==L, True,False);
BullButterfly = BullButterfly AND LowestSince(BullButterfly4,L) < ValueWhen(BullButterfly4,V1L2);



// to remove redumbdent lines

BullHar4 = BullGartley4 OR BullButterfly4 OR BullBat4 OR BullCrab4 ;
BullHar = BullGartley OR BullButterfly OR BullBat OR BullCrab ;

Point4 = IIf(BullHar,ValueWhen(BullHar4,bi),Null);
BullHar = IIf(BullHar, IIf(Point4 == ValueWhen(BullHar,point4,0) AND ValueWhen(BullHar,bi,0) > bi ,False,BullHar),BullHar);

X = ValueWhen(BullHar4,V1L2);
Xbar = ValueWhen(BullHar4,V1Bar2);
A = ValueWhen(BullHar4,P1H2);
Abar = ValueWhen(BullHar4,P1bar2);
B = ValueWhen(BullHar4,V1L1);
Bbar = ValueWhen(BullHar4,V1bar1);
C1 = ValueWhen(BullHar4,P1H1);
C1bar = ValueWhen(BullHar4,P1bar1);
D = ValueWhen(BullHar,L);
Dbar = ValueWhen(BullHar,bi);
ABdXA = (A-B)/(A-X);
BCdAB = (C1-B)/(A-B);
ADdXA = (A-D)/(A-X);
BCdCD = (C1-D)/(C1-B);

PlotPattern = Dbar > C1bar;
if(LastValue(PlotPattern) AND bu)
{
Plot( LineArray(LastValue(Xbar),LastValue(X),LastValue(Abar),LastValue(A)),"",colorB lue,styleThick);
Plot(LineArray(LastValue(Abar),LastValue(A),LastValue(Bbar),LastValue(B)),"",c olorBlue,styleThick);
Plot(LineArray(LastValue(Bbar),LastValue(B),LastValue(C1bar),LastValue(C1)),"" ,colorBlue,styleThick);
Plot(LineArray(LastValue(C1bar),LastValue(C1),LastValue(Dbar),LastValue(D)),"" ,colorBlue,styleThick);
Plot(LineArray(LastValue(Xbar),LastValue(X),LastValue(Bbar),LastValue(B)),"",c olorBlue,styleDashed);
Plot(LineArray(LastValue(Xbar),LastValue(X),LastValue(Abar),LastValue(A)),"",c olorBlue,styleThick);
Plot(LineArray(LastValue(Abar),LastValue(A),LastValue(C1bar),LastValue(C1)),"" ,colorBlue,styleDashed);
Plot(LineArray(LastValue(Bbar),LastValue(B),LastValue(Dbar),LastValue(D)),"",c olorBlue,styleDashed);
Plot(LineArray(LastValue(Xbar),LastValue(X),LastValue(Dbar),LastValue(D)),"",c olorBlue,styleDashed);

PlotText(NumToStr(LastValue(ABdXA),1.2),(LastValue(Bbar)+LastValue(Xbar))/2,(LastValue(B)+LastValue(X))/2,colorBlue);
PlotText(NumToStr(LastValue(BCdAB),1.2),(LastValue(C1bar)+LastValue(Abar))/2,(LastValue(C1)+LastValue(A))/2,colorBlue);
PlotText(NumToStr(LastValue(ADdXA),1.2) ,(LastValue(Dbar)+LastValue(Xbar))/2,(LastValue(D)+LastValue(X))/2,colorBlue);
PlotText(NumToStr(LastValue(BCdCD),1.2),(LastValue(Bbar)+LastValue(Dbar))/2,(LastValue(B)+LastValue(D))/2,colorBlue);
}

// Bearish Patterns

PTvalid = (V1Bar1 > P1Bar1 AND P1Bar1 > V1Bar2 AND V1Bar2 > P1Bar2) AND V1;

// Swing 4

BearGartley4 = PTvalid AND (P1H1-V1L2)/(P1H2-V1L2) > GBmin AND (P1H1-V1L2)/(P1H2-V1L2) < GBmax AND
(P1H1-V1L1)/(P1H1-V1L2) > GCmin AND (P1H1-V1L1)/(P1H1-V1L2) < GCmax;

BearBat4 = PTvalid AND (P1H1-V1L2)/(P1H2-V1L2) > BatBmin AND (P1H1-V1L2)/(P1H2-V1L2) < BatBmax AND
(P1H1-V1L1)/(P1H1-V1L2) > BatCmin AND (P1H1-V1L1)/(P1H1-V1L2) < BatCmax;

BearButterfly4 = PTvalid AND (P1H1-V1L2)/(P1H2-V1L2) > BtBmin AND (P1H1-V1L2)/(P1H2-V1L2) < BtBmax AND
(P1H1-V1L1)/(P1H1-V1L2) > BtCmin AND (P1H1-V1L1)/(P1H1-V1L2) < BtCmax;

BearCrab4 = PTvalid AND (P1H1-V1L2)/(P1H2-V1L2) > CBmin AND (P1H1-V1L2)/(P1H2-V1L2) < CBmax AND
(P1H1-V1L1)/(P1H1-V1L2) > CCmin AND (P1H1-V1L1)/(P1H1-V1L2) < CCmax;

// Poin D

BearGartley = IIf(HighestSince(bearGartley4,H) > ValueWhen(BearGartley4,V1L2) + (ValueWhen(BearGartley4,P1H2) - ValueWhen(BearGartley4,V1L2))*GDmin AND
HighestSince(bearGartley4,H) < ValueWhen(BearGartley4,V1L2) + (ValueWhen(BearGartley4,P1H2) - ValueWhen(BearGartley4,V1L2))*GDMax AND
LowestSince(BearGartley4,L) >= ValueWhen(BearGartley4,V1L1 ) AND
HighestSince(BearGartley4,H) == H, True, False);
BearGartley = BearGartley AND HighestSince(BearGartley4,H) > ValueWhen(BearGartley4,P1H1);

BearBat = IIf((HighestSince(BearBat4,H) > ValueWhen(BearBat4,V1L2) + (ValueWhen(BearBat4,P1H2) - ValueWhen(BearBat4,V1L2))*BatDmin AND
HighestSince(BearBat4,H) < ValueWhen(BearBat4,V1L2) + (ValueWhen(BearBat4,P1H2) - ValueWhen(BearBat4,V1L2))*BatDMax AND
LowestSince(BearBat4,L) >= ValueWhen(BearBat4,V1L1 ) AND
HighestSince(BearBat4,H) == H), True, False);
BearBat = BearBat AND HighestSince(BearBat4,H) > ValueWhen(BearBat4,P1H1);

BearButterfly = IIf(HighestSince(BearButterfly4,H) > ValueWhen(BearButterfly4,V1L2) + (ValueWhen(BearButterfly4,P1H2) - ValueWhen(BearButterfly4,V1L2))*BtDmin AND
HighestSince(BearButterfly4,H) < ValueWhen(BearButterfly4,V1L2) + (ValueWhen(BearButterfly4,P1H2) - ValueWhen(BearButterfly4,V1L2))*BtDMax AND
LowestSince(BearButterfly4,L) >= ValueWhen(BearButterfly4,V1L1 ) AND
HighestSince(BearButterfly4,H) == H, True, False);
BearButterfly = BearButterfly AND HighestSince(BearButterfly4,H) > ValueWhen(BearButterfly4,P1H2);

BearCrab = IIf(HighestSince(BearCrab4,H) > ValueWhen(BearCrab4,V1L2) + (ValueWhen(BearCrab4,P1H2) - ValueWhen(BearCrab4,V1L2))*CDmin AND
HighestSince(BearCrab4,H) < ValueWhen(BearCrab4,V1L2) + (ValueWhen(BearCrab4,P1H2) - ValueWhen(BearCrab4,V1L2))*CDMax AND
LowestSince(BearCrab4,L) >= ValueWhen(BearCrab4,V1L1 ) AND
HighestSince(BearCrab4,H) == H, True, False);
BearCrab =BearCrab AND HighestSince(BearCrab4,H) > ValueWhen(BearCrab4,P1H2);


BearHar4 = BearGartley4 OR BearButterfly4 OR BearBat4 OR BearCrab4 ;
BearHar = BearGartley OR BearButterfly OR BearBat OR BearCrab ;

Point4 = IIf(BearHar,ValueWhen(BearHar4,bi),Null);
BearHar = IIf(BearHar, IIf(Point4 == ValueWhen(BearHar,point4,0) AND ValueWhen(BearHar,bi,0) > bi ,False,BearHar),BearHar);

X = ValueWhen(BearHar4,P1H2);
Xbar = ValueWhen(BearHar4,P1Bar2);
A = ValueWhen(BearHar4,V1L2);
Abar = ValueWhen( BearHar4,V1bar2);
B = ValueWhen(BearHar4,P1H1);
Bbar = ValueWhen(BearHar4,P1bar1);
C1 = ValueWhen(BearHar4,V1L1);
C1bar = ValueWhen(BearHar4,V1bar1);
D = ValueWhen(BearHar,H);
Dbar = ValueWhen(BearHar,bi);

ABdXA = (B-A)/(X-A);
BCdAB = (B-C1)/(B-A);
ADdXA = (D-A)/(X-A);
BCdCD = (D-C1)/(B-C1);

PlotPattern = Dbar > C1bar;

if(LastValue(Plotpattern) AND be)

{
Plot( LineArray(LastValue(Xbar),LastValue(X),LastValue(Abar),LastValue(A)),"",colorR ed,styleThick);
Plot(LineArray(LastValue(Abar),LastValue(A),LastValue(Bbar),LastValue(B)),"",c olorRed,styleThick);
Plot(LineArray(LastValue(Bbar),LastValue(B),LastValue(C1bar),LastValue(C1)),"" ,colorRed,styleThick);
Plot(LineArray(LastValue(C1bar),LastValue(C1),LastValue(Dbar),LastValue(D)),"" ,colorRed,styleThick);
Plot(LineArray(LastValue(Xbar),LastValue(X),LastValue(Bbar),LastValue(B)),"",c olorRed,styleDashed);
Plot(LineArray(LastValue(Xbar),LastValue(X),LastValue(Abar),LastValue(A)),"",c olorRed,styleThick);
Plot(LineArray(LastValue(Abar),LastValue(A),LastValue(C1bar),LastValue(C1)),"" ,colorRed,styleDashed);
Plot(LineArray(LastValue(Bbar),LastValue(B),LastValue(Dbar),LastValue(D)),"",c olorRed,styleDashed);
Plot(LineArray(LastValue(Xbar),LastValue(X),LastValue(Dbar),LastValue(D)),"",c olorRed,styleDashed);

PlotText(NumToStr(LastValue(ABdXA),1.2),(LastValue(Bbar)+LastValue(Xbar))/2,(LastValue(B)+LastValue(X))/2,colorRed);
PlotText(NumToStr(LastValue(BCdAB),1.2),(LastValue(C1bar)+LastValue(Abar))/2,(LastValue(C1)+LastValue(A))/2,colorRed);
PlotText(NumToStr(LastValue(BCdCD),1.2) ,(LastValue(Dbar)+LastValue(Bbar))/2,(LastValue(D)+LastValue(B))/2,colorRed);
PlotText(NumToStr(LastValue(ADdXA),1.2) ,(LastValue(Dbar)+LastValue(Xbar))/2,(LastValue(D)+LastValue(X))/2,colorRed);

}

LatPattern = bullHar OR bearHar;
Lastpattern = LastValue(ValueWhen(LatPattern,IIf(BullGartley,1,IIf(BearGartley,-1,IIf(BullBat,2,IIf(BearBat,-2,
IIf(BullButterfly,3,IIf(BearButterfly,-3,IIf(BullCrab,4,IIf(BearCrab,-4,Null))))))))));
PatternName = WriteIf(LastPattern == 1,"Bullish Gartley",WriteIf(LastPattern == -1,"Bearish Gartley",WriteIf(LastPattern == 2,"Bullish Bat",
WriteIf(LastPattern == -2,"Bearish Bat",WriteIf(LastPattern == 3,"Bullish Butterfly",WriteIf(LastPattern == -3,"Bearish Butterfly",
WriteIf(LastPattern == 4,"Bullish Crab",WriteIf(LastPattern == -4,"Bearish Crab","None"))))))));


plotFractals = ParamToggle("Plot Fractals","Off|On",0);
if(PlotFractals)
{
PlotShapes(shapeSmallCircle*P1,colorRed,0,H,10);
PlotShapes(shapeSmallCircle*V1,colorBlue,O,L,-10);
}

GfxSetTextColor(IIf(LastPattern > 0, colorGreen,colorRed));
GfxTextOut("Last Pattern : " + PatternName,0,20);

Filter = BullHar OR BearHar;
Bull = BullHar; Bear = BearHar;
Color = IIf(Bull,colorGreen,colorRed);
AddColumn(IIf(Bull,1,IIf(Bear,-1,Null)),"Pattern",1.0,colorWhite,Color);

_SECTION_BEGIN("Background");
SetChartOptions(0,chartShowArrows|chartShowDates);
if( ParamToggle("Tooltip shows", "All Values|Only Prices" ) )
{
ToolTip=StrFormat("Open: %g\nHigh: %g\nLow: %g\nClose: %g
(%.1f%%)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1
)));
}

SetChartBkColor(ParamColor("Outer panel color ",colorBlack)); // color of outer border
SetChartBkGradientFill( ParamColor("Inner panel color upper half",colorDarkTeal),
ParamColor("Inner panel color lower half",colorBlack)//color of inner panel
,ParamColor("behind Text Color", colorYellow));
_SECTION_END();
bnm غير متواجد حالياً   رد مع اقتباس
قديم 22-05-2010, 11:32 PM   #7
ابونايف12
عضو هوامير المميز
 
تاريخ التسجيل: Aug 2006
المشاركات: 159

رد: هذي معادلات للهيرمونك للايمي بروكر

بارك الله فيك
ابونايف12 غير متواجد حالياً   رد مع اقتباس
قديم 23-05-2010, 01:21 AM   #8
abo-saif
عضو هوامير المميز
 
تاريخ التسجيل: Jul 2006
المشاركات: 1,068

رد: هذي معادلات للهيرمونك للايمي بروكر

ممكن صورة توضيحية
للمعادلة لاني حملتها
وماطلع لي شيء مهم
abo-saif غير متواجد حالياً   رد مع اقتباس
قديم 23-05-2010, 10:20 AM   #9
bnm
عضو هوامير المميز
 
تاريخ التسجيل: Jan 2007
المشاركات: 24

رد: هذي معادلات للهيرمونك للايمي بروكر

اقتباس:
المشاركة الأصلية كتبت بواسطة الملك الدمام مشاهدة المشاركة
ممكن صورة توضيحية
للمعادلة لاني حملتها
وماطلع لي شيء مهم
مرحبا اخي
اي وحده تقصد عشان اخبرك مزايها
على العموم هيه ترسم الهيرمونك بي كل انواعه ونستفيد من الارتدادات فقط
يعن المعادله تبين xabcd وندخل بعد d اذا كانت فيها فايده
bnm غير متواجد حالياً   رد مع اقتباس
قديم 23-05-2010, 04:30 PM   #10
bnm
عضو هوامير المميز
 
تاريخ التسجيل: Jan 2007
المشاركات: 24

رد: هذي معادلات للهيرمونك للايمي بروكر

اقتباس:
المشاركة الأصلية كتبت بواسطة دافورnet مشاهدة المشاركة
اسعفنا بمعادلة للميتاستوك
مرحبا اخوي والله ماتعامل معا الميتاستوك بس فالك طيب هذي معادله الذئب على ميتا



ColA: WW

Pa:=Trough(4,LOW,5);

Pb:=Peak(3,HIGH,5);

P1:=Trough(3,LOW,5);

P2:=Peak(2,HIGH,5);

P3:=Trough(2,LOW,5);

P4:=Peak(1,HIGH,5);

P5:=Trough(1,LOW,5);

tb:=TroughBars(1,LOW,5);

tb<=4 AND

p1 > pa AND

pb < p2 AND

p1 < p2 AND

p1 < p4 AND

p1 > p3 AND

p3 > p5 AND

p4 < p2 AND

ColB: Tangents

p1:=Trough(3,LOW,5);

p3:=Trough(2,LOW,5);

p5:=Trough(1,LOW,5);

o1:=p1-p3;

o2:=p1-p5;

a1:=TroughBars(3,LOW,5)-TroughBars(2,LOW,5);

a2:=TroughBars(3,LOW,5)-TroughBars(1,LOW,5);

tan1:=o1/a1;

tan2:=o2/a2;

Abs(tan1-tan2)

Filter:

colA AND colB <= .2
bnm غير متواجد حالياً   رد مع اقتباس
إضافة رد



مواقع النشر (المفضلة)

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

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

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

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

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




07:07 AM


الاعلان بمنتدى هوامير البورصة
تشغيل وتطوير افاق الإقتصاد
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
جميع المواضيع و الردود المطروحة لا تعبر عن رأي المنتدى بل تعبر عن رأي كاتبها وقرار البيع والشراء مسؤليتك وحدك

بناء على نظام السوق المالية بالمرسوم الملكي م/30 وتاريخ 2/6/1424هـ ولوائحه التنفيذية الصادرة من مجلس هيئة السوق المالية: تعلن الهيئة للعموم بانه لا يجوز جمع الاموال بهدف استثمارها في اي من اعمال الاوراق المالية بما في ذلك ادارة محافظ الاستثمار او الترويج لاوراق مالية كالاسهم او الاستتشارات المالية او اصدار التوصيات المتعلقة بسوق المال أو بالاوراق المالية إلا بعد الحصول على ترخيص من هيئة السوق المالية.