قديم 06-10-2014, 12:36 AM
  المشاركه #49

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

تاريخ التسجيل: Oct 2013
المشاركات: 503
DABL@ غير متواجد حالياً  

الاخ كشكول. قصدك زي كذا





_SECTION_BEGIN("Linear_Regression_Line_w__Std_Deviation_Channels");
// Linear Regression Line with 2 Standard Deviation Channels Plotted Above and Below
// Written by Patrick Hargus, with critical hints from Marcin Gorzynski, Amibroker.com Technical Support
// Designed for use with AB 4.63 beta and above, using drag and drop feature.
// Permits plotting a linear regression line of any price field available on the chart for a period determined by the user.
// 2 Channels, based on a standard deviation each determined by the user, are plotted above and below the linear regression line.
// A look back feature is also provided for examining how the indicator would have appeared on a chart X periods in the past.


P = ParamField("Price field",-1);
Daysback = Param("Period for Liner Regression Line",21,1,240,1);
shift = Param("Look back period",0,0,240,1);

// =============================== Math Formula =============================================================

x = Cum(1);
lastx = LastValue( x ) - shift;
aa = LastValue( Ref(LinRegIntercept( p, Daysback), -shift) );
bb = LastValue( Ref(LinRegSlope( p, Daysback ), -shift) );
y = Aa + bb * ( x - (Lastx - DaysBack +1 ) );


// ==================Plot the Linear Regression Line ==========================================================


LRColor = ParamColor("LR Color", colorLightGrey );
LRStyle = ParamStyle("LR Style");

LRLine = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y, Null );
Plot( LRLine , "LinReg", LRCOLOR, LRSTYLE ); // styleDots );

// ========================== Plot 1st SD Channel ===============================================================

SDP = Param("Standard Deviation", 1.618, 0, 6, 0.1);
SD = SDP/2;
Plot(C, "", IIf(O>=C, colorRed, colorBrightGreen), styleCandle);

width = LastValue( Ref(SD*StDev(p, Daysback),-shift) ); // THIS IS WHERE THE WIDTH OF THE CHANELS IS SET
SDU = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y+width , Null ) ;
SDL = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y-width , Null ) ;
SDP2 = Param("2d Standard Deviation", 3.14, 0, 6, 0.1);
SD2 = SDP2/2;

width2 = LastValue( Ref(SD2*StDev(p, Daysback),-shift) ); // THIS IS WHERE THE WIDTH OF THE CHANELS IS SET
SDU2 = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y+width2 , Null ) ;
SDL2 = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y-width2 , Null ) ;

SDColor2 = ParamColor("2 SD Color", colorRed );
SDStyle2 = ParamStyle("2 SD Style");

SDColor = ParamColor("SD Color", colorBrightGreen );
SDStyle = ParamStyle("SD Style");

Plot( SDU , "Upper Lin Reg", SDColor,SDStyle );
Plot( SDL , "Lower Lin Reg", SDColor,SDStyle );
Title = "{{VALUES}}"+StrFormat("nSlope=(%.2f)",bb);
// ========================== Plot 2d SD Channel ===============================================================


Plot( SDU2 , "Upper Lin Reg", SDColor2,SDStyle2 );
Plot( SDL2 , "Lower Lin Reg", SDColor2,SDStyle2 );
PlotOHLC(sdu2,sdu2,sdu,sdu,"",colorDarkRed,styleCloud+styleNoLabel);
PlotOHLC(sdl2,sdl2,sdl,sdl,"",colorDarkRed,styleCloud+styleNoLabel);
PlotOHLC(LRLine ,sdl2,LRLine ,sdl,"",colorDarkGreen,styleCloud+styleNoLabel);
PlotOHLC(LRLine ,sdu2,LRLine ,sdu,"",colorDarkGreen,styleCloud+styleNoLabel);

// ============================ End Indicator Code ==============================================================
Con = IIf(C > sdl2 AND C < sdu2, 1, 0);
if(StrToNum(NumToStr(Con)) AND bb > 0)
bgColor = ColorRGB(0,66, 2);
else
bgColor = ColorRGB(66, 2, 0);
SetChartBkGradientFill( colorBlack, bgColor);
_SECTION_END();







لتنبيه المعادله ليس لي



رد مع اقتباس
 
 

قديم 06-10-2014, 01:02 AM
  المشاركه #50

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

تاريخ التسجيل: Jan 2011
المشاركات: 440
كشكول. غير متواجد حالياً  

بيض الله وجهك.


رد مع اقتباس
قديم 06-10-2014, 01:12 AM
  المشاركه #51

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

تاريخ التسجيل: Oct 2013
المشاركات: 503
DABL@ غير متواجد حالياً  

وجهك ابيض و الله يسعدك





شوف هذا تقدر تغير الالون





_SECTION_BEGIN("Linear_Regression_Line_w__Std_Deviation_Channels");
// Linear Regression Line with 2 Standard Deviation Channels Plotted Above and Below
// Written by Patrick Hargus, with critical hints from Marcin Gorzynski, Amibroker.com Technical Support
// Designed for use with AB 4.63 beta and above, using drag and drop feature.
// Permits plotting a linear regression line of any price field available on the chart for a period determined by the user.
// 2 Channels, based on a standard deviation each determined by the user, are plotted above and below the linear regression line.
// A look back feature is also provided for examining how the indicator would have appeared on a chart X periods in the past.


P = ParamField("Price field",-1);
Daysback = Param("Period for Liner Regression Line",21,1,240,1);
shift = Param("Look back period",0,0,240,1);

// =============================== Math Formula =============================================================

x = Cum(1);
lastx = LastValue( x ) - shift;
aa = LastValue( Ref(LinRegIntercept( p, Daysback), -shift) );
bb = LastValue( Ref(LinRegSlope( p, Daysback ), -shift) );
y = Aa + bb * ( x - (Lastx - DaysBack +1 ) );


// ==================Plot the Linear Regression Line ==========================================================


LRColor = ParamColor("LR Color", colorLightGrey );
LRStyle = ParamStyle("LR Style");

LRLine = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y, Null );
Plot( LRLine , "LinReg", LRCOLOR, LRSTYLE ); // styleDots );

// ========================== Plot 1st SD Channel ===============================================================

SDP = Param("Standard Deviation", 1.618, 0, 6, 0.1);
SD = SDP/2;
Plot(C, "", IIf(O>=C, colorRed, colorBrightGreen), styleCandle);

width = LastValue( Ref(SD*StDev(p, Daysback),-shift) ); // THIS IS WHERE THE WIDTH OF THE CHANELS IS SET
SDU = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y+width , Null ) ;
SDL = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y-width , Null ) ;
SDP2 = Param("2d Standard Deviation", 3.14, 0, 6, 0.1);
SD2 = SDP2/2;

width2 = LastValue( Ref(SD2*StDev(p, Daysback),-shift) ); // THIS IS WHERE THE WIDTH OF THE CHANELS IS SET
SDU2 = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y+width2 , Null ) ;
SDL2 = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y-width2 , Null ) ;

SDColor2 = ParamColor("2 SD Color", colorRed );
SDStyle2 = ParamStyle("2 SD Style");

SDColor = ParamColor("SD Color", colorBrightGreen );
SDStyle = ParamStyle("SD Style");

Plot( SDU , "Upper Lin Reg", SDColor,SDStyle );
Plot( SDL , "Lower Lin Reg", SDColor,SDStyle );
Title = "{{VALUES}}"+StrFormat("nSlope=(%.2f)",bb);
// ========================== Plot 2d SD Channel ===============================================================


Plot( SDU2 , "Upper Lin Reg", SDColor2,SDStyle2 );
Plot( SDL2 , "Lower Lin Reg", SDColor2,SDStyle2 );
PlotOHLC(sdu2,sdu2,sdu,sdu,"",ParamColor("Color1", colorBlueGrey ),styleCloud+styleNoLabel);
PlotOHLC(sdl2,sdl2,sdl,sdl,"",ParamColor("Color2", colorBlueGrey ),styleCloud+styleNoLabel);
PlotOHLC(LRLine ,sdl2,LRLine ,sdl,"",ParamColor("Color3", colorBlueGrey ),styleCloud+styleNoLabel);
PlotOHLC(LRLine ,sdu2,LRLine ,sdu,"",ParamColor("Color4", colorBlueGrey ),styleCloud+styleNoLabel);SetChartBkColor(ParamColor("Outer panel color ",colorBlack));
SetChartBkGradientFill( ParamColor("Inner panel color upper half",colorBlack),ParamColor("Inner panel color lower half",colorBlack));

_SECTION_BEGIN("00000000000");
OpenPct = (Open - Ref(C,-1))/Ref(C,-1)*100 ;
HighPct = (H - Ref(C,-1))/Ref(C,-1)*100 ;
LowPct = (L - Ref(C,-1))/Ref(C,-1)*100 ;
ClosePct = (C - Ref(C,-1))/Ref(C,-1)*100 ;
VolPct = (V - Ref(V,-1))/Ref(V,-1)*100 ;
_N(Title =Name() + " " + FullName() + " Date: "+Date()
+WriteIf(Open>Ref(C,-1),EncodeColor(colorGreen),EncodeColor(colorRed))+" Open:"+ WriteVal( Open, 1.2 ) +" ("+WriteVal(OpenPct ,1.2) +"%)"
+WriteIf(H>Ref(C,-1),EncodeColor(colorGreen),EncodeColor(colorRed))+ " H:" + WriteVal( H , 1.2 ) +" ("+WriteVal(HighPct ,1.2) +"%)"
+WriteIf(L>Ref(C,-1),EncodeColor(colorGreen),EncodeColor(colorRed))+" L:"+ WriteVal( L, 1.2 ) +" ("+WriteVal(LowPct ,1.2) +"%)"
+WriteIf(C>Ref(C,-1),EncodeColor(colorGreen),EncodeColor(colorRed))+" C:"+ WriteVal( C, 1.2 ) +" ("+WriteVal(ClosePct ,1.2) +"%)"
+WriteIf(V>Ref(V,-1),EncodeColor(colorGreen),EncodeColor(colorRed))+" V: "+ WriteVal( V, 1.2 ) +" ("+WriteVal(VolPct ,1.2) +"%)") ;
_SECTION_END();





و بالتوفيق لجميع



رد مع اقتباس
قديم 06-10-2014, 01:47 AM
  المشاركه #52

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

تاريخ التسجيل: Oct 2013
المشاركات: 503
DABL@ غير متواجد حالياً  

الاخ كشكول.






طيب سؤال
اذا فيه قناه سعرية او مثلث abc
واريد ان يصبح داخل القناة او المثلث لون مختلف عن الشارت
كيف الطريقة ؟


هذا المعادله من نفس معادلة القناه السعريه جزء من و هو المطلوب

PlotOHLC(sdu2,sdu2,sdu,sdu,"",ParamColor("Color1", colorBlueGrey ),styleCloud+styleNoLabel);




تضيف هذا المعادله في خانة الالوان اللي هي في معادلة الاساسيه مثل القناه او المثل

الخ


هذا الجزء المهم ParamColor("Color1", colorBlueGrey )


و راح تقدر تغيير الالون


و تضليله PlotOHLC(sdu2,sdu2,sdu,sdu لزم تكتبب هذا المعادله


اتمني اني قدرت اوضح لك



و الموضوع ترا لجميع واذ فيه خطاء عندي في الشرح اتمنى التصحيح علشان


المعلومه تصل صح وهذا هو المطلوب و بالتوفيق لجميع



رد مع اقتباس
قديم 06-10-2014, 01:52 AM
  المشاركه #53

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

تاريخ التسجيل: Oct 2013
المشاركات: 503
DABL@ غير متواجد حالياً  

لتوضيح ترا التضليل يختلف من معادله الي اخر في الشروط


وقصدي PlotOHLC(sdu2,sdu2,sdu,sdu الخاصة بتضليل القناه السعريه

بس المقصد هي نفس الطريقه بس تختلف الخيارات و الشروط



رد مع اقتباس
قديم 06-10-2014, 07:33 AM
  المشاركه #54

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

تاريخ التسجيل: Apr 2010
المشاركات: 2,340
مالك _ القلوب غير متواجد حالياً  

السلام عليكم.
ممكن معادله لموجات اليوت لو سمحت .



رد مع اقتباس
قديم 06-10-2014, 01:03 PM
  المشاركه #55

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

تاريخ التسجيل: Jan 2011
المشاركات: 440
كشكول. غير متواجد حالياً  

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


وقصدي plotohlc(sdu2,sdu2,sdu,sdu الخاصة بتضليل القناه السعريه

بس المقصد هي نفس الطريقه بس تختلف الخيارات و الشروط


كلامك صحيح بالاعتماد على اربع نقاط


ولكن ما أردته هو تلوين ما بين ثلاث نقاط فقط

بمعنى تلوين بين
a-b-c
ولك احترامي



رد مع اقتباس
قديم 11-10-2014, 03:25 AM
  المشاركه #56

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

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

سلام عليكم
صبحكم بالخير
فيه مؤشر الاستوكاستك البطيئ والسريع؟
stochastic momentum index



رد مع اقتباس
قديم 13-10-2014, 03:52 PM
  المشاركه #57

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

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

اقتباس:
المشاركة الأصلية كتبت بواسطة douplexx مشاهدة المشاركة
بطل الهجه نور قائد النمور أبوعبيّد khloudus fhfh1 almasdar


الاخ khloudus




_section_begin("00000000000");
openpct = (open - ref(c,-1))/ref(c,-1)*100 ;
highpct = (h - ref(c,-1))/ref(c,-1)*100 ;
lowpct = (l - ref(c,-1))/ref(c,-1)*100 ;
closepct = (c - ref(c,-1))/ref(c,-1)*100 ;
volpct = (v - ref(v,-1))/ref(v,-1)*100 ;
hlpct = (h - ref(l,-1))/ref(c,-1)*100 ;


_n(title =name() + " " + fullname() + " date: "+date()
+writeif(open>ref(c,-1),encodecolor(colorgreen),encodecolor(colorred))+" open:"+ writeval( open, 1.2 ) +" ("+writeval(openpct ,1.2) +"%)"
+writeif(h>ref(c,-1),encodecolor(colorgreen),encodecolor(colorred))+ " h:" + writeval( h , 1.2 ) +" ("+writeval(highpct ,1.2) +"%)"
+writeif(h>ref(l,-1),encodecolor(colorgreen),encodecolor(colorred))+ " hl:" + writeval( h , 1.2 ) +" ("+writeval(highpct ,1.2) +"%)"
+writeif(l>ref(c,-1),encodecolor(colorgreen),encodecolor(colorred))+" l:"+ writeval( l, 1.2 ) +" ("+writeval(lowpct ,1.2) +"%)"
+writeif(c>ref(c,-1),encodecolor(colorgreen),encodecolor(colorred))+" c:"+ writeval( c, 1.2 ) +" ("+writeval(closepct ,1.2) +"%)"
+writeif(v>ref(v,-1),encodecolor(colorgreen),encodecolor(colorred))+" v: "+ writeval( v, 1.2 ) +" ("+writeval(volpct ,1.2) +"%)");
_section_end();


filter=1 ;
addtextcolumn ( fullname(), "full__________name",5,iif( roc(c, 1 ) > 0, colorgreen, colorred ) );
addcolumn(roc(h,1),"_hl_",1.2,iif( roc(h, 1 ) > 0, colorgreen, colorred ) );
addcolumn(roc(c,1),"نسبة التغير",1.2,iif( roc(c, 1 ) > 0, colorgreen, colorred ) );
addcolumn( close, "الاغلاق", 1.2, iif( roc(c, 1 ) > 0, colorgreen, colorred ) );
addcolumn(open, "الافتتاح", 1.2 );
addcolumn( low, "الادني", 1.2 );
addcolumn(high, "الاعلى", 1.2 );


setchartbkcolor(paramcolor("outer panel color ",colorblack));
setchartbkgradientfill( paramcolor("inner panel color upper half",colorblack),paramcolor("inner panel color lower half",colorblack));
plot( c, "close", paramcolor("color", colordefault ), stylenotitle | paramstyle("style") | getpricestyle() );



تاكد منها نفس المطلوب او لا

بيض الله وجهك
تقريبا هي ولكن ابيه يحسب الفرق بين الاعلى والادنى ويضعهم في جدول كما هو موجود الان وانا اقو بترتيبه تصاعديا او تنازليا

شكرا مرة اخرى[/center]



رد مع اقتباس
قديم 13-10-2014, 05:00 PM
  المشاركه #58

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

تاريخ التسجيل: Mar 2008
المشاركات: 997
المسلفط غير متواجد حالياً  

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



رد مع اقتباس
قديم 15-10-2014, 09:37 AM
  المشاركه #59

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

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

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





رد مع اقتباس
قديم 18-10-2014, 05:16 PM
  المشاركه #60

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

تاريخ التسجيل: Oct 2013
المشاركات: 503
DABL@ غير متواجد حالياً  

الاخ مالك الفلوب




شوف هذا المعادله




_SECTION_BEGIN("Background");
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("Outer panel",colorGrey40)); // color of outer border
SetChartBkGradientFill( ParamColor("Inner panel upper",colorGrey40),ParamColor("Inner panel lower",colorBlack));
tchoice=Param("Title Selection ",2,1,2,1);

Plot(C, "", IIf(O>=C, colorOrange, colorGreen), ParamStyle("Price Style",styleCandle, maskPrice));

//////////////////////////////////////////////////////////////////
_SECTION_BEGIN("Fib Retracements");
fibs = ParamToggle("Plot Fibs","Off|On",1);
pctH = Param ("Pivot Hi %", 0.325,0.001,2.0,0.002);
HiLB = Param ("Hi LookBack",1,1,BarCount-1,1);
pctL = Param ("Pivot Lo %", 0.325,0.001,2.0,0.002);
LoLB = Param ("Lo LookBack",1,1,BarCount-1,1);
Back = Param ("Extend Left = 2",1,1,500,1);
Fwd = Param("Plot Forward", 0, 0, 500, 1);
text = ParamToggle("Plot Text","Off|On",1);
hts = Param ("Text Shift", -33.5,-50,50,0.10);
style =ParamStyle("Line Style",styleLine,styleNoLabel);
x = BarIndex();
pRp = PeakBars( H, pctH, 1) == 0;
yRp0 = SelectedValue(ValueWhen( pRp, H, HiLB));
xRp0 = SelectedValue(ValueWhen( pRp, x, HiLB));
pSp = TroughBars( L, pctL, 1) == 0;
ySp0 = SelectedValue(ValueWhen( pSp, L, LoLB));
xSp0 = SelectedValue(ValueWhen( pSp, x, LoLB));
Delta = yRp0 - ySp0;

function fib(ret)
{
retval = (Delta * ret);
Fibval = IIf(ret < 1.0
AND xSp0 < xRp0, yRp0 - retval, IIf(ret < 1.0
AND xSp0 > xRp0, ySp0 + retval,IIf(ret > 1.0
AND xSp0 < xRp0, yRp0 - retval, IIf(ret > 1.0
AND xSp0 > xRp0, ySp0 + retval, Null))));
return FibVal;
}

x0 = Min(xSp0,xRp0)-Back;
x1 = (BarCount -1);
//////////////////////////////////////////////////////////////////
r236 = fib(0.236); r236I = LastValue (r236,1);
r382 = fib(0.382); r382I = LastValue (r382,1);
r050 = fib(0.50); r050I = LastValue (r050,1);
r618 = fib(0.618); r618I = LastValue (r618,1);
r786 = fib(0.786); r786I = LastValue (r786,1);
e127 = fib(1.27); e127I = LastValue (e127,1);
e162 = fib(1.62); e162I = LastValue (e162,1);
e200 = fib(2.00); e200I = LastValue (e200,1);
e262 = fib(2.62); e262I = LastValue (e262,1);
e424 = fib(4.24); e424I = LastValue (e424,1);
//////////////////////////////////////////////////////////////////
p00 = IIf(xSp0 > xRp0,ySp0,yRp0); p00I = LastValue (p00,1);
p100 = IIf(xSp0 < xRp0,ySp0,yRp0); p100I = LastValue (p100,1);
color00 =IIf(xSp0 > xRp0,colorLime,colorRed);
color100 =IIf(xSp0 < xRp0,colorLime,colorRed);
//////////////////////////////////////////////////////////////////
numbars = LastValue(Cum(Status("barvisible")));
fraction= IIf(StrRight(Name(),3) == "", 3.2, 3.2);
//////////////////////////////////////////////////////////////////
if(fibs==1)
{
Plot(LineArray(xRp0-Fwd,yRp0,x1,yRp0,Back),"PR",32,8|styleNoRescale,Null, Null,Fwd);
Plot(LineArray(xSp0-Fwd,ySp0,x1,ySp0,Back),"PS",27,8|styleNoRescale,Null, Null,Fwd);
Plot(LineArray(x0-Fwd,r236,x1,r236,Back),"",45,style|styleNoRescale, Null, Null,Fwd);
Plot(LineArray(x0-Fwd,r382,x1,r382,Back),"",44,style|styleNoRescale, Null, Null,Fwd);
Plot(LineArray(x0-Fwd,r050,x1,r050,Back),"",41,style|styleNoRescale, Null, Null,Fwd);
Plot(LineArray(x0-Fwd,r618,x1,r618,Back),"",43,style|styleNoRescale, Null, Null,Fwd);
Plot(LineArray(x0-Fwd,r786,x1,r786,Back),"",42,style|styleNoRescale, Null, Null,Fwd);
Plot(LineArray(x0-Fwd,e127,x1,e127,Back),"e127",47,style|styleNoRescale,Null, Null,Fwd);
Plot(LineArray(x0-Fwd,e162,x1,e162,Back),"e162",47,style|styleNoRescale,Null, Null,Fwd);
Plot(LineArray(x0-Fwd,e200,x1,e200,Back),"p200",47,style|styleNoRescale,Null, Null,Fwd);
Plot(LineArray(x0-Fwd,e262,x1,e262,Back),"p262",47,style|styleNoRescale,Null, Null,Fwd);
Plot(LineArray(x0-Fwd,e424,x1,e424,Back),"p424",25,style|styleNoRescale,Null, Null,Fwd);
}
//////////////////////////////////////////////////////////////////
if(text==1)
{
PlotText(" 0% = " + WriteVal(p00,fraction), LastValue(BarIndex())-(numbars/hts), p00I + 0.05, color00);
PlotText("23% = " + WriteVal(r236,fraction), LastValue(BarIndex())-(numbars/hts), r236I + 0.05, 45);
PlotText("38% = " + WriteVal(r382,fraction), LastValue(BarIndex())-(numbars/hts), r382I + 0.05, 44);
PlotText("50% = " + WriteVal(r050,fraction), LastValue(BarIndex())-(numbars/hts), r050I + 0.05, 41);
PlotText("62% = " + WriteVal(r618,fraction), LastValue(BarIndex())-(numbars/hts), r618I + 0.05, 43);
PlotText("78% = " + WriteVal(r786,fraction), LastValue(BarIndex())-(numbars/hts), r786I + 0.05, 42);
PlotText("100% = " + WriteVal(p100,fraction), LastValue(BarIndex())-(numbars/hts),p100I + 0.05, color100);
PlotText("127% = " + WriteVal(e127,fraction), LastValue(BarIndex())-(numbars/hts),e127I + 0.05, 47);
PlotText("162% = " + WriteVal(e162,fraction), LastValue(BarIndex())-(numbars/hts),e162I + 0.05, 47);
PlotText("200% = " + WriteVal(e200,fraction), LastValue(BarIndex())-(numbars/hts),e200I + 0.05, 47);
PlotText("262% = " + WriteVal(e262,fraction), LastValue(BarIndex())-(numbars/hts),e262I + 0.05, 47);
PlotText("424% = " + WriteVal(e424,fraction), LastValue(BarIndex())-(numbars/hts),e424I + 0.05, 25);
}
_SECTION_END();
//////////////////////////////////////////////////////////////////
if (tchoice==1 )
{
_N(Title = EncodeColor(colorWhite)+StrFormat(" {{NAME}} - {{INTERVAL}} {{DATE}} Open: %g, High: %g, Low: %g, Close: %g {{VALUES}}",O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
}
//////////////////////////////////////////////////////////////////
if (tchoice==2 )
{
Title = EncodeColor(colorWhite)+ Date() + " Tick = " + EncodeColor(5) + Interval()+
EncodeColor(colorWhite) + " Open = " + EncodeColor(colorWhite) + O +
EncodeColor(colorWhite) + " High = " + EncodeColor(5) + H +
EncodeColor(colorWhite) + " Low = " + EncodeColor(colorRed) + L +
EncodeColor(colorWhite) + " Close = " + EncodeColor(colorWhite) + C + "\n" +
EncodeColor( colorWhite) +"_______________"+"\n"+
EncodeColor( colorWhite) + "424% = " + EncodeColor(25)+ e424 + " " +"\n"+
EncodeColor( colorWhite) + "262% = " + EncodeColor(47)+ e262 + " " +"\n"+
EncodeColor( colorWhite) + "200% = " + EncodeColor(47)+ e200 + " " +"\n"+
EncodeColor( colorWhite) + "162% = " + EncodeColor(47)+ e162 + " " +"\n"+
EncodeColor( colorWhite) + "127% = " + EncodeColor(47)+ e127 + " " +"\n"+
EncodeColor( colorYellow) + " Res = " + EncodeColor(32)+ p100 + " " +"\n"+
EncodeColor( colorWhite) + " 78% = " + EncodeColor(42)+ r786 + " " +"\n"+
EncodeColor( colorWhite) + " 62% = " + EncodeColor(43)+ r618 + " " +"\n"+
EncodeColor( colorWhite) + " 50% = " + EncodeColor(41)+ r050 + " " +"\n"+
EncodeColor( colorWhite) + " 38% = " + EncodeColor(44)+ r382 + " " +"\n"+
EncodeColor( colorWhite) + " 23% = " + EncodeColor(45)+ r236+ " " +"\n"+
EncodeColor( colorYellow) + " Sup = " + EncodeColor(34)+ p00 + " " ;
}
GraphXSpace=5;

SetChartOptions(1, chartShowDates); // put dates at bottom of chart

pr = Param("Elliot Wave minimum % move", 2, 1, 100);
// Beginner Elliot Wave stuff
EWpk = PeakBars(H, pr, 1) == 0;
EWtr = TroughBars(L, pr, 1) == 0;

// Intermediate Elliot Wave stuff
zz = Zig(C, pr);
zzHi = Zig(H, pr);
zzLo = Zig(L, pr);
Avg = (zzHi+zzLo)/2;

// Advanced Elliot Wave stuff
RetroSuccessSecret = IIf(EWpk, zzHi, IIf(EWtr, zzLo, IIf(Avg > Ref(Avg,-1), H, L)));
EW = Zig(RetroSuccessSecret, pr);

// Plot on price chart
/*Plot(C, "Close", colorBlack, styleCandle);*/
Plot(EW, "EW", colorWhite, styleLine);

// Plot buy and sell arrows
Buy = TroughBars(EW, pr, 1) == 0;
Sell = PeakBars(EW, pr, 1) ==0;
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0,L,-15);
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0,L,-15);
PlotShapes(IIf(Buy,shapeSmallCircle,shapeNone),colorWhite,0,BuyPrice,0);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,H,-15);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,H,-15);
PlotShapes(IIf(Sell,shapeSmallCircle,shapeNone),colorWhite,0,SellPrice,0);

AlertIf( Buy , "SOUND C:\\Windows\\Media\\Notify.wav", "Audio alert", 2 );
AlertIf( Sell, "SOUND C:\\Windows\\Media\\Tada.wav", "Audio alert", 2 );

_SECTION_BEGIN("Elliot Fractals");

/*
The basic definition of an 'up' fractal is a bar high that is both higher than the two bars immediately preceding it
and higher than the two bars immediately following it.
The lows of the bars are NOT considered in determining the up fractal progression.

If two bars in the progression have equal highs followed by two consecutive bars with lower highs,
then a total of six bars rather than the usual five bars will make up the progression.
The first High becomes the counting fractal. Reverse for 'down' fractals.

The 5 bar formation works best on Daily or longer time frame charts.For intraday data charts we often use 9 bar, 13 bar and 21 bar formations for fractal counting
*/
Up5BarFractal = Ref(H,-2) < H AND Ref(H,-1) < H AND Ref(H,1) < H AND Ref(H,2) < H;
Up6BarFractal = Ref(H,-2) < H AND Ref(H,-1) < H AND (H == Ref(H,1)) AND Ref(H,2) < H AND Ref(H,3) < H;
Down5BarFractal = Ref(L,-2) > L AND Ref(L,-1) > L AND Ref(L,1) > L AND Ref(L,2) > L;
Down6BarFractal = Ref(L,-2) > L AND Ref(L,-1) > L AND (L == Ref(L,1)) AND Ref(L,2) > L AND Ref(L,3) > L;

//TODO: More filtering: Show only troughs that are around atrough in trix(9).

PlotShapes( IIf(Down5BarFractal ,shapeSmallUpTriangle,0) ,colorBlack, 0, L,-12);
PlotShapes( IIf(Down6BarFractal ,shapeSmallUpTriangle,0) ,colorBlack, 0, L,-12);

PlotShapes( IIf(Up5BarFractal ,shapeSmallDownTriangle,0) ,colorBlack, 0, H,-12);
PlotShapes( IIf(Up6BarFractal ,shapeSmallDownTriangle,0) ,colorBlack, 0, H,-12);

Up = (Up5BarFractal OR Up6BarFractal);
Down = (Down5BarFractal OR Down6BarFractal);
//Removing false fractals:
DownSignal = Flip(Ref(Up,-1), Ref(Down,-1));
UpSignal = Flip(Ref(Down,-1), Ref(Up,-1));

LastHigh[0] = H[0];
LastLow[0] = L[0];

LastLowIndex = 0;
LastHighIndex = 0;
Valid = 0;
for (i=1; i < BarCount; i++)
{

LastHigh[i] = LastHigh[i-1];
LastLow[i] = LastLow[i-1];
if (Up[i])
{
Valid[i] = True;
if (DownSignal[i])
{
//Sequence of 2 Up Fractals. Validate only the higher one.
Valid[i] = H[i] >= H[LastHighIndex];
Valid[LastHighIndex] = H[LastHighIndex] > H[i];
}
LastHigh[i] = Max(H[i], H[LastHighIndex ]);
LastHighIndex = i;
}

if (Down[i])
{
Valid[i] = True;
if (UpSignal[i])
{
//Sequence of 2 Down Fractals. Validate only the lower one.
Valid[i] = L[i] <= L[LastLowIndex];
Valid[LastLowIndex] = L[LastLowIndex] < L[i];
}

LastLow[i] = Min(L[i], L[LastLowIndex]);
LastLowIndex = i;
}
}

TrixN = Trix(9);
TroughLow = Ref(TrixN, -3) > TrixN AND Ref(TrixN, -2) > TrixN AND Ref(TrixN, -1) > TrixN AND Ref(TrixN, 1) > TrixN AND Ref(TrixN, 2) > TrixN AND Ref(TrixN, 3) > TrixN;
TroughHigh = Ref(TrixN, -3) < TrixN AND Ref(TrixN, -2) < TrixN AND Ref(TrixN, -1) < TrixN AND Ref(TrixN, 1) < TrixN AND Ref(TrixN, 2) < TrixN AND Ref(TrixN, 3) < TrixN;
//TroughLow = Ref(TrixN, -2) > TrixN AND Ref(TrixN, -1) > TrixN AND Ref(TrixN, 1) > TrixN AND Ref(TrixN, 2) > TrixN;
//TroughHigh = Ref(TrixN, -2) < TrixN AND Ref(TrixN, -1) < TrixN AND Ref(TrixN, 1) < TrixN AND Ref(TrixN, 2) < TrixN;
ZeroValid = Cross(TrixN, 0) OR Cross(0, TrixN) OR Ref(Cross(TrixN, 0),1) OR Ref(Cross(0, TrixN),1);
ValidLow = TroughLow OR Ref(TroughLow, 1) OR Ref(TroughLow, 2) OR Ref(TroughLow, 3) OR Ref(TroughLow, 4);// OR Ref(TroughLow, 5));
ValidHigh = TroughHigh OR Ref(TroughHigh, 1) OR Ref(TroughHigh, 2) OR Ref(TroughHigh, 3) OR Ref(TroughHigh, 4);// OR Ref(TroughHigh, 5));

//Plot(LastHigh-10 ,"LastHigh", colorBlue, styleLine);
//Plot(LastLow-10 ,"LastLow ", colorRed, styleLine);
//Plot(Valid*5 + 10 ,"LastLow ", colorGreen, styleLine | styleThick);

//PlotShapes( IIf(Down AND Valid,shapeSmallUpTriangle,0) ,colorGreen, 0, L,-12);
//PlotShapes( IIf(Up AND Valid,shapeSmallDownTriangle,0) ,colorRed, 0, H,-12);
Maxi = Up AND (ValidHigh OR ZeroValid);
Mini = Down AND (ValidLow OR ZeroValid);
PlotShapes( IIf(Down AND (ValidLow OR ZeroValid),shapeSmallUpTriangle,0) ,colorBlue, 0, L,-12);
PlotShapes( IIf(Up AND (ValidHigh OR ZeroValid),shapeSmallDownTriangle,0) ,colorOrange, 0, H,-12);
//Plot(UpSignal*3+5,"UpSignal", colorBlue, styleLine| styleThick);
//Plot(DownSignal*3 ,"DownSignal", colorRed, styleLine| styleThick);

/*
LastMaxi = 0;
LastMini = 0;
ElliotLines = 0;
State = 0;
for (i=1; i < BarCount; i++)
{
State[i] = State[i-1];
if (Maxi[i])
{
State[i] = 1;//down
}

if (Mini[i])
{
State[i] = 2;
}

}

PlotShapes(IIf(State > 0, shapeSmallCircle, 0), IIf(State == 1, colorRed, colorBlue), 0, IIf(State == 1, H, L), -5);
*/
//Line = LineArray( x0, y0, x1, y1, 1 );
//Plot( Line, "Trend line", colorBlue );

/*
Wave B
Usually 50% of Wave A
Should not exceed 75% of Wave A
Wave C
either 1 x Wave A
or 1.62 x Wave A
or 2.62 x Wave A
*/
function CorrectiveRatios(StartPrice, A, B, C, RatioDelta, Delta)
{

ALength = abs(startPrice - A); BLength = abs(A-B);
CLength = abs(B-C);

Ratio1 = BLength / CLength ;
Cond1 = Ration1 >= 0.5 - RatioDelta AND ratio1 <= 0.75 + RatioDelta;
Cond2 = abs(Clength - ALength) < Delta OR abs(Clength - 1.62 * ALength) < Delta OR abs(CLength - 2.62 * ALength) < Delta;

return Cond1 AND Cond2;
}

function ImpulseRules(StartPrice, One, Two, Three, Four, Five)
{
//Wave 2 should be beneath wave 1 start:
Cond1 = Two > StartPrice AND Two < One;
//Wave 4 - the same:
Cond2 = Four > Two AND Four < Three;
//Wave 5 should be <= wave 3
Cond3 = abs(Three-Two) >= abs(Five - Four);
//Wave 1 should be smaller than wave five, making wave 3 the biggest:
Cond4 = abs(StartPrice - One) < abs(Five - Four);
return Cond1 AND Cond2 AND Cond3 AND Cond4;
}
_SECTION_END();


_SECTION_BEGIN("Ribbon");
uptrend=PDI()>MDI()AND Signal()<MACD();
downtrend=MDI()>PDI()AND Signal()>MACD();


Plot( 1, /*efines the height of the ribbon in percent of pane width */"ribbon",
IIf( uptrend, colorGreen, IIf( downtrend, colorRed,IIf(Signal()<MACD(), colorYellow, 0 ))), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -1, 100 );
_SECTION_END();


_SECTION_BEGIN("Price With Regression Channel");


// Linear Regression Line with 2 Standard Deviation Channels Plotted Above and Below

P = ParamField("Price field",-1);
Daysback = Param("Period for Liner Regression Line",21,1,240,1);
shift = Param("Look back period",0,0,240,1);


// =============================== Math Formula ================================================== ===========

x = Cum(1);
lastx = LastValue( x ) - shift;
aa = LastValue( Ref(LinRegIntercept( p, Daysback), -shift) );
bb = LastValue( Ref(LinRegSlope( p, Daysback ), -shift) );
y = Aa + bb * ( x - (Lastx - DaysBack +1 ) );


// ==================Plot the Linear Regression Line ================================================== ========


LRColor = ParamColor("LR Color", colorCycle );
LRStyle = ParamStyle("LR Style");

LRLine = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y, Null );
Plot( LRLine , "LinReg", LRCOLOR, LRSTYLE ); // styleDots );

// ========================== Plot 1st SD Channel ================================================== =============

SDP = Param("Standard Deviation", 1.5, 0, 6, 0.1);
SD = SDP/2;

width = LastValue( Ref(SD*StDev(p, Daysback),-shift) ); // THIS IS WHERE THE WIDTH OF THE CHANELS IS SET
SDU = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y+width , Null ) ;
SDL = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y-width , Null ) ;

SDColor = ParamColor("SD Color", colorCycle );
SDStyle = ParamStyle("SD Style");

Plot( SDU , "Upper Lin Reg", SDColor,SDStyle );
Plot( SDL , "Lower Lin Reg", SDColor,SDStyle );

// ========================== Plot 2d SD Channel ================================================== =============

SDP2 = Param("2d Standard Deviation", 2.0, 0, 6, 0.1);
SD2 = SDP2/2;

width2 = LastValue( Ref(SD2*StDev(p, Daysback),-shift) ); // THIS IS WHERE THE WIDTH OF THE CHANELS IS SET
SDU2 = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y+width2 , Null ) ;
SDL2 = IIf( x > (lastx - Daysback) AND BarIndex() < Lastx, y-width2 , Null ) ;

SDColor2 = ParamColor("2 SD Color", colorCycle );
SDStyle2 = ParamStyle("2 SD Style");

Plot( SDU2 , "Upper Lin Reg", SDColor2,SDStyle2 );
Plot( SDL2 , "Lower Lin Reg", SDColor2,SDStyle2 );

// ============================ End Indicator Code ================================================== ============

_SECTION_END();


_SECTION_BEGIN("trailing stop atr");
function vstop_func(tr)
{
trailArray[ 0 ] = C[ 0 ]; // initialize
for( i = 1; i < BarCount; i++ )
{
prev = trailArray[ i - 1 ];

if (C[ i ] > prev AND C[ i - 1 ] > prev)
{
trailArray[ i ] = Max(prev,C[ i ] - tr[ i ]);
}
else if (C[ i ] < prev AND C[ i - 1 ] < prev)
{
trailArray[ i ] = Min(prev,C[ i ] + tr[ i ]);
}
else if (C[ i ] > prev)
{
trailArray[ i ] = C[ i ] - tr[ i ];
}
else
{
trailArray[ i ] = C[ i ] + tr[ i ];
}
}
return trailArray;
}

per = Param("per",20, 5, 150, 1);
mult = Param("mult",0.5, 0.5, 4, 0.05);
tr = mult * ATR(per);
trailArray = vstop_func(tr);
//trailArray = Ref(trailArray,-1);

//LISTING 1: Zero-lag moving average

function ZeroLagMA( data, periods )
{
EMA1 = EMA( data, periods );
EMA2 = EMA( EMA1, periods );
Diff = EMA1 - EMA2;
return EMA1 + Diff;
}

Periods = Param("Periods", 20, 2, 100 );

//Plot( ZeroLagMA( Close, Periods ), "ZeroLagMA-"+Periods, colorYellow, styleDashed );

TrailStop = HHV( C - 2 * ATR(10), 15 );
ProfitTaker = EMA( H, 13 ) + 2 * ATR(10);

_SECTION_BEGIN("ProjHL");
//Function pembulatan
function bulat(Lo)
{
return (
IIf(Lo<= 200,round(Lo/1)*1,
IIf(Lo<= 500,round(Lo/5)*5,
IIf(Lo<=2000,round(Lo/10)*10,
IIf(Lo<=5000,round(Lo/25)*25,
IIf(Lo> 5000,round(Lo/50)*50,0)))))
);
}

GfxSetOverlayMode(0);
GfxSelectFont("Arial",9, 700);
GfxSetTextColor( colorRose );
GfxSetBkMode(0); // transparent
GfxTextOut("PivHL = " + (H+L)/2, 250, 45);
GfxTextOut("Diff = " + (C-((H+L)/2)), 350, 45);
GfxSetTextColor( colorYellow );
GfxTextOut("TStop = " + bulat(TrailStop), 450, 45);
GfxTextOut("TPrc = " + bulat(ProfitTaker), 550, 45);





//2 Week New High-New Low
HI = High > Ref(HHV(High,10),-1);
LI = Low < Ref(LLV(Low,10),-1);
HIV1= Ref(HHV(High,10),-1);
LIV1=Ref(LLV(Low,10),-1);
Variable = WriteIf(H>HIV1,"High",WriteIf(L<LIV1,"Low","Neutra l"));
GfxSetTextColor( colorSkyblue );
GfxTextOut("2 WHL: " + HIV1+" : "+LIV1+ " " + Variable,290,75);
_SECTION_END();





_SECTION_BEGIN("sheroune");

SetChartBkColor( colorBlack ) ;
f = Param("fast ema",12,1,50,1);
s = Param("Slow ema",26,2,100,1);
t = Param ("signal",9,1,50,1);
A1=EMA(C,f)-EMA(C,s);
a2 = EMA(a1,t);
Hist = a1-a2;
em = EMA(Hist,2);
D1=14;

ST33=StochD(15,3);
st3 = StochK(15,3);
Ar=EMA(RSI(5),13);
RSI13 = EMA( ar, 13 );

Bar_col = IIf( st3 > st33, colorBrightGreen, colorRed);
Plot(C,"",bar_col,styleBar+styleThick);
em34 = EMA(C,34);
em20 = EMA(C,20);
Plot(em34,"",colorWhite,styleThick);
Plot(em20,"",colorAqua,styleThick);
PlotOHLC(em34,IIf(em34 > em20,em34,em20),IIf(em34 < em20,em34,em20),em34,"",IIf(em20 > em34,colorBlue,colorBrown),styleCloud+styleNoLabel);

_SECTION_END();

_SECTION_BEGIN("Support-Resistance");
SupRes=ParamToggle("Sup-Res","No|Yes",1);
SupResA = Param("Sup-Res A Period",20,0,100,1);
SupResB = Param("Sup-Res B Period",25,0,100,1);

Res1 = ParamColor("Resistance High", colorRed );
Res2 = ParamColor("Resistance Low", colorDarkRed );
Sup1 = ParamColor("Support High", colorDarkGreen );
Sup2 = ParamColor("Support Low", colorBrightGreen );
if(SupRes)
{
MaxGraph = 12;
BuyOffSet = SupResA;//Optimize("BuyOffSet",18,15,20,1);
SellOffset = BuyOffSet;//Optimize("SellOffset",2,2,14,2);
RegLength = 5;//Optimize("RegLength",5, 2,11,2);
BuyATRPeriod = 2;//Optimize("BuyATRPeriod",2,2,5,1);
SellATRPeriod = BuyATRPeriod;//Optimize("SellATRPeriod",4,2,11,2);
ATRMultiplier = 0.5;//Optimize("ATRMultiplier",1,0.7,1.25,.05);
SuppA = HHV(H-ATRMultiplier*ATR(BuyATRPeriod),BuyOffset); /* RED */
RessB = LLV(L+ATRMultiplier*ATR(SellATRPeriod),SellOffset); /* GREEN */
Plot(SuppA,"",sup1,ParamStyle("Sup-Res A Style", styleDashed|styleNoTitle) );
Plot(RessB,"",res2,ParamStyle("Sup-Res A Style", styleDashed|styleNoTitle) );

nn=SupResB;
mmm=100;
TYP=(High + Low + 2*Close)/4;
CI=(TYP-MA(TYP,14))/(0.015*StDev(TYP,14));
CCCI=EMA(CI,5)+mmm;
Hh=HHV(H,nn);
Ll=LLV(L,nn);
MM=(Hh+Ll)/2;
CCCC=EMA(CCCI*(Hh-Ll)/(2*mmm)+Ll,5);
Plot(Hh,"",Res1, ParamStyle("Sup-Res B Style", styleThick|styleNoTitle) );
Plot(Ll,"",Sup2, ParamStyle("Sup-Res B Style", styleThick|styleNoTitle) ) ;
}
_SECTION_END();



_SECTION_BEGIN("Pivot");
nBars = Param("Number of bars", 12, 5, 40);
bShowTCZ = Param("Show TCZ", 1, 0, 1);
nExploreBarIdx = 0;
nExploreDate = 0;
nCurDateNum = 0;
DN = DateNum();
DT = DateTime();
bTCZLong = False;
bTCZShort = False;
nAnchorPivIdx = 0;
ADX8 = ADX(8);
if(Status("action")==1) {
bDraw = True;
bUseLastVis = 1;
} else {
bDraw = False;
bUseLastVis = False;
bTrace = 1;
nExploreDate = Status("rangetodate");
for (i=LastValue(BarIndex());i>=0;i--) {
nCurDateNum = DN[i];
if (nCurDateNum == nExploreDate) {
nExploreBarIdx = i;
}
}
}
GraphXSpace=7;
if (bDraw) {
}
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;
aHHVBars = HHVBars(H, nBars);
aLLVBars = LLVBars(L, nBars);
aHHV = HHV(H, nBars);
aLLV = LLV(L, nBars);
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";
if (curBar >= 120) {
for (i=0; i<120; i++) {
curBar = IIf(nlastVisBar > 0 AND bUseLastVis,
nlastVisBar-i,
IIf(Status("action")==4 AND nExploreBarIdx > 0,
nExploreBarIdx-i,
LastValue(BarIndex())-i));
if (aLLVBars[curBar] < aHHVBars[curBar]) {
if (curTrend == "U") {
curTrend = "D";
curPivBarIdx = curBar - aLLVBars[curBar];
aLPivs[curPivBarIdx] = 1;
aLPivLows[nLPivs] = L[curPivBarIdx];
aLPivIdxs[nLPivs] = curPivBarIdx;
nLPivs++;
}
} else {
if (curTrend == "D") {
curTrend = "U";
curPivBarIdx = curBar - aHHVBars[curBar];
aHPivs[curPivBarIdx] = 1;
aHPivHighs[nHPivs] = H[curPivBarIdx];
aHPivIdxs[nHPivs] = curPivBarIdx;
nHPivs++;
}
}
}
}
curBar =
IIf(nlastVisBar > 0 AND bUseLastVis,
nlastVisBar,
IIf(Status("action")==4 AND nExploreBarIdx > 0,
nExploreBarIdx,
LastValue(BarIndex()))
);
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];
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) >= 1
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) >= 1
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) >= 1
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) >= 1
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) {
PivotEntry = ParamColor( "Entry Color", colorBrightGreen );
PivotEntry2 = ParamColor( "Entry Color2", colorYellow );
PivotExit = ParamColor( "Exit Color", colorRed );
PivotExit2 = ParamColor( "Exit Color2", colorYellow );
// -- OK, let's plot the pivots using arrows
PlotShapes(
IIf(aHPivs==1, shapeSquare, shapeNone),
PivotExit, 0, High, Offset=30);
PlotShapes(
IIf(aAddedHPivs==1, shapeSquare, shapeNone),
PivotExit2, 0, High, Offset=30);
PlotShapes(
IIf(aLPivs==1, shapeSquare , shapeNone),
PivotEntry, 0, Low, Offset=-30);
PlotShapes(
IIf(aAddedLPivs==1, shapeSquare , shapeNone),
PivotEntry2, 0, Low, Offset=-30);

PlotShapes(
IIf(aHPivs==1, shapeSquare, shapeNone),
colorBlack, 0, High, Offset=35);
PlotShapes(
IIf(aAddedHPivs==1, shapeSquare, shapeNone),
colorBlack, 0, High, Offset=35);
PlotShapes(
IIf(aLPivs==1, shapeSquare , shapeNone),
colorBlack, 0, Low, Offset=-35);
PlotShapes(
IIf(aAddedLPivs==1, shapeSquare , shapeNone),
colorBlack, 0, Low, Offset=-35);
}

/* ****************************************
// -- Done with discovering and plotting pivots
***************************************** */
m = (Hh+Ll)/2;
Title = EncodeColor(colorWhite)+ "SHEROUNE ka SYSTEM" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" - " + Date() +" - "+
"\n"+
WriteIf(H > Ref(H,-1),EncodeColor(colorGreen),EncodeColor(colorRed))+" Hi "+H+"\n"+
EncodeColor(colorWhite)+"Op "+O+EncodeColor(colorAqua)+" Cl : " +C+"\n"+
WriteIf(L < Ref(L,-1),EncodeColor(colorRed),EncodeColor(colorGreen))+" Lo "+L
+"\n"+"\n"+"\n"+"\n"+
EncodeColor(colorBrightGreen)+"SL for Short "+Hh
+"\n"+
EncodeColor(colorRed)+"SL for Long "+Ll
+"\n"
//EncodeColor(colorAqua)+"Midpoint "+m



;

_SECTION_BEGIN("shiree FPSR");
//PlotOHLC(O,H,L,C,"Price",IIf(C>O,colorGreen,colorRed),styleCandle);
// Get Previous Day's close, Low and High
Prev_Close = TimeFrameGetPrice( "C", inDaily, -1, expandFirst) ;
Prev_Low = TimeFrameGetPrice( "L", inDaily, -1, expandFirst) ;
Prev_High = TimeFrameGetPrice( "H", inDaily, -1, expandFirst) ;
Today = LastValue(Day( ) );


//////////////////////////////30 MT STRATEGY /////////////////////////////////////////////////////////////
BS=(Prev_High-Prev_Low)/3;


Y=R30=Prev_Close+BS;
X=S30=Prev_Close-BS;

BSColor = colorBlue;
//Plot(X,"",colorBlue,styleThick|styleNoLabel);
//Plot(Y,"",colorBlue,styleThick|styleNoLabel);

///////////////////////////////////////////////////////////////////////////////////////////////////////

SetChartOptions(0,chartShowArrows|chartShowDates);
Show_Prev = ParamToggle( "Display Pivots", "No|Yes", 1);
////////////////////// FPSR AS BUNCH OF LINES/////////////////////////////////////////////////////////////
XY=Y-X;
Z1=X+0.0025*XY;
Z2=X+0.0050*XY;
Z3=X+0.0075*XY;
Z4=X+0.0100*XY;
Z5=X+0.0125*XY;
Z6=X+0.0150*XY;
Z7=X+0.0175*XY;
Z8=X+0.0200*XY;
Z9=X+0.0225*XY;
Z0=X+0.0250*XY;

Z11=Y-0.0025*XY;
Z12=Y-0.005*XY;
Z13=Y-0.0075*XY;
Z14=Y-0.01*XY;
Z15=Y-0.0125*XY;
Z16=Y-0.0150*XY;
Z17=Y-0.0175*XY;
Z18=Y-0.02*XY;
Z19=Y-0.0225*XY;
Z20=Y-0.025*XY;


//ColorR=ColorRGB(150,20,100);
ColorXY=ParamColor("XY", colorYellow);
////////////////////////////////////////////////////////////////////////////
if(Show_Prev)
{
Plot(IIf(Today == Day(),Z1, Null), "", ColorXY,styleLine|styleThick|styleNoRescale|styleNoLabel);
Plot(IIf(Today == Day(),Z2, Null),"", ColorXY,styleLine|styleThick|styleNoRescale|styleNoLabel);
Plot(IIf(Today == Day(),Z3, Null),"", ColorXY,styleLine|styleThick|styleNoRescale|styleNoLabel);
Plot(IIf(Today == Day(),Z4, Null),"", ColorXY,styleLine|styleThick|styleNoRescale|styleNoLabel);
Plot(IIf(Today == Day(),Z5, Null),"", ColorXY,styleLine|styleThick|styleNoRescale|styleNoLabel);
Plot(IIf(Today == Day(),Z6, Null),"", ColorXY,styleLine|styleThick|styleNoRescale|styleNoLabel);
Plot(IIf(Today == Day(),Z7, Null),"", ColorXY,styleLine|styleThick|styleNoRescale|styleNoLabel);
Plot(IIf(Today == Day(),Z8, Null),"", ColorXY,styleLine|styleThick|styleNoRescale|styleNoLabel);
Plot(IIf(Today == Day(),Z9, Null),"", ColorXY,styleLine|styleThick|styleNoRescale|styleNoLabel);
Plot(IIf(Today == Day(),Z0, Null),"", ColorXY,styleLine|styleThick|styleNoRescale|styleNoLabel);

Plot(IIf(Today == Day(),Z11, Null),"", ColorXY,styleLine|styleThick|styleNoRescale|styleNoLabel);
Plot(IIf(Today == Day(),Z12, Null),"", ColorXY,styleLine|styleThick|styleNoRescale|styleNoLabel);
Plot(IIf(Today == Day(),Z13, Null),"", ColorXY,styleLine|styleThick|styleNoRescale|styleNoLabel);
Plot(IIf(Today == Day(),Z14, Null),"", ColorXY,styleLine|styleThick|styleNoRescale|styleNoLabel);
Plot(IIf(Today == Day(),Z15, Null),"", ColorXY,styleLine|styleThick|styleNoRescale|styleNoLabel);
Plot(IIf(Today == Day(),Z16, Null),"", ColorXY,styleLine|styleThick|styleNoRescale|styleNoLabel);
Plot(IIf(Today == Day(),Z17, Null),"", ColorXY,styleLine|styleThick|styleNoRescale|styleNoLabel);
Plot(IIf(Today == Day(),Z18, Null),"", ColorXY,styleLine|styleThick|styleNoRescale|styleNoLabel);
Plot(IIf(Today == Day(),Z19, Null),"", ColorXY,styleLine|styleThick|styleNoRescale|styleNoLabel);
Plot(IIf(Today == Day(),Z20, Null),"", ColorXY,styleLine|styleThick|styleNoRescale|styleNoLabel);}

_SECTION_END();






_SECTION_BEGIN(" ");
fs=Param("font size",13,10,100,1);
GfxSelectFont("french script mt", fs, 700, True );
GfxSetBkMode( colorRed );
GfxSetTextColor( ParamColor("color",colorYellow) );
GfxTextOut("H="+H+" ",340,0);
GfxTextOut("O="+O+" ",240,0);
GfxTextOut("L="+L+" ",440,0); GfxTextOut("C="+C+" " ,540,0);

_SECTION_END();

_SECTION_BEGIN("Elliot Wave");
SetChartOptions(1, chartShowDates); // put dates at bottom of chart

pr = Param("Elliot Wave minimum % move", 2, 1, 100);
// Beginner Elliot Wave stuff
EWpk = PeakBars(H, pr, 1) == 0;
EWtr = TroughBars(L, pr, 1) == 0;

// Intermediate Elliot Wave stuff
zz = Zig(C, pr);
zzHi = Zig(H, pr);
zzLo = Zig(L, pr);
Avg = (zzHi+zzLo)/2;

// Advanced Elliot Wave stuff
RetroSuccessSecret = IIf(EWpk, zzHi, IIf(EWtr, zzLo, IIf(Avg > Ref(Avg,-1), H, L)));
EW = Zig(RetroSuccessSecret, pr);

// Plot on price chart
Plot(C, "Close", colorBrightGreen, styleCandle);
Plot(EW, "EW", colorBlue, styleLine);

// Plot buy and sell arrows
Buy = TroughBars(EW, pr, 1) == 0;
Sell = PeakBars(EW, pr, 1) ==0;
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);
PlotShapes( shapeSmallUpTriangle * Buy, colorBrightGreen, 0, Low );
PlotShapes( shapeSmallDownTriangle * Sell, colorRed, 0, High );

_SECTION_END();

_SECTION_BEGIN("Elliot Wave");
k = (GetPerformanceCounter()/100)%100;
printf("GetPerformance Counter %g",k);
GfxSelectFont("jokerman", 14,800);
GfxSetBkMode(1);
GfxSetTextColor(colorCustom12);
GfxTextOut("Elliot Wave+Automatic Fib Levels",300+k,30);
RequestTimedRefresh(10);
_SECTION_END();



_SECTION_BEGIN("Automatic Fib Levels");
/*---------------------------------------------------
Automatic Fib Levels
Aron Pipa, December, 11, 2005
modified by Kook 30 December 2005
--------------------------------------------------------*/

GraphXSpace=2;
Plot(C,"", colorBlack,styleCandle|styleNoLabel);

// Get values for fib levels

StartBar=SelectedValue(BarIndex());
FinishBar = EndValue( BarIndex() );
i = startbar;
period = FinishBar - StartBar;

Lo =LLV(L,period);
Hi = HHV(H,period);
Line0 = 0;
Line1 = 0;
Line2 = 0;
Line3 = 0;
Line4 = 0;
Line5 = 0;
Line6 = 0;
Line7 = 0;
Line100 = 0;

for( i = startbar; i < finishbar; i++ )
{
if(EndValue(C)<SelectedValue(C))
{
Line0 = EndValue(Lo);
Line100 = EndValue(Hi);
Line1 = Line0 + abs(Line100-Line0)*0.382;
Line2 = Line0 + abs(Line100-Line0)*0.5;
Line3 = Line0 + abs(Line100-Line0)*0.618;
Line4 = Line0 + abs(Line100-Line0)*0.764;
Line5 = Line0 + abs(Line100-Line0)*0.236;
Line6 = Line0 + abs(Line100-Line0)*0.14;
Line7 = Line0 + abs(Line100-Line0)*0.88;
}
else
{
Line100 = EndValue(Lo);
Line0 = EndValue(Hi);
Line1 =Line0 - abs(Line100-Line0)*0.382;
Line2 = Line0 - abs(Line100-Line0)*0.5;
Line3 = Line0 - abs(Line100-Line0)*0.618;
Line4 = Line0 - abs(Line100-Line0)*0.764;
Line5 = Line0 - abs(Line100-Line0)*0.236;
Line6 = Line0 - abs(Line100-Line0)*0.147;
Line7 = Line0 - abs(Line100-Line0)*0.88;
}
}

// external fib lines begining fom selecetdbarindex()
fib0= LineArray(startbar, Line0, finishbar, Line0, 0, 1);
fib100 = LineArray(startbar, Line100, finishbar, Line100, 0, 1);

// depth of middle lines
n= round((finishbar-startbar)/2);

// middle lines
fib1= LineArray((finishbar-n), Line1, finishbar, Line1, 0, 1);
fib2= LineArray((finishbar-n), Line2, finishbar, Line2, 0, 1);
fib3= LineArray((finishbar-n), Line3, finishbar, Line3, 0, 1);
fib4= LineArray((finishbar-n), Line4, finishbar, Line4, 0, 1);
fib5= LineArray((finishbar-n), Line5, finishbar, Line5, 0, 1);
fib6= LineArray((finishbar-n), Line6, finishbar, Line6, 0, 1);
fib7= LineArray((finishbar-n), Line7, finishbar, Line7, 0, 1);


Plot(fib0,"", colorWhite,styleDots|styleNoTitle);
Plot(fib100,"", colorWhite,styleDots|styleNoTitle);
Plot(fib1,"38.2%=", colorBrightGreen,32+styleThick|styleNoTitle);
Plot(fib2,"50%=", colorYellow,1+styleThick|styleNoTitle);
Plot(fib3,"61.8%=", colorPink,32+styleThick|styleNoTitle);
Plot(fib4,"76.4%=", colorBrightGreen,32+styleThick|styleNoTitle);
Plot(fib5,"23.6%=", colorTurquoise,32+styleThick|styleNoTitle);
Plot(fib6,"14%=",colorPink,32+styleThick|styleNoTitle);
Plot(fib7,"88%=", colorCustom11,32+styleThick|styleNoTitle);

Title = "FIB" + " " + Interval(2) + EncodeColor() + " & " + Date()


+"\n"+EncodeColor(colorBlue)+"--------------------------------------"

+"\n"+EncodeColor(colorWhite)+ "100%= "+WriteVal(line100,format=1.2)
+"\n"+EncodeColor(colorCustom11)+"89% = "+WriteVal(line7,format=1.2)
+"\n"+EncodeColor(colorBrightGreen)+"76.4% = "+WriteVal(line4,format=1.2)
+"\n"+EncodeColor(colorPink)+"61.8% = "+WriteVal(line3,format=1.2)
+"\n"+EncodeColor(colorYellow)+"50% = "+WriteVal(line2,format=1.2)
+"\n"+EncodeColor(colorBrightGreen)+"38.6% = "+WriteVal(line1,format=1.2)
+"\n"+EncodeColor(colorCustom11)+"23.6%= "+WriteVal(line5,format=1.2)
+"\n"+EncodeColor(colorPink)+"14%%= "+WriteVal(line6,format=1.2)
+"\n"+EncodeColor(colorWhite)+"0%= "+WriteVal(line0,format=1.2);




_SECTION_END();




وهذا




Option = ParamToggle("Insert To", "Price Chart|Indicator");

pr=Param("Elliot Wave minimum % move",2, 0.001,100);


EWpk=PeakBars(H,pr)==0;
EWtr=TroughBars(L,pr)==0;


zz=Zig(C,pr);
zzHi=Zig(H,pr);
zzLo=Zig(L,pr);
Avg=(zzHi+zzLo)/2;

RetroSuccessSecret=IIf(EWpk,zzHi,
IIf(EWtr,zzLo,IIf(Avg>Ref(Avg,-1),H,L)));
EW=Zig(RetroSuccessSecret,pr);

if (Option==0)
Plot(EW, "EW", ParamColor("Color", colorBrown), ParamStyle("Style",
styleNoLabel|styleThick));
else
{


EWbuy=TroughBars(EW,pr)==0;
EWsell=PeakBars(EW,pr)==0;


Plot(EWbuy-EWsell, "EW2", ParamColor("Color", colorRed), ParamStyle("Style",
styleNoLabel|styleThick));

}




_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

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




_SECTION_BEGIN("Elliotwave");
X=BarIndex();
p=Param("p",5,5,30,1);
z=Zig(C,p);Plot(C,"C",2,64);
CONDP=PeakBars(C,P)==0;SP=Cum(CONDP);
EP1=ValueWhen(CONDP,C,1);TP1=ValueWhen(CONDP,X,1);
EP2=ValueWhen(CONDP,C,2);TP2=ValueWhen(CONDP,X,2);
EP3=ValueWhen(CONDP,C,3);TP3=ValueWhen(CONDP,X,3);
EP4=ValueWhen(CONDP,C,4);TP4=ValueWhen(CONDP,X,4);
CONDT=TroughBars(C,P)==0;ST=Cum(CONDT);
ET1=ValueWhen(CONDT,C,1);TT1=ValueWhen(CONDT,X,1);
ET2=ValueWhen(CONDT,C,2);TT2=ValueWhen(CONDT,X,2);
ET3=ValueWhen(CONDT,C,3);TT3=ValueWhen(CONDT,X,3);
ET4=ValueWhen(CONDT,C,4);TT4=ValueWhen(CONDT,X,4);
ET5=ValueWhen(CONDT,C,5);TT5=ValueWhen(CONDT,X,5);

EW8=EP3>EP4 AND EP2>EP3 AND EP2>EP1 AND ET4>ET5 AND ET3>ET2 AND
ET2>ET1 AND ET3>ET4 AND ET4>ET5 AND CONDT;
COLOR=colorWhite;
PlotShapes(shapeDigit8*EW8,color);
G=Cum(CONDP OR CONDT);
GEW=SelectedValue(ValueWhen(EW8,G));
for(n=1;n<=9;n++)
{
PlotShapes((49-(2*n-(n%2)))*(G==GEW-n AND (n%2)*CONDP+(-1+n%2)
*CONDT),Color);
}
Plot(EW8,"",colorRed,2+styleOwnScale);
Plot(z,"",colorYellow,styleThick);
Filter=EW8;
AddColumn(C,"C");
GraphXSpace=8;
_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();
















_SECTION_BEGIN("ELLIOTT Fractals");
Up5BarFractal = Ref(H,-2) < H AND Ref(H,-1) < H AND Ref(H,1) < H AND Ref(H,2) <
H;
Up6BarFractal = Ref(H,-2) < H AND Ref(H,-1) < H AND (H == Ref(H,1)) AND
Ref(H,2) < H AND Ref(H,3) < H;
Down5BarFractal = Ref(L,-2) > L AND Ref(L,-1) > L AND Ref(L,1) > L AND Ref(L,2)
> L;
Down6BarFractal = Ref(L,-2) > L AND Ref(L,-1) > L AND (L == Ref(L,1)) AND
Ref(L,2) > L AND Ref(L,3) > L;



PlotShapes( IIf(Down5BarFractal ,shapeSmallUpTriangle,0) ,colorBlack, 0, L,-12);
PlotShapes( IIf(Down6BarFractal ,shapeSmallUpTriangle,0) ,colorBlack, 0, L,-12);

PlotShapes( IIf(Up5BarFractal ,shapeSmallDownTriangle,0) ,colorBlack, 0, H,-12);
PlotShapes( IIf(Up6BarFractal ,shapeSmallDownTriangle,0) ,colorBlack, 0, H,-12);

Up = (Up5BarFractal OR Up6BarFractal);
Down = (Down5BarFractal OR Down6BarFractal);

DownSignal = Flip(Ref(Up,-1), Ref(Down,-1));
UpSignal = Flip(Ref(Down,-1), Ref(Up,-1));

LastHigh[0] = H[0];
LastLow[0] = L[0];

LastLowIndex = 0;
LastHighIndex = 0;
Valid = 0;
for (i=1; i < BarCount; i++)
{

LastHigh[i] = LastHigh[i-1];
LastLow[i] = LastLow[i-1];
if (Up[i])
{
Valid[i] = True;
if (DownSignal[i])
{

Valid[i] = H[i] >= H[LastHighIndex];
Valid[LastHighIndex] = H[LastHighIndex] > H[i];
}
LastHigh[i] = Max(H[i], H[LastHighIndex ]);
LastHighIndex = i;
}

if (Down[i])
{
Valid[i] = True;
if (UpSignal[i])
{

Valid[i] = L[i] <= L[LastLowIndex];
Valid[LastLowIndex] = L[LastLowIndex] < L[i];
}

LastLow[i] = Min(L[i], L[LastLowIndex]);
LastLowIndex = i;
}
}

TrixN = Trix(9);
TroughLow = Ref(TrixN, -3) > TrixN AND Ref(TrixN, -2) > TrixN AND Ref(TrixN,
-1) > TrixN AND Ref(TrixN, 1) > TrixN AND Ref(TrixN, 2) > TrixN AND Ref(TrixN,
3) > TrixN;
TroughHigh = Ref(TrixN, -3) < TrixN AND Ref(TrixN, -2) < TrixN AND Ref(TrixN,
-1) < TrixN AND Ref(TrixN, 1) < TrixN AND Ref(TrixN, 2) < TrixN AND Ref(TrixN,
3) < TrixN;
TroughLow = Ref(TrixN, -2) > TrixN AND Ref(TrixN, -1) > TrixN AND Ref(TrixN, 1) > TrixN AND Ref(TrixN, 2) > TrixN;
TroughHigh = Ref(TrixN, -2) < TrixN AND Ref(TrixN, -1) < TrixN AND Ref(TrixN, 1) < TrixN AND Ref(TrixN, 2) < TrixN;
ZeroValid = Cross(TrixN, 0) OR Cross(0, TrixN) OR Ref(Cross(TrixN, 0),1) OR
Ref(Cross(0, TrixN),1);
ValidLow = TroughLow OR Ref(TroughLow, 1) OR Ref(TroughLow, 2) OR
Ref(TroughLow, 3) OR Ref(TroughLow, 4);// OR Ref(TroughLow, 5));
ValidHigh = TroughHigh OR Ref(TroughHigh, 1) OR Ref(TroughHigh, 2) OR
Ref(TroughHigh, 3) OR Ref(TroughHigh, 4);// OR Ref(TroughHigh, 5));


PlotShapes( IIf(Down AND Valid,shapeSmallUpTriangle,0) ,colorGreen, 0, L,-12);
PlotShapes( IIf(Up AND Valid,shapeSmallDownTriangle,0) ,colorRed, 0, H,-12);
Maxi = Up AND (ValidHigh OR ZeroValid);
Mini = Down AND (ValidLow OR ZeroValid);
PlotShapes( IIf(Down AND (ValidLow OR ZeroValid),shapeSmallUpTriangle,0)
,colorBlue, 0, L,-12);
PlotShapes( IIf(Up AND (ValidHigh OR ZeroValid),shapeSmallDownTriangle,0)
,colorOrange, 0, H,-12);



LastMaxi = 0;
LastMini = 0;
ElliotLines = 0;
State = 0;
for (i=1; i < BarCount; i++)
{
State[i] = State[i-1];
if (Maxi[i])
{
State[i] = 1;
}

if (Mini[i])
{
State[i] = 2;
}

}

PlotShapes(IIf(State > 0, shapeSmallCircle, 0), IIf(State == 1, colorRed,
colorBlue), 0, IIf(State == 1, H, L), -5);







function CorrectiveRatios(StartPrice, A, B, C, RatioDelta, Delta)
{

ALength = abs(startPrice - A); BLength = abs(A-B);
CLength = abs(B-C);

Ratio1 = BLength / CLength ;
Cond1 = Ration1 >= 0.5 - RatioDelta AND ratio1 <= 0.75 + RatioDelta;
Cond2 = abs(Clength - ALength) < Delta OR abs(Clength - 1.62 * ALength) < Delta
OR abs(CLength - 2.62 * ALength) < Delta;

return Cond1 AND Cond2;
}

function ImpulseRules(StartPrice, One, Two, Three, Four, Five)
{
//Wave 2 should be beneath wave 1 start:
Cond1 = Two > StartPrice AND Two < One;
//Wave 4 - the same:
Cond2 = Four > Two AND Four < Three;
//Wave 5 should be <= wave 3
Cond3 = abs(Three-Two) >= abs(Five - Four);
//Wave 1 should be smaller than wave five, making wave 3 the biggest:
Cond4 = abs(StartPrice - One) < abs(Five - Four);
return Cond1 AND Cond2 AND Cond3 AND Cond4;
}
_SECTION_END();



موجات اليوت تعتمد علي التحليل الشخص و يكون افضل من المعادله الجاهزه



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


الكلمات الدلالية (Tags)
معادلات, الايمي, بروكر, بعض, شرح, صنع, كيفية

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

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

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

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



09:33 PM