قديم 30-03-2015, 09:25 PM
  المشاركه #1765

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

تاريخ التسجيل: Feb 2012
المشاركات: 4,711
eze غير متواجد حالياً  

أبوحمود بالأمكان إيضافة العبارات التالية إلى السكريبت:

up= Cross(C,KijunSen);
down= Cross(KijunSen,C);

PlotShapes(IIf( up, shapeUpArrow, shapeNone), colorBrightGreen,0,L,-20);
PlotShapes(IIf( down, shapeDownArrow, shapeNone), colorOrange,0,H,-20);


دمت بخير



رد مع اقتباس
 
 

قديم 31-03-2015, 12:13 PM
  المشاركه #1766

كاتب مميز

تاريخ التسجيل: May 2011
المشاركات: 3,546
ابو حمـودي غير متواجد حالياً  

اقتباس:
المشاركة الأصلية كتبت بواسطة eze مشاهدة المشاركة
أبوحمود بالأمكان إيضافة العبارات التالية إلى السكريبت:

Up= cross(c,kijunsen);
down= cross(kijunsen,c);

plotshapes(iif( up, shapeuparrow, shapenone), colorbrightgreen,0,l,-20);
plotshapes(iif( down, shapedownarrow, shapenone), colororange,0,h,-20);


دمت بخير
فضلا وليس امرا وين اضيفها ممكن تضيفها لي على المعادله في الاعلى



رد مع اقتباس
قديم 31-03-2015, 08:08 PM
  المشاركه #1767

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

تاريخ التسجيل: Feb 2012
المشاركات: 4,711
eze غير متواجد حالياً  


_SECTION_BEGIN("i");
/* ICHIMOKU CHART */
n1 = Param("E?è?îê?: ï??èî? 1",9,1,200,1);
n2 = Param("E?è?îê?: ï??èî? 2",26,1,400,1);
n3 = Param("E?è?îê?: ï??èî? 3",52,1,600,1);
TenkanSen =(HHV(H,n1)+LLV(L,n1))/2; // Tenkan-sen (???êà?-???) – ??î ??????? ç?à÷??è? ???û çà ï??âûé ï?î?????îê â?????è (?àâ?à (high+low)/2, ??? high è low – ?àê?è??? è ?è?è??? çà ï??èî?).
KijunSen =(HHV(H,n2)+LLV(L,n2))/2; // Kijun-sen (Eè????-???) – ??î ??????? ç?à÷??è? ???û çà â?î?îé ï?î?????îê.
ChinkouSpan =Ref(C,-n2); // Chinkou Span (×èêî? ?ï??) - ???à çàê?û?è? ??ê?ù??î ?à?à, ??âè???à? ?àçà? ?à â?ëè÷è?? â?î?î?î â??????î?î è????âàëà.
Cks = Close; // ??àôè÷??êèé Chinkou Span, ??âè? ?àçà? çà?÷?? î??è?îâêè.
SenkouSpanA =Ref((KijunSen+TenkanSen)/2,-n2); // Senkou Span A (???êî? ?ï?? A) / Up Kumo - ?????è?à ?à???î??è? ????? Tenkan-sen è Kijun-sen, ??âè???î? âï???? ?à â?ëè÷è?? â?î?î?î â??????î?î è????âàëà.
SpA =(KijunSen+TenkanSen)/2; // ??àôè÷??êèé Senkou Span A , ??âè? âï???? çà?÷?? î??è?îâêè.
SenkouSpanB =Ref((HHV(H,n3)+LLV(L,n3))/2,-n2); // Senkou Span B (???êî? ?ï?? A) / Down Kumo - ??????? ç?à÷??è? ???û çà ????èé â??????îé è????âàë, ??âè???î? âï???? ?à â?ëè÷è?? â?î?î?î â??????î?î è????âàëà.
SpB =(HHV(H,n3)+LLV(L,n3))/2; // ??àôè÷??êèé Senkou Span B, ??âè? âï???? çà?÷?? î??è?îâêè.
DL = Ref( C, 25 );

Cond1 = Ref(Close > Max(SenkouSpanA,SenkouSpanB),-1); //???à âû?? î?ëàêà -- ?û÷ü? ?à???î??è?
Cond2 = Ref(Close < Min(SenkouSpanA,SenkouSpanB),-1); //???à ?è?? î?ëàêà -- ???â??ü? ?à???î??è?
Cond3 = Ref(Cross(TenkanSen,KijunSen),-1); //ï?????÷??è? ???êà? è Eè???? -- ?è??àë ?à ïîê?ïê?
Cond4 = Ref(Cross(KijunSen,TenkanSen),-1); //ï?????÷??è? ???êà? è Eè???? -- ?è??àë ?à ï?î?à??
Cond5 = Ref(Cross(Close,ChinkouSpan ),-1); //ï?????÷??è? ×èêî? è ???û
Cond6 = Ref(Cross(ChinkouSpan ,Close),-1); //ï?????÷??è? ×èêî? è ???û
Cond7 = Ref(Cross (Close , Max(SenkouSpanA,SenkouSpanB)),-1); //???à âû?î?è? ââ??? èç î?ëàêà -- ?è??àë ?à ïîê?ïê?
Cond8 = Ref(Cross ( Min(SenkouSpanA,SenkouSpanB), Close),-1); //???à âû?î?è? â?èç èç î?ëàêà -- ?è??àë ?à ï?î?à??
Cond9 = Close > TenkanSen AND TenkanSen > KijunSen AND KijunSen > Max(SenkouSpanA,SenkouSpanB); // ?è??àë ???? ëè?èé ââ???
Cond10= Close < TenkanSen AND TenkanSen < KijunSen AND KijunSen < Min(SenkouSpanA,SenkouSpanB); // ?è??àë ???? ëè?èé â?èç
RemCond9=ExRem(Cond9,NOT Cond9);
RemCond10=ExRem(Cond10,NOT Cond10);
ColSenk =IIf (Cond1,colorGreen, IIf(Cond2,colorRed,colorLightGrey)); // çà?à?? ?â??, ??ëè ???à âû??/?è??/â????è î?ëàêà.
Flat = TenkanSen == Ref(TenkanSen,-1) OR (NOT(Cond1) AND NOT(Cond2)) ;
for( i = 0; i < BarCount; i++ ) //?à?ê?à?èâà?? ??????? ëè?è? è??èêà?î?à ïî âçàè?î?à?ïîëî???è? è ?àï?àâë??è? ?âè???è? TenkanSen, ???û è î?ëàêà.
{
if (Flat[i])
ColTenk[i] = colorLightGrey;
else
{
if (Cond1[i] AND TenkanSen[i] > TenkanSen[i-1])
ColTenk[i] = colorGreen;
if (Cond1[i] AND TenkanSen[i] < TenkanSen[i-1])
ColTenk[i] = colorRed;
if (Cond2[i] AND TenkanSen[i] < TenkanSen[i-1])
ColTenk[i] = colorRed;
if (Cond2[i] AND TenkanSen[i] > TenkanSen[i-1])
ColTenk[i] = colorGreen;
}
}

AlertIf( Cond3 OR Cond4, "SOUND c:/WINDOWS/Media/notify.wav", "ï?????÷??è? ???êà? è Eè????",0,1+2+4+8);
AlertIf( Cond5 OR Cond6, "SOUND c:/WINDOWS/Media/notify.wav", "ï?????÷??è? ×èêî? è ???û",0,1+2+4+8);
AlertIf( Cond7 OR Cond8, "SOUND c:/WINDOWS/Media/notify.wav", "???à âû?î?è? èç î?ëàêà",0,1+2+4+8);
AlertIf( RemCond9 OR RemCond10, "SOUND c:/WINDOWS/Media/notify.wav", "?è??àë ???? ëè?èé",0,1+2+4+8);
//PlotShapes(IIf(Cond7, shapeSmallUpTriangle ,shapeNone),colorGreen,0,H,10);
//PlotShapes(IIf(Cond8, shapeSmallDownTriangle ,shapeNone),colorRed,0,L,10);
//PlotShapes(IIf(Cond3, shapeHollowSmallUpTriangle,shapeNone),colorGreen,0,H,12);
//PlotShapes(IIf(Cond4, shapeHollowSmallDownTriangle ,shapeNone),colorRed,0,L,12);
//PlotShapes(IIf(Cond5, shapeSmallCircle ,shapeNone),colorGreen,0,H,4);
//PlotShapes(IIf(Cond6, shapeSmallCircle + shapePositionAbove ,shapeNone),colorRed,0,L,4);
//PlotShapes(IIf(RemCond9 , shapeHollowSquare ,shapeNone),colorGreen,0,H,18);
//PlotShapes(IIf(RemCond10, shapeHollowSquare + shapePositionAbove ,shapeNone),colorRed,0,L,18);
//Plot (C,"Close",colorBlack,styleThick);
Plot (C,"Bars",colorBlack,styleCandle);
Plot (TenkanSen,"Tenkan-sen",colorRed);
Plot (KijunSen, "Kijun-sen", colorBlue);
Plot (Cks,"Chinkou Span",colorLime, style = styleLine,0,0,-n2);
Plot (SpA,"SenkouSpanA",colorOrange,styleDashed,0,0,n2);
Plot (SpB,"SenkouSpanB",colorViolet,styleDashed + styleThick,0,0,n2);
PlotOHLC (SpA,SpA,SpB,SpB,"Cloud",IIf (SpA > SpB,colorPink,colorLavender),styleCloud, 10, 10, n2 );
above = IIf(KijunSen>SenkouSpanA AND TenkanSen>SenkouSpanB,1,0);
within = IIf(KijunSen>SenkouSpanA AND TenkanSen<SenkouSpanB,1,0);
below = IIf(TenkanSen<SenkouSpanA AND TenkanSen<SenkouSpanB,1,0);
Buy = Cross(TenkanSen,KijunSen) AND (DL>Close);
Sell = Cross(KijunSen,TenkanSen) AND (DL<KijunSen);
StrongBuy = Buy AND above;
MediumBuy = Buy AND within;
WeakBuy = Buy AND below;
StrongSell = Sell AND below;
MediumSell = Sell AND within;
WeakSell = Sell AND above;
IIf( (StrongBuy),PlotShapes(shapeUpTriangle*StrongBuy,colorGreen),0);
IIf( (MediumBuy),PlotShapes(shapeUpArrow*MediumBuy,colorGreen),0);
IIf( (WeakBuy),PlotShapes(shapeHollowUpArrow*WeakBuy,colorIndigo),0);
IIf( (StrongSell),PlotShapes(shapeDownTriangle*StrongSell,colorRed),0);
IIf( (MediumSell),PlotShapes(shapeDownArrow*MediumSell,colorRed),0);
IIf( (WeakSell),PlotShapes(shapeHollowDownArrow*WeakSell,colorBrown),0);



up= Cross(C,KijunSen);
down= Cross(KijunSen,C);

PlotShapes(IIf( up, shapeUpArrow, shapeNone), colorBrightGreen,0,L,-20);
PlotShapes(IIf( down, shapeDownArrow, shapeNone), colorOrange,0,H,-20);

Plot( 1, "Ribbon", ColTenk, styleOwnScale|styleArea|styleNoLabel, -2, 200 ); // è??è?è???? ôë?? ?à TenkanSen.
Plot( 4, "Ribbon", ColSenk, styleOwnScale|styleArea|styleNoLabel, -1, 200 ); // è??è?è???? ïîëî???è? ???û î??î?è??ëü?î î?ëàêà
_SECTION_END();




رد مع اقتباس
قديم 31-03-2015, 08:09 PM
  المشاركه #1768

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

تاريخ التسجيل: Feb 2012
المشاركات: 4,711
eze غير متواجد حالياً  

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

_section_begin("i");
/* ichimoku chart */
n1 = param("e?è?îê?: ï??èî? 1",9,1,200,1);
n2 = param("e?è?îê?: ï??èî? 2",26,1,400,1);
n3 = param("e?è?îê?: ï??èî? 3",52,1,600,1);
tenkansen =(hhv(h,n1)+llv(l,n1))/2; // tenkan-sen (???êà?-???) – ??î ??????? ç?à÷??è? ???û çà ï??âûé ï?î?????îê â?????è (?àâ?à (high+low)/2, ??? High è low – ?àê?è??? è ?è?è??? çà ï??èî?).
Kijunsen =(hhv(h,n2)+llv(l,n2))/2; // kijun-sen (eè????-???) – ??î ??????? ç?à÷??è? ???û çà â?î?îé ï?î?????îê.
Chinkouspan =ref(c,-n2); // chinkou span (×èêî? ?ï??) - ???à çàê?û?è? ??ê?ù??î ?à?à, ??âè???à? ?àçà? ?à â?ëè÷è?? â?î?î?î â??????î?î è????âàëà.
Cks = close; // ??àôè÷??êèé chinkou span, ??âè? ?àçà? çà?÷?? î??è?îâêè.
Senkouspana =ref((kijunsen+tenkansen)/2,-n2); // senkou span a (???êî? ?ï?? A) / up kumo - ?????è?à ?à???î??è? ????? Tenkan-sen è kijun-sen, ??âè???î? âï???? ?à â?ëè÷è?? â?î?î?î â??????î?î è????âàëà.
Spa =(kijunsen+tenkansen)/2; // ??àôè÷??êèé senkou span a , ??âè? âï???? çà?÷?? î??è?îâêè.
Senkouspanb =ref((hhv(h,n3)+llv(l,n3))/2,-n2); // senkou span b (???êî? ?ï?? A) / down kumo - ??????? ç?à÷??è? ???û çà ????èé â??????îé è????âàë, ??âè???î? âï???? ?à â?ëè÷è?? â?î?î?î â??????î?î è????âàëà.
Spb =(hhv(h,n3)+llv(l,n3))/2; // ??àôè÷??êèé senkou span b, ??âè? âï???? çà?÷?? î??è?îâêè.
Dl = ref( c, 25 );

cond1 = ref(close > max(senkouspana,senkouspanb),-1); //???à âû?? î?ëàêà -- ?û÷ü? ?à???î??è?
Cond2 = ref(close < min(senkouspana,senkouspanb),-1); //???à ?è?? î?ëàêà -- ???â??ü? ?à???î??è?
Cond3 = ref(cross(tenkansen,kijunsen),-1); //ï?????÷??è? ???êà? è eè???? -- ?è??àë ?à ïîê?ïê?
Cond4 = ref(cross(kijunsen,tenkansen),-1); //ï?????÷??è? ???êà? è eè???? -- ?è??àë ?à ï?î?à??
Cond5 = ref(cross(close,chinkouspan ),-1); //ï?????÷??è? ×èêî? è ???û
cond6 = ref(cross(chinkouspan ,close),-1); //ï?????÷??è? ×èêî? è ???û
cond7 = ref(cross (close , max(senkouspana,senkouspanb)),-1); //???à âû?î?è? ââ??? èç î?ëàêà -- ?è??àë ?à ïîê?ïê?
Cond8 = ref(cross ( min(senkouspana,senkouspanb), close),-1); //???à âû?î?è? â?èç èç î?ëàêà -- ?è??àë ?à ï?î?à??
Cond9 = close > tenkansen and tenkansen > kijunsen and kijunsen > max(senkouspana,senkouspanb); // ?è??àë ???? ëè?èé ââ???
Cond10= close < tenkansen and tenkansen < kijunsen and kijunsen < min(senkouspana,senkouspanb); // ?è??àë ???? ëè?èé â?èç
remcond9=exrem(cond9,not cond9);
remcond10=exrem(cond10,not cond10);
colsenk =iif (cond1,colorgreen, iif(cond2,colorred,colorlightgrey)); // çà?à?? ?â??, ??ëè ???à âû??/?è??/â????è î?ëàêà.
Flat = tenkansen == ref(tenkansen,-1) or (not(cond1) and not(cond2)) ;
for( i = 0; i < barcount; i++ ) //?à?ê?à?èâà?? ??????? ëè?è? è??èêà?î?à ïî âçàè?î?à?ïîëî???è? è ?àï?àâë??è? ?âè???è? Tenkansen, ???û è î?ëàêà.
{
if (flat[i])
coltenk[i] = colorlightgrey;
else
{
if (cond1[i] and tenkansen[i] > tenkansen[i-1])
coltenk[i] = colorgreen;
if (cond1[i] and tenkansen[i] < tenkansen[i-1])
coltenk[i] = colorred;
if (cond2[i] and tenkansen[i] < tenkansen[i-1])
coltenk[i] = colorred;
if (cond2[i] and tenkansen[i] > tenkansen[i-1])
coltenk[i] = colorgreen;
}
}

alertif( cond3 or cond4, "sound c:/windows/media/notify.wav", "ï?????÷??è? ???êà? è eè????",0,1+2+4+8);
alertif( cond5 or cond6, "sound c:/windows/media/notify.wav", "ï?????÷??è? ×èêî? è ???û",0,1+2+4+8);
alertif( cond7 or cond8, "sound c:/windows/media/notify.wav", "???à âû?î?è? èç î?ëàêà",0,1+2+4+8);
alertif( remcond9 or remcond10, "sound c:/windows/media/notify.wav", "?è??àë ???? ëè?èé",0,1+2+4+8);
//plotshapes(iif(cond7, shapesmalluptriangle ,shapenone),colorgreen,0,h,10);
//plotshapes(iif(cond8, shapesmalldowntriangle ,shapenone),colorred,0,l,10);
//plotshapes(iif(cond3, shapehollowsmalluptriangle,shapenone),colorgreen,0,h,12);
//plotshapes(iif(cond4, shapehollowsmalldowntriangle ,shapenone),colorred,0,l,12);
//plotshapes(iif(cond5, shapesmallcircle ,shapenone),colorgreen,0,h,4);
//plotshapes(iif(cond6, shapesmallcircle + shapepositionabove ,shapenone),colorred,0,l,4);
//plotshapes(iif(remcond9 , shapehollowsquare ,shapenone),colorgreen,0,h,18);
//plotshapes(iif(remcond10, shapehollowsquare + shapepositionabove ,shapenone),colorred,0,l,18);
//plot (c,"close",colorblack,stylethick);
plot (c,"bars",colorblack,stylecandle);
plot (tenkansen,"tenkan-sen",colorred);
plot (kijunsen, "kijun-sen", colorblue);
plot (cks,"chinkou span",colorlime, style = styleline,0,0,-n2);
plot (spa,"senkouspana",colororange,styledashed,0,0,n2);
plot (spb,"senkouspanb",colorviolet,styledashed + stylethick,0,0,n2);
plotohlc (spa,spa,spb,spb,"cloud",iif (spa > spb,colorpink,colorlavender),stylecloud, 10, 10, n2 );
above = iif(kijunsen>senkouspana and tenkansen>senkouspanb,1,0);
within = iif(kijunsen>senkouspana and tenkansen<senkouspanb,1,0);
below = iif(tenkansen<senkouspana and tenkansen<senkouspanb,1,0);
buy = cross(tenkansen,kijunsen) and (dl>close);
sell = cross(kijunsen,tenkansen) and (dl<kijunsen);
strongbuy = buy and above;
mediumbuy = buy and within;
weakbuy = buy and below;
strongsell = sell and below;
mediumsell = sell and within;
weaksell = sell and above;
iif( (strongbuy),plotshapes(shapeuptriangle*strongbuy,colorgreen),0);
iif( (mediumbuy),plotshapes(shapeuparrow*mediumbuy,colorgreen),0);
iif( (weakbuy),plotshapes(shapehollowuparrow*weakbuy,colorindigo),0);
iif( (strongsell),plotshapes(shapedowntriangle*strongsell,colorred),0);
iif( (mediumsell),plotshapes(shapedownarrow*mediumsell,colorred),0);
iif( (weaksell),plotshapes(shapehollowdownarrow*weaksell,colorbrown),0);



up= cross(c,kijunsen);
down= cross(kijunsen,c);

plotshapes(iif( up, shapeuparrow, shapenone), colorbrightgreen,0,l,-20);
plotshapes(iif( down, shapedownarrow, shapenone), colororange,0,h,-20);


plot( 1, "ribbon", coltenk, styleownscale|stylearea|stylenolabel, -2, 200 ); // è??è?è???? ôë?? ?à tenkansen.
Plot( 4, "ribbon", colsenk, styleownscale|stylearea|stylenolabel, -1, 200 ); // è??è?è???? ïîëî???è? ???û î??î?è??ëü?î î?ëàêà
_section_end();


بالتوفيق أخي أبا حمود



رد مع اقتباس
قديم 20-04-2015, 10:03 AM
  المشاركه #1769

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

تاريخ التسجيل: Feb 2012
المشاركات: 362
khloudus غير متواجد حالياً  

ممكن تعريب الامي بروكر


رد مع اقتباس
قديم 21-04-2015, 02:13 AM
  المشاركه #1770

كاتب قدير

تاريخ التسجيل: Jul 2006
المشاركات: 36,145
ابو غيداء غير متواجد حالياً  

يعافيكم ربي
وحلوه المعادله
اقتباس:
المشاركة الأصلية كتبت بواسطة khloudus مشاهدة المشاركة
ممكن تعريب الامي بروكر
انصحك بعدم التعريب

الا للضروره



رد مع اقتباس
قديم 30-04-2015, 11:17 PM
  المشاركه #1771

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

تاريخ التسجيل: Mar 2007
المشاركات: 9
ابو نواف99 غير متواجد حالياً  

السلام عليكم ورحمة الله وبركاته
اخي ابو غيداء.... هاذي معادلة gordon rose وعند وضعها في التحليل الالي تظهر اشارة خطأ لعدم اضافة اشارات الشراء والبيع لذا آمل اضافة ذلك في المعادلة فضلاً لا أمراً.
ولك جزيل الشكر:
// **************************
// BEING EXPLORATION CODE
// **************************

// -- what will be our lookback range for the hh and ll?
nBars = Param("Number of bars", 12, 5, 40);
bTrace = Param("Include trace output", 1, 0, 1);
nNoPivsInSetup = Param("No. Pivs in Setup", 4, 3, 4, 1);
bShowTCZ = Param("Show TCZ", 1, 0, 1);
nMinBarsBtwPivs = Param("Min. number of bars btw. pivots", 1, 1, 10, 1);
nMinPctBtwPivs = Param("Min. percent diff. btw. pivots", .05, .04, .2, .01);
bLastBarCanBePiv = Param("Last bar can be a pivot", 1, 0, 1);
retrcTolerance = .01;
tczTolerance = .005;
nNumBarsToScan = 120;

// -- added from exploration version 20040204
nExploreBarIdx = 0;
nExploreDate = 0;
nCurDateNum = 0;
DN = DateNum();
DT = DateTime();

// -- key exploration variables
bTCZLong = False;
bTCZShort = False;
nAnchorPivIdx = 0;

ADX8 = ADX(8);

// 1 - INDICATOR, 2 - COMMENTARY, 3 - SCAN,
// 4 - EXPLORATION, 5 - BACKTEST / Optimize
if(Status("action")==1) {
bDraw = True;
bUseLastVis = Param("Use last visible bar", 1, 0, 1);
} else {
bDraw = False;
bUseLastVis = False;
bTrace = False;
nExploreDate = Status("rangetodate");
for (i=LastValue(BarIndex());i>=0;i--) {
nCurDateNum = DN[i];
if (nCurDateNum == nExploreDate) {
nExploreBarIdx = i;
}
}
// -- if(Status("action")==1...
}

GraphXSpace=7;

// -- basic candle chart
// -- if this appears inside if , strange
// drawing results!
PlotOHLC(Open, High, Low, Close,
"BIdx = " + BarIndex() +
"\n" + "O = " + O + "\n"+"H = "+ H + "\n"+"L = " + L
+ "\n"+"C ",
colorBlack, styleCandle);

if (bDraw) {
Plot(MA(C, 21), "21 bar MA", colorAqua,
styleLine+styleNoRescale+styleNoLabel);
Plot(MA(C, 55), "55 bar MA", colorGreen,
styleLine+styleNoRescale+styleNoLabel);
//Plot(MA(C, 233), "233 bar MA", colorDarkRed,
// styleLine+styleNoRescale+styleNoLabel);
}

// -- Create 0-initialized arrays the size of barcount
aHPivs = H - H;
aLPivs = L - L;
aHPivHighs = H - H;
aLPivLows = L - L;
aHPivIdxs = H - H;
aLPivIdxs = L - L;
aAddedHPivs = H - H;
aAddedLPivs = L - L;
aLegVol = H - H;
aRetrcVol = H - H;

nHPivs = 0;
nLPivs = 0;

lastHPIdx = 0;
lastLPIdx = 0;
lastHPH = 0;
lastLPL = 0;
curPivBarIdx = 0;

// -- looking back from the current bar, how many bars
// back were the hhv and llv values of the previous
// n bars, etc.?
aHHVBars = HHVBars(H, nBars);
aLLVBars = LLVBars(L, nBars);
aHHV = HHV(H, nBars);
aLLV = LLV(L, nBars);

// -- Initialize value of curTrend
nLastVisBar = LastValue(
Highest(IIf(Status("barvisible"), BarIndex(), 0)));

curBar = IIf(nlastVisBar > 0 AND bUseLastVis, nlastVisBar,
IIf(Status("action")==4 AND nExploreBarIdx > 0, nExploreBarIdx,
LastValue(BarIndex())));

curTrend = "";
if (aLLVBars[curBar] < aHHVBars[curBar])
curTrend = "D";
else
curTrend = "U";

// -- Loop through bars. Search for
// entirely array-based approach
// in version
/* *******************
Find main pivots
******************* */

// -- Make sure there are enough bars!
if (curBar >= nNumBarsToScan) {
for (i=0; i<nNumBarsToScan; i++) {

// -- value of curBar dependent on two parameters
curBar = IIf(nlastVisBar > 0 AND bUseLastVis,
nlastVisBar-i,
IIf(Status("action")==4 AND nExploreBarIdx > 0,
nExploreBarIdx-i,
LastValue(BarIndex())-i));

// -- Have we identified a pivot? If trend is down...
if (aLLVBars[curBar] < aHHVBars[curBar]) {

// ... and had been up, this is a trend change
if (curTrend == "U") {
curTrend = "D";
// -- Capture pivot information
curPivBarIdx = curBar - aLLVBars[curBar];
aLPivs[curPivBarIdx] = 1;
aLPivLows[nLPivs] = L[curPivBarIdx];
aLPivIdxs[nLPivs] = curPivBarIdx;
nLPivs++;
}
// -- or current trend is up
} else {
if (curTrend == "D") {
curTrend = "U";
curPivBarIdx = curBar - aHHVBars[curBar];
aHPivs[curPivBarIdx] = 1;
aHPivHighs[nHPivs] = H[curPivBarIdx];
aHPivIdxs[nHPivs] = curPivBarIdx;
nHPivs++;
}
// -- If curTrend is up...else...
}

// -- loop through bars
}
}
/* *******************
Found main pivots
******************* */

/* *************************
Finding missed pivot(s)
************************* */

// -- Start at last bar. Reestablish curBar
curBar =
IIf(nlastVisBar > 0 AND bUseLastVis,
nlastVisBar,
IIf(Status("action")==4 AND nExploreBarIdx > 0,
nExploreBarIdx,
LastValue(BarIndex()))
);

// -- Make sure I found at least two of each above.
if (nHPivs >= 2 AND nLPivs >= 2) {

lastLPIdx = aLPivIdxs[0];
lastLPL = aLPivLows[0];

lastHPIdx = aHPivIdxs[0];
lastHPH = aHPivHighs[0];

nLastHOrLPivIdx = Max(lastLPIdx, lastHPIdx);

nAddPivsRng = curBar - nLastHOrLPivIdx;
aLLVAfterLastPiv = LLV(L, nAddPivsRng);
nLLVAfterLastPiv = aLLVAfterLastPiv[curBar];
aLLVIdxAfterLastPiv = LLVBars(L, nAddPivsRng);
nLLVIdxAfterLastPiv = curBar - aLLVIdxAfterLastPiv[curBar];
aHHVAfterLastPiv = HHV(H, nAddPivsRng);
nHHVAfterLastPiv = aHHVAfterLastPiv[curBar];
aHHVIdxAfterLastPiv = HHVBars(H, nAddPivsRng);
nHHVIdxAfterLastPiv = curBar - aHHVIdxAfterLastPiv[curBar];

// -- Later want to add last high pivot only if
// not in buy mode from last and still in trade

/*
Note - I'm only interested in adding pivots if I'm in
a higher-highs or lower-lows scenario
*/


// -- OK, let's start where the last high pivot occurs after the
// last Low pivot
if (lastHPIdx > lastLPIdx) {

/* There are at least two possibilities here. One is that
the previous high was higher, indicating that this is a
possible short retracement or one in the making.
The other is that the previous high was lower, indicating
that this is a possible long retracement in the working.
However, both depend on opposing pivots. E.g., if I find
higher highs, what if I have lower lows?

If the highs are descending, then I can consider:
- a lower low, and leave it at that
- a higher high and higher low
- a lower low and another lower high
*/
if (aHPivHighs[0] < aHPivHighs[1]) {

if (nLLVAfterLastPiv < aLPivLows[0] AND
(nLLVIdxAfterLastPiv - lastHPIdx - 1) >= nMinBarsBtwPivs
AND nLLVIdxAfterLastPiv != curBar ) {

// -- OK, we'll add this as a pivot.
// Mark it for plotting...
aLPivs[nLLVIdxAfterLastPiv] = 1;
aAddedLPivs[nLLVIdxAfterLastPiv] = 1;

// ...and then rearrange s in the
// pivot information arrays
for (j=0; j<nLPivs; j++) {
aLPivLows[nLPivs-j] = aLPivLows[nLPivs-(j+1)];
aLPivIdxs[nLPivs-j] = aLPivIdxs[nLPivs-(j+1)];
}
aLPivLows[0] = nLLVAfterLastPiv;
aLPivIdxs[0] = nLLVIdxAfterLastPiv;
nLPivs++;

// -- Test whether to add piv given last piv is high
// AND we have lower highs
}

// -- Here, the last piv is a high piv, and we have
// higher-highs. The most likely addition is a
// Low piv that is a retracement.
} else {

if (nLLVAfterLastPiv > aLPivLows[0] AND
(nLLVIdxAfterLastPiv - lastHPIdx - 1) >= nMinBarsBtwPivs
AND nLLVIdxAfterLastPiv != curBar ) {

// -- OK, we'll add this as a pivot.
// Mark it for plotting...
aLPivs[nLLVIdxAfterLastPiv] = 1;
aAddedLPivs[nLLVIdxAfterLastPiv] = 1;

// ...and then rearrange s in the
// pivot information arrays
for (j=0; j<nLPivs; j++) {
aLPivLows[nLPivs-j] = aLPivLows[nLPivs-(j+1)];
aLPivIdxs[nLPivs-j] = aLPivIdxs[nLPivs-(j+1)];
}
aLPivLows[0] = nLLVAfterLastPiv;
aLPivIdxs[0] = nLLVIdxAfterLastPiv;
nLPivs++;

// -- Test whether to add piv given last piv is high
// AND we have lower highs
}
// -- The last piv is a high and we have higher highs
// OR lower highs
}

/* ****************************************************************
Still finding missed pivot(s). Here, the last piv is a low piv.
**************************************************************** */
} else {

// -- First case, lower highs
if (aHPivHighs[0] < aHPivHighs[1]) {

if (nHHVAfterLastPiv < aHPivHighs[0] AND
(nHHVIdxAfterLastPiv - lastLPIdx - 1) >= nMinBarsBtwPivs
AND nHHVIdxAfterLastPiv != curBar ) {

// -- OK, we'll add this as a pivot.
// Mark that for plotting
aHPivs[nHHVIdxAfterLastPiv] = 1;
aAddedHPivs[nHHVIdxAfterLastPiv] = 1;

// ...and then rearrange s in the
// pivot information arrays
for (j=0; j<nHPivs; j++) {
aHPivHighs[nHPivs-j] = aHPivHighs[nHPivs-(j+1)];
aHPivIdxs[nHPivs-j] = aHPivIdxs[nhPivs-(j+1)];
}
aHPivHighs[0] = nHHVAfterLastPiv;
aHPivIdxs[0] = nHHVIdxAfterLastPiv;
nHPivs++;

// -- Test whether to add piv given last piv is high
// AND we have lower highs
}

// -- Second case when last piv is a low piv, higher highs
// Most likely addition is high piv that is a retracement.
// Considering adding a high piv as long as it is higher
} else {

// -- Where I have higher highs,
if (nHHVAfterLastPiv > aHPivHighs[0] AND
(nHHVIdxAfterLastPiv - lastLPIdx - 1) >= nMinBarsBtwPivs
AND nHHVIdxAfterLastPiv != curBar ) {

// -- OK, we'll add this as a pivot.
// Mark it for plotting...
aHPivs[nHHVIdxAfterLastPiv] = 1;
aAddedHPivs[nHHVIdxAfterLastPiv] = 1;

// ...and then rearrange s in the
// pivot information arrays
for (j=0; j<nHPivs; j++) {
aHPivHighs[nHPivs-j] = aHPivHighs[nHPivs-(j+1)];
aHPivIdxs[nHPivs-j] = aHPivIdxs[nhPivs-(j+1)];
}
aHPivHighs[0] = nHHVAfterLastPiv;
aHPivIdxs[0] = nHHVIdxAfterLastPiv;
nHPivs++;

// -- Test whether to add piv given last piv is high
// AND we have lower highs
}

}

}

// -- If there are at least two of each
}

/* ****************************************
// -- Done with finding pivots
***************************************** */

if (bDraw) {

// -- OK, let's plot the pivots using arrows
PlotShapes(
IIf(aHPivs==1, shapeDownArrow, shapeNone),
colorRed, 0, High, Offset=-15);
PlotShapes(
IIf(aAddedHPivs==1, shapeDownArrow, shapeNone),
colorDarkRed, 0, High, Offset=-15);
PlotShapes(
IIf(aLPivs==1, shapeUpArrow , shapeNone),
colorGreen, 0, Low, Offset=-15);
PlotShapes(
IIf(aAddedLPivs==1, shapeUpArrow , shapeNone),
colorDarkGreen, 0, Low, Offset=-15);
}

/* ****************************************
// -- Done with discovering and plotting pivots
***************************************** */

// -- I'm going to want to look for possible retracement
risk = 0;
profInc = 0;
nLeg0Pts = 0;
nLeg0Bars = 0;
nLeg0Vol = 0;
nLeg1Pts = 0;
nLeg1Bars = 0;
nLeg1Vol = 0;
nLegBarsDiff = 0;
nRtrc0Pts = 0;
nRtrc0Bars = 0;
nRtrc0Vol = 0;
nRtrc1Pts = 0;
nRtrc1Bars = 0;
nRtrc1Vol = 0;

minRtrc = 0;
maxRtrc = 0;
minLine = 0;
maxLine = 0;
triggerLine = 0;
firstProfitLine = 0;
triggerInc = 0;
triggerPrc = 0;
firstProfitPrc = 0;
retrcPrc = 0;
retrcBar = 0;
retrcBarIdx = 0;
retrcRng = 0;
aRetrcPrc = H-H;
aRetrcPrcBars = H-H;
aRetrcClose = C;
retrcClose = 0;

// -- Do TCZ calcs. Arrangement of pivs very specific
// for this setup.
if (nHPivs >= 2 AND
nLPivs >=2 AND
aHPivHighs[0] > aHPivHighs[1] AND
aLPivLows[0] > aLPivLows[1]) {

tcz500 =
(aHPivHighs[0] -
(.5 * (aHPivHighs[0] - aLPivLows[1])));

tcz618 =
(aHPivHighs[0] -
(.618 * (aHPivHighs[0] - aLPivLows[1])));

tcz786 =
(aHPivHighs[0] -
(.786 * (aHPivHighs[0] - aLPivLows[0])));

retrcRng = curBar - aHPivIdxs[0];
aRetrcPrc = LLV(L, retrcRng);
retrcPrc = aRetrcPrc[curBar];
aRetrcPrcBars = LLVBars(L, retrcRng);
retrcBarIdx = curBar - aRetrcPrcBars[curBar];
retrcClose = aRetrcClose[retrcBarIdx];

// -- bTCZLong setup?
bTCZLong = (

// -- Are retracement levels arranged in
// tcz order?
tcz500 >= (tcz786 * (1 - tczTolerance))
AND
// .681 is below .786 for long setups
tcz618 <= (tcz786 * (1 + tczTolerance))
AND

// -- Is the low in the tcz range
// -- Is the close >= low of tcz range
// and low <= high of tcz range
retrcClose >= ((1 - retrcTolerance) * tcz618)
AND
retrcPrc <= ((1 + retrcTolerance) * tcz500)
);

// -- risk would be high of signal bar minus low of zone
//risk = 0;

// -- lower highs and lower lows
} else if (nHPivs >= 2 AND nLPivs >=2
AND aHPivHighs[0] < aHPivHighs[1]
AND aLPivLows[0] < aLPivLows[1]) {

tcz500 =
(aHPivHighs[1] -
(.5 * (aHPivHighs[1] - aLPivLows[0])));

tcz618 =
(aHPivHighs[0] -
(.618 * (aHPivHighs[1] - aLPivLows[0])));

tcz786 =
(aHPivHighs[0] -
(.786 * (aHPivHighs[0] - aLPivLows[0])));

retrcRng = curBar - aLPivIdxs[0];
aRetrcPrc = HHV(H, retrcRng);
retrcPrc = aRetrcPrc[curBar];
aRetrcPrcBars = HHVBars(H, retrcRng);
retrcBarIdx = curBar - aRetrcPrcBars[curBar];
retrcClose = aRetrcClose[retrcBarIdx];

bTCZShort = (
// -- Are retracement levels arranged in
// tcz order?

// .500 is below .786 for short setups
tcz500 <= (tcz786 * (1 + tczTolerance))
AND
// .681 is above .786 for short setups
tcz618 >= (tcz786 * (1 - tczTolerance))
AND

// -- Is the close <= high of tcz range
// and high >= low of tcz range
retrcClose <= ((1 + retrcTolerance) * tcz618)
AND
retrcPrc >= ((1 - retrcTolerance) * tcz500)
);

// -- Risk would be top of zone - low of signal bar
//risk = 0;
}

Filter = (bTCZShort OR bTCZLong);
AddColumn(C, "Close");
AddColumn(IIf(bTCZLong, 76, 83), "L/S", formatChar);

// **************************
// END EXPLORATION CODE
// **************************

// **************************
// BEGIN INDICATOR CODE
// **************************

// -- what will be our lookback range for the hh and ll?
nBars = Param("Number of bars", 12, 5, 40);
bTrace = Param("Include trace output", 1, 0, 1);
nNoPivsInSetup = Param("No. Pivs in Setup", 4, 3, 4, 1);
bShowTCZ = Param("Show TCZ", 1, 0, 1);
nMinBarsBtwPivs = Param("Min. number of bars btw. pivots", 1, 1, 10, 1);
nMinPctBtwPivs = Param("Min. percent diff. btw. pivots", .05, .04, .2, .01);
bLastBarCanBePiv = Param("Last bar can be a pivot", 1, 0, 1);
retrcTolerance = .01;
tczTolerance = .005;
nNumBarsToScan = 120;

// -- added from exploration version 20040204
nExploreBarIdx = 0;
nExploreDate = 0;
nCurDateNum = 0;
DN = DateNum();
DT = DateTime();

// -- key exploration variables
bTCZLong = False;
bTCZShort = False;
nAnchorPivIdx = 0;

ADX8 = ADX(8);

// 1 - INDICATOR, 2 - COMMENTARY, 3 - SCAN,
// 4 - EXPLORATION, 5 - BACKTEST / Optimize
if(Status("action")==1) {
bDraw = True;
bUseLastVis = Param("Use last visible bar", 1, 0, 1);
} else {
bDraw = False;
bUseLastVis = False;
bTrace = False;
nExploreDate = Status("rangetodate");
for (i=LastValue(BarIndex());i>=0;i--) {
nCurDateNum = DN[i];
if (nCurDateNum == nExploreDate) {
nExploreBarIdx = i;
}
}
// -- if(Status("action")==1...
}

GraphXSpace=7;

// -- basic candle chart
// -- if this appears inside if , strange
// drawing results!
PlotOHLC(Open, High, Low, Close,
"BIdx = " + BarIndex() +
"\n" + "O = " + O + "\n"+"H = "+ H + "\n"+"L = " + L
+ "\n"+"C ",
colorBlack, styleCandle);

if (bDraw) {
Plot(MA(C, 21), "21 bar MA", colorAqua,
styleLine+styleNoRescale+styleNoLabel);
Plot(MA(C, 55), "55 bar MA", colorGreen,
styleLine+styleNoRescale+styleNoLabel);
//Plot(MA(C, 233), "233 bar MA", colorDarkRed,
// styleLine+styleNoRescale+styleNoLabel);
}

// -- Create 0-initialized arrays the size of barcount
aHPivs = H - H;
aLPivs = L - L;
aHPivHighs = H - H;
aLPivLows = L - L;
aHPivIdxs = H - H;
aLPivIdxs = L - L;
aAddedHPivs = H - H;
aAddedLPivs = L - L;
aLegVol = H - H;
aRetrcVol = H - H;

nHPivs = 0;
nLPivs = 0;

lastHPIdx = 0;
lastLPIdx = 0;
lastHPH = 0;
lastLPL = 0;
curPivBarIdx = 0;

// -- looking back from the current bar, how many bars
// back were the hhv and llv values of the previous
// n bars, etc.?
aHHVBars = HHVBars(H, nBars);
aLLVBars = LLVBars(L, nBars);
aHHV = HHV(H, nBars);
aLLV = LLV(L, nBars);

// -- Initialize value of curTrend
nLastVisBar = LastValue(
Highest(IIf(Status("barvisible"), BarIndex(), 0)));

curBar = IIf(nlastVisBar > 0 AND bUseLastVis, nlastVisBar,
IIf(Status("action")==4 AND nExploreBarIdx > 0, nExploreBarIdx,
LastValue(BarIndex())));

curTrend = "";
if (aLLVBars[curBar] < aHHVBars[curBar])
curTrend = "D";
else
curTrend = "U";

// -- Loop through bars. Search for
// entirely array-based approach
// in version
/* *******************
Find main pivots
******************* */

// -- Make sure there are enough bars!
if (curBar >= nNumBarsToScan) {
for (i=0; i<nNumBarsToScan; i++) {

// -- value of curBar dependent on two parameters
curBar = IIf(nlastVisBar > 0 AND bUseLastVis,
nlastVisBar-i,
IIf(Status("action")==4 AND nExploreBarIdx > 0,
nExploreBarIdx-i,
LastValue(BarIndex())-i));

// -- Have we identified a pivot? If trend is down...
if (aLLVBars[curBar] < aHHVBars[curBar]) {

// ... and had been up, this is a trend change
if (curTrend == "U") {
curTrend = "D";
// -- Capture pivot information
curPivBarIdx = curBar - aLLVBars[curBar];
aLPivs[curPivBarIdx] = 1;
aLPivLows[nLPivs] = L[curPivBarIdx];
aLPivIdxs[nLPivs] = curPivBarIdx;
nLPivs++;
}
// -- or current trend is up
} else {
if (curTrend == "D") {
curTrend = "U";
curPivBarIdx = curBar - aHHVBars[curBar];
aHPivs[curPivBarIdx] = 1;
aHPivHighs[nHPivs] = H[curPivBarIdx];
aHPivIdxs[nHPivs] = curPivBarIdx;
nHPivs++;
}
// -- If curTrend is up...else...
}

// -- loop through bars
}
}
/* *******************
Found main pivots
******************* */

/* *************************
Finding missed pivot(s)
************************* */

// -- Start at last bar. Reestablish curBar
curBar =
IIf(nlastVisBar > 0 AND bUseLastVis,
nlastVisBar,
IIf(Status("action")==4 AND nExploreBarIdx > 0,
nExploreBarIdx,
LastValue(BarIndex()))
);

// -- Make sure I found at least two of each above.
if (nHPivs >= 2 AND nLPivs >= 2) {

lastLPIdx = aLPivIdxs[0];
lastLPL = aLPivLows[0];

lastHPIdx = aHPivIdxs[0];
lastHPH = aHPivHighs[0];

nLastHOrLPivIdx = Max(lastLPIdx, lastHPIdx);

nAddPivsRng = curBar - nLastHOrLPivIdx;
aLLVAfterLastPiv = LLV(L, nAddPivsRng);
nLLVAfterLastPiv = aLLVAfterLastPiv[curBar];
aLLVIdxAfterLastPiv = LLVBars(L, nAddPivsRng);
nLLVIdxAfterLastPiv = curBar - aLLVIdxAfterLastPiv[curBar];
aHHVAfterLastPiv = HHV(H, nAddPivsRng);
nHHVAfterLastPiv = aHHVAfterLastPiv[curBar];
aHHVIdxAfterLastPiv = HHVBars(H, nAddPivsRng);
nHHVIdxAfterLastPiv = curBar - aHHVIdxAfterLastPiv[curBar];

// -- Later want to add last high pivot only if
// not in buy mode from last and still in trade

/*
Note - I'm only interested in adding pivots if I'm in
a higher-highs or lower-lows scenario
*/


// -- OK, let's start where the last high pivot occurs after the
// last Low pivot
if (lastHPIdx > lastLPIdx) {

/* There are at least two possibilities here. One is that
the previous high was higher, indicating that this is a
possible short retracement or one in the making.
The other is that the previous high was lower, indicating
that this is a possible long retracement in the working.
However, both depend on opposing pivots. E.g., if I find
higher highs, what if I have lower lows?

If the highs are descending, then I can consider:
- a lower low, and leave it at that
- a higher high and higher low
- a lower low and another lower high
*/
if (aHPivHighs[0] < aHPivHighs[1]) {

if (nLLVAfterLastPiv < aLPivLows[0] AND
(nLLVIdxAfterLastPiv - lastHPIdx - 1) >= nMinBarsBtwPivs
AND nLLVIdxAfterLastPiv != curBar ) {

// -- OK, we'll add this as a pivot.
// Mark it for plotting...
aLPivs[nLLVIdxAfterLastPiv] = 1;
aAddedLPivs[nLLVIdxAfterLastPiv] = 1;

// ...and then rearrange s in the
// pivot information arrays
for (j=0; j<nLPivs; j++) {
aLPivLows[nLPivs-j] = aLPivLows[nLPivs-(j+1)];
aLPivIdxs[nLPivs-j] = aLPivIdxs[nLPivs-(j+1)];
}
aLPivLows[0] = nLLVAfterLastPiv;
aLPivIdxs[0] = nLLVIdxAfterLastPiv;
nLPivs++;

// -- Test whether to add piv given last piv is high
// AND we have lower highs
}

// -- Here, the last piv is a high piv, and we have
// higher-highs. The most likely addition is a
// Low piv that is a retracement.
} else {

if (nLLVAfterLastPiv > aLPivLows[0] AND
(nLLVIdxAfterLastPiv - lastHPIdx - 1) >= nMinBarsBtwPivs
AND nLLVIdxAfterLastPiv != curBar ) {

// -- OK, we'll add this as a pivot.
// Mark it for plotting...
aLPivs[nLLVIdxAfterLastPiv] = 1;
aAddedLPivs[nLLVIdxAfterLastPiv] = 1;

// ...and then rearrange s in the
// pivot information arrays
for (j=0; j<nLPivs; j++) {
aLPivLows[nLPivs-j] = aLPivLows[nLPivs-(j+1)];
aLPivIdxs[nLPivs-j] = aLPivIdxs[nLPivs-(j+1)];
}
aLPivLows[0] = nLLVAfterLastPiv;
aLPivIdxs[0] = nLLVIdxAfterLastPiv;
nLPivs++;

// -- Test whether to add piv given last piv is high
// AND we have lower highs
}
// -- The last piv is a high and we have higher highs
// OR lower highs
}

/* ****************************************************************
Still finding missed pivot(s). Here, the last piv is a low piv.
**************************************************************** */
} else {

// -- First case, lower highs
if (aHPivHighs[0] < aHPivHighs[1]) {

if (nHHVAfterLastPiv < aHPivHighs[0] AND
(nHHVIdxAfterLastPiv - lastLPIdx - 1) >= nMinBarsBtwPivs
AND nHHVIdxAfterLastPiv != curBar ) {

// -- OK, we'll add this as a pivot.
// Mark that for plotting
aHPivs[nHHVIdxAfterLastPiv] = 1;
aAddedHPivs[nHHVIdxAfterLastPiv] = 1;

// ...and then rearrange s in the
// pivot information arrays
for (j=0; j<nHPivs; j++) {
aHPivHighs[nHPivs-j] = aHPivHighs[nHPivs-(j+1)];
aHPivIdxs[nHPivs-j] = aHPivIdxs[nhPivs-(j+1)];
}
aHPivHighs[0] = nHHVAfterLastPiv;
aHPivIdxs[0] = nHHVIdxAfterLastPiv;
nHPivs++;

// -- Test whether to add piv given last piv is high
// AND we have lower highs
}

// -- Second case when last piv is a low piv, higher highs
// Most likely addition is high piv that is a retracement.
// Considering adding a high piv as long as it is higher
} else {

// -- Where I have higher highs,
if (nHHVAfterLastPiv > aHPivHighs[0] AND
(nHHVIdxAfterLastPiv - lastLPIdx - 1) >= nMinBarsBtwPivs
AND nHHVIdxAfterLastPiv != curBar ) {

// -- OK, we'll add this as a pivot.
// Mark it for plotting...
aHPivs[nHHVIdxAfterLastPiv] = 1;
aAddedHPivs[nHHVIdxAfterLastPiv] = 1;

// ...and then rearrange s in the
// pivot information arrays
for (j=0; j<nHPivs; j++) {
aHPivHighs[nHPivs-j] = aHPivHighs[nHPivs-(j+1)];
aHPivIdxs[nHPivs-j] = aHPivIdxs[nhPivs-(j+1)];
}
aHPivHighs[0] = nHHVAfterLastPiv;
aHPivIdxs[0] = nHHVIdxAfterLastPiv;
nHPivs++;

// -- Test whether to add piv given last piv is high
// AND we have lower highs
}

}

}

// -- If there are at least two of each
}

/* ****************************************
// -- Done with finding pivots
***************************************** */

if (bDraw) {

// -- OK, let's plot the pivots using arrows
PlotShapes(
IIf(aHPivs==1, shapeDownArrow, shapeNone),
colorRed, 0, High, Offset=-15);
PlotShapes(
IIf(aAddedHPivs==1, shapeDownArrow, shapeNone),
colorDarkRed, 0, High, Offset=-15);
PlotShapes(
IIf(aLPivs==1, shapeUpArrow , shapeNone),
colorGreen, 0, Low, Offset=-15);
PlotShapes(
IIf(aAddedLPivs==1, shapeUpArrow , shapeNone),
colorDarkGreen, 0, Low, Offset=-15);
}

/* ****************************************
// -- Done with discovering and plotting pivots
***************************************** */

// -- I'm going to want to look for possible retracement
risk = 0;
profInc = 0;
nLeg0Pts = 0;
nLeg0Bars = 0;
nLeg0Vol = 0;
nLeg1Pts = 0;
nLeg1Bars = 0;
nLeg1Vol = 0;
nLegBarsDiff = 0;
nRtrc0Pts = 0;
nRtrc0Bars = 0;
nRtrc0Vol = 0;
nRtrc1Pts = 0;
nRtrc1Bars = 0;
nRtrc1Vol = 0;

minRtrc = 0;
maxRtrc = 0;
minLine = 0;
maxLine = 0;
triggerLine = 0;
firstProfitLine = 0;
triggerInc = 0;
triggerPrc = 0;
firstProfitPrc = 0;
retrcPrc = 0;
retrcBar = 0;
retrcBarIdx = 0;
retrcRng = 0;
aRetrcPrc = H-H;
aRetrcPrcBars = H-H;
aRetrcClose = C;
retrcClose = 0;

// -- Do TCZ calcs. Arrangement of pivs very specific
// for this setup.
if (nHPivs >= 2 AND
nLPivs >=2 AND
aHPivHighs[0] > aHPivHighs[1] AND
aLPivLows[0] > aLPivLows[1]) {

tcz500 =
(aHPivHighs[0] -
(.5 * (aHPivHighs[0] - aLPivLows[1])));

tcz618 =
(aHPivHighs[0] -
(.618 * (aHPivHighs[0] - aLPivLows[1])));

tcz786 =
(aHPivHighs[0] -
(.786 * (aHPivHighs[0] - aLPivLows[0])));

retrcRng = curBar - aHPivIdxs[0];
aRetrcPrc = LLV(L, retrcRng);
aRetrcPrcBars = LLVBars(L, retrcRng);

retrcPrc = aRetrcPrc[curBar];
retrcBarIdx = curBar - aRetrcPrcBars[curBar];
retrcClose = aRetrcClose[retrcBarIdx];

// -- bTCZLong setup?
bTCZLong = (

// -- Are retracement levels arranged in
// tcz order?

// .500 is above .786 for long setups
tcz500 >= (tcz786 * (1 - tczTolerance))
AND
// .681 is below .786 for long setups
tcz618 <= (tcz786 * (1 + tczTolerance))
AND

// -- Is the low in the tcz range
// -- Is the close >= low of tcz range
// and low <= high of tcz range
retrcClose >= ((1 - retrcTolerance) * tcz618)
AND
retrcPrc <= ((1 + retrcTolerance) * tcz500)
);

// -- risk would be high of signal bar minus low of zone
//risk = 0;

// -- lower highs and lower lows
} else if (nHPivs >= 2 AND nLPivs >=2
AND aHPivHighs[0] < aHPivHighs[1]
AND aLPivLows[0] < aLPivLows[1]) {

tcz500 =
(aHPivHighs[1] -
(.5 * (aHPivHighs[1] - aLPivLows[0])));

tcz618 =
(aHPivHighs[0] -
(.618 * (aHPivHighs[1] - aLPivLows[0])));

tcz786 =
(aHPivHighs[0] -
(.786 * (aHPivHighs[0] - aLPivLows[0])));

retrcRng = curBar - aLPivIdxs[0];
aRetrcPrc = HHV(H, retrcRng);
retrcPrc = aRetrcPrc[curBar];
aRetrcPrcBars = HHVBars(H, retrcRng);
retrcBarIdx = curBar - aRetrcPrcBars[curBar];
retrcClose = aRetrcClose[retrcBarIdx];

bTCZShort = (
// -- Are retracement levels arranged in
// tcz order?

// .500 is below .786 for short setups
tcz500 <= (tcz786 * (1 + tczTolerance))
AND
// .681 is above .786 for short setups
tcz618 >= (tcz786 * (1 - tczTolerance))
AND

// -- Is the close <= high of tcz range
// and high >= low of tcz range
retrcClose <= ((1 + retrcTolerance) * tcz618)
AND
retrcPrc >= ((1 - retrcTolerance) * tcz500)
);

// -- Risk would be top of zone - low of signal bar
//risk = 0;
}

// -- Show zone if present
if (bTCZShort OR bTCZLong) {

// -- Be prepared to see symmetry
if (bTCZShort) {
if (aLPivIdxs[0] > aHPivIdxs[0]) {
// -- Valuable, useful symmetry information
nRtrc0Pts = aHPivHighs[0] - aLPivLows[1];
nRtrc0Bars = aHPivIdxs[0] - aLPivIdxs[1] + 1;
nRtrc1Pts = retrcPrc - aLPivLows[0];
nRtrc1Bars = retrcBarIdx - aLPivIdxs[0] + 1;
} else {
nRtrc0Pts = aHPivHighs[1] - aLPivLows[1];
nRtrc0Bars = aHPivIdxs[1] - aLPivIdxs[1] + 1;
nRtrc1Pts = aHPivHighs[0] - aLPivLows[0];
nRtrc1Bars = aHPivIdxs[0] - aLPivIdxs[0] + 1;
}
} else { // bLongSetup
if (aLPivIdxs[0] > aHPivIdxs[0]) {
nRtrc0Pts = aHPivHighs[0] - aLPivLows[1];
nRtrc0Bars = aHPivIdxs[0] - aLPivIdxs[1] + 1;
nRtrc1Pts = retrcPrc - aLPivLows[0];
nRtrc1Bars = retrcBarIdx - aLPivIdxs[0] + 1;
} else {
nRtrc0Pts = aHPivHighs[1] - aLPivLows[0];
nRtrc0Bars = aLPivIdxs[0] - aHPivIdxs[1] + 1;
nRtrc1Pts = aHPivHighs[0] - aLPivLows[0];
nRtrc1Bars = aLPivIdxs[0] - aHPivIdxs[0] + 1;
}
}

if (bShowTCZ) {
Plot(
LineArray( IIf(bTCZLong, aHPivIdxs[0], aLPivIdxs[0]),
tcz500, curBar, tcz500 , 0),
"tcz500", colorPaleBlue, styleLine);
Plot(
LineArray( IIf(bTCZLong, aHPivIdxs[0], aLPivIdxs[0]),
tcz618, curBar, tcz618, 0),
"tcz618", colorPaleBlue, styleLine);
Plot(
LineArray( IIf(bTCZLong, aHPivIdxs[0], aLPivIdxs[0]),
tcz786, curBar, tcz786, 0),
"tcz786", colorTurquoise, styleLine);
}

// -- if (bShowTCZ)
}

if (bDraw) {
Title = Name() + " (" + StrLeft(FullName(), 10) +
") ATR: " + NumToStr(ATR(1), 4.2) + " ( " +
NumToStr((C - Ref(C, -1)), 4.2) + " / " +
NumToStr((((C - Ref(C, -1)) / Ref(C, -1)) * 100), 2.1) + "% ) " +
WriteVal( SelectedValue( DateTime() ), formatDateTime) +
" \nO: " + Open +
", \nH: " + High +
", \nL: " + Low +
", \nC: " + Close + ", \n" +
// "Risk: " + WriteVal(risk, 2.1) + "% \n" +
"Rtrc 0/1 Pts: " + WriteVal(nRtrc0Pts, 2.1) + "/" +
WriteVal(nRtrc1Pts, 2.1) + " \n" +
"Rtrc 0/1 Bars: " + WriteVal(nRtrc0Bars, 2.0) + "/" +
WriteVal(nRtrc1Bars, 2.0);
}

// **************************
// END INDICATOR CODE
// **************************



رد مع اقتباس
قديم 09-05-2015, 04:31 PM
  المشاركه #1772

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

تاريخ التسجيل: Feb 2007
المشاركات: 350
صقار متهور غير متواجد حالياً  

السلام عليكم ورحمة الله وبركاته

أخواني عندي النسخه 5.80
البيانات اليومية تجي ناقصة شهر اما اللحظية ممتازة واقف عندي على 30/3 مدري ويش السالفة ممكن حل اعاني منه في هذه النقطة فقط ..
برنامج التداول الاتجاه



رد مع اقتباس
قديم 09-05-2015, 06:44 PM
  المشاركه #1773

عضو هوامير المؤسس

تاريخ التسجيل: Jul 2005
المشاركات: 2,316
almasdar غير متواجد حالياً  

السلام عليكم
من عنده كراك فعال لنسخه 5.80 يفزع لنا خاص



رد مع اقتباس
قديم 09-05-2015, 09:16 PM
  المشاركه #1774

كاتب قدير

تاريخ التسجيل: Jul 2006
المشاركات: 36,145
ابو غيداء غير متواجد حالياً  

اخي ابو نواف
اخينا دوبلكس اخبر مني
موضوعه مثبت بالقسم من الممكن تسأله ليفيدك

اما اصدار البرنامج 5.80
لم اجربه باشوف الموقع واحاول انزله



رد مع اقتباس
قديم 16-05-2015, 04:02 AM
  المشاركه #1775

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

تاريخ التسجيل: Aug 2010
المشاركات: 3,401
(عاشق البورصة) غير متواجد حالياً  

رد: مشاكل وحلول ومعادلات الايمي بروكر +AmiBroker Pro



اريد الحل



رد مع اقتباس
قديم 16-05-2015, 05:43 PM
  المشاركه #1776

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

تاريخ التسجيل: Aug 2010
المشاركات: 339
فـواز العنزي غير متواجد حالياً  

السلام عليكم

مطلوب كراك فعال نسخه 5.90

اذا تكرمتم ( على الخاص )



رد مع اقتباس


الكلمات الدلالية (Tags)
مشاكل, ومعادلات, وحلول, الايمي, بروكر, pro

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

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

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

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



03:49 PM