مزارع
11-06-2009, 06:44 AM
الأولى
_SECTION_BEGIN("TRIX system base");
function Trix2( array, period )
{
tmp = EMA( EMA( EMA( array, period ), period ), period );
result = (tmp - Ref( tmp , -1 ))/Ref( tmp, -1 ) ;
return result;
}
pertrix = Param("period Trix", 8, 0, 100,1);
persig = Param("period signal", 3, 0, 100,1);
Trixline = Trix2( (O+C)/2, pertrix );
TrixSignal = EMA( Trixline, persig);
Plot( Trixline, "TRIX(5)", colorRed );
Plot( TrixSignal, "EMA(TRIX,3)", colorBlue );
GoldenCross = Cross( TrixLine, TrixSignal );
TrixFall = Trixline < Ref( Trixline, -1 ) AND Ref( Trixline, -1 ) > Ref( Trixline, -2 );
Buy = GoldenCross;
Sell = TrixFall;
Short=Sell;
Cover=Buy;
shape = Buy * shapeUpTriangle + Sell * shapeDownTriangle;
PlotShapes( shape, IIf( Buy, colorLime, colorOrange ), 0,IIf( Buy, Ref(Trixline,-1)*0.9, Ref(Trixline,-1)*1.05) );
Plot( Flip( Buy, Sell ), "Trade", colorLightGrey, styleArea | styleOwnScale, 0, 1 );
_SECTION_END();
الثانية
_SECTION_BEGIN("ãÎãÎÉ");
// Balance of Power
// Example code can be found at:
// http://www.traders.com/Documentation...adersTips.h tml
//----- This prevents a bad data point from generating a divide by zero.
THL = IIf(H != L, H - L, 0.01);
//----- Reward based on Open
BullOpen = (H - O)/THL;
BearOpen = (O - L)/THL;
//----- Reward based on Close
BullClose = (C - L)/THL;
BearClose = (H - C)/THL;
//----- Reward based on Open - Close
BullOC =IIf(C > O, (C - O)/THL, 0);
BearOC =IIf(O > C, (O - C)/THL, 0);
BullReward = (BullOpen + BullClose + BullOC)/3;
BearReward = (BearOpen + BearClose + BearOC)/3;
BOP = BullReward - BearReward;
Period1 = 34;
SmoothBOP = EMA(BOP, Period1);
Period2 = 34;
SmootherBOP = TEMA(SmoothBOP, Period2);
//Plot(BOP, "BOP", colorBlack, 1);
Plot(SmoothBOP, "BOP " + Period1, colorLightBlue, 1);
Plot(SmootherBOP, "", colorRed);
Plot(Ref(SmootherBOP, -2), "", colorBlue);
Plot(0.1, "", colorGreen);
Plot(0, "", colorBlack);
Plot(-0.1, "", colorGreen);
_SECTION_END();
الثالثة
_SECTION_BEGIN("ÑÇÚí ÈÚíÑ 5");
/*FastStoch%KFullStoch%K%D
Originally Developed by George C. Lane
For reference, see;
http://stockcharts.com/education/Wha...scillator.html
or,
http://www.aspenres.com/Website/coms...ochastics.html
Values about at OR above the Red line show overbought,
AND about at OR below the Green line show oversold.
where x is the first parameter, y is the second parameter
and (in the case of Full stochastics), z is the third parameter.
In the case of Fast and Slow Stochastics,
x is typically 14 and y is usually set to 3.
The formula could be plotted with three lines,
Hence 14-3-3 or 14-5-3 or 14-3-5
%K (fast)
%K (full) = y-day SMA of %K (fast)
%D (full) = z-day SMA of %K (full)
or just the usual 2 lines,
%K (full) = y-day SMA of %K (fast)
%D (full) = z-day SMA of %K (full)
*/
pds = 14; /*Periods */
/*pds = Optimize("pds",13,2,20,1); */
slw = 3; /*Slowing for Full Stoch%K*/
/*slw = Optimize("slw",3,1,14,1); */
slwd = 3; /*Slowing for Full Stoch%D*/
/*slwd = Optimize("slwd",3,1,14,1); */
ob = 83; /*Overbought */
/*ob = Optimize("ob",83,65,88,1); */
os = 24; /*Oversold */
/*os = Optimize("os",24,20,50,1); */
FSK = 100*(C-LLV(L,pds))/(HHV(H,pds)-LLV(L,pds)); // FASTSTOCHK
FLSK = MA( FSK, slw ); // FULLSTOCHK
FLSD = MA( FLSK, slwd ); // FULLSTOCHD
MaxGraph = 6;
Graph0 = FSK;
Graph0Color = 7;
Graph1 = FLSK;
Graph1Color = 6;
Graph2 = FLSD;
Graph2Color = 23;
Graph3 = FLSD;
Graph3BarColor =
IIf (Graph3 > ob, 13,
IIf (Graph3 < os,8,14));
Graph4 = ob;
Graph4Color = 4;
Graph5 = os;
Graph5Color = 43;
Graph0Style = Graph1Style = Graph2Style = Graph4Style = Graph5Style = 1;
Graph3Style = 2;
Title = Name()+" "+FullName()+
" FastStoch%K=Yellow FullStoch%K = Blue FullStoch%D = Dark Grey";
whengoup = FLSD < os AND Cross(FSK,os) AND FLSK >= Ref(FLSK,-1) AND FLSD >= Ref(FLSD,-1) OR Cross(FLSD,os) AND FSK >= Ref(FSK,-1) AND FLSK >= Ref(FLSK,-1) ;
whengodown = IIf(BarsSince(Cross(os,FSK))==1 AND FLSK < os ,1,0) OR Cross(os,FSK) AND FLSK < Ref(FLSK,-1) OR FLSK < ob AND FLSK > os AND FLSK <= Ref(FLSK,-1) OR FSK > ob AND FLSK > ob AND FLSD > ob AND FSK < Ref(FSK,-1) AND FLSK < Ref(FLSK,-1) AND FLSD <= Ref(FLSD,-1) OR FSK > ob AND FLSK > ob AND FLSD > ob AND Cross(ob,FLSK);
Buy = whengoup;
Sell = whengodown;
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
_SECTION_END();
الرابعة
LookBack = Param("Lookback", 13, 2, 100 );
Smooth1 = Param("Smooth 1", 25, 1, 100 );
Smooth2 = Param("Smooth 2", 2, 1, 100 );
HH = HHV( H, LookBack );
LL = LLV( L, LookBack );
StoMom = 100 * EMA( EMA( C - 0.5 * ( HH + LL ), Smooth1 ), Smooth2 ) /
( 0.5 * EMA( EMA( HH - LL, Smooth1 ), Smooth2 ) );
Buy = StoMom > Ref( StoMom, -1);
Sell = NOT Buy;
Color = IIf( Buy, colorGreen, colorRed);
Plot(StoMom, _DEFAULT_NAME(), Color,styleThick );
Buy = ExRem( Buy, Sell);
Sell = ExRem( Sell, Buy);
PlotShapes( Buy*shapeUpArrow, colorGreen );
PlotShapes( Sell*shapeDownArrow, colorRed );
_SECTION_BEGIN("Bollinger Bands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style");
Plot( BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), Color, Style );
Plot( BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), Color, Style );
_SECTION_END();
_SECTION_BEGIN("MA1");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 200, 1, 10 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
الخامسة
_SECTION_BEGIN("ADX color");
//Trend Following Systems DO NOT work when ADX is Below 20 - Tech Analysis A-Z; page 120
P1 = Param("Period",10,0,100,1);
MyPDI= PDI(P1);//Positive Directional Indicator
MyMDI= MDI(P1);//Negative Directional Indicator (Minus)
MyADX= ADX(P1);//Average Directional Movement Index
//Green ADX Line=Rising; Red ADX Line=Falling
col = IIf( MyADX > Ref( MyADX, -1 ), colorBlue, colorYellow );
Plot( MyPDI,"+DI",colorGreen, styleThick);
Plot( MyMDI,"-DI",colorRed, styleThick);
Plot( MyADX,"ADX",col, styleThick);
Title=Name()+ " " + Date() + " Price: " + C + EncodeColor(colorIndigo) +" ADX" + WriteVal( MyADX )+ EncodeColor(colorWhite) + " +DMI" + WriteVal( MyPDI )+ EncodeColor(colorRed) + " -DMI" + WriteVal( MyMDI );
_SECTION_END();
أرجو أن يكون فيها فائدة للأخوة الأفاضل .
_SECTION_BEGIN("TRIX system base");
function Trix2( array, period )
{
tmp = EMA( EMA( EMA( array, period ), period ), period );
result = (tmp - Ref( tmp , -1 ))/Ref( tmp, -1 ) ;
return result;
}
pertrix = Param("period Trix", 8, 0, 100,1);
persig = Param("period signal", 3, 0, 100,1);
Trixline = Trix2( (O+C)/2, pertrix );
TrixSignal = EMA( Trixline, persig);
Plot( Trixline, "TRIX(5)", colorRed );
Plot( TrixSignal, "EMA(TRIX,3)", colorBlue );
GoldenCross = Cross( TrixLine, TrixSignal );
TrixFall = Trixline < Ref( Trixline, -1 ) AND Ref( Trixline, -1 ) > Ref( Trixline, -2 );
Buy = GoldenCross;
Sell = TrixFall;
Short=Sell;
Cover=Buy;
shape = Buy * shapeUpTriangle + Sell * shapeDownTriangle;
PlotShapes( shape, IIf( Buy, colorLime, colorOrange ), 0,IIf( Buy, Ref(Trixline,-1)*0.9, Ref(Trixline,-1)*1.05) );
Plot( Flip( Buy, Sell ), "Trade", colorLightGrey, styleArea | styleOwnScale, 0, 1 );
_SECTION_END();
الثانية
_SECTION_BEGIN("ãÎãÎÉ");
// Balance of Power
// Example code can be found at:
// http://www.traders.com/Documentation...adersTips.h tml
//----- This prevents a bad data point from generating a divide by zero.
THL = IIf(H != L, H - L, 0.01);
//----- Reward based on Open
BullOpen = (H - O)/THL;
BearOpen = (O - L)/THL;
//----- Reward based on Close
BullClose = (C - L)/THL;
BearClose = (H - C)/THL;
//----- Reward based on Open - Close
BullOC =IIf(C > O, (C - O)/THL, 0);
BearOC =IIf(O > C, (O - C)/THL, 0);
BullReward = (BullOpen + BullClose + BullOC)/3;
BearReward = (BearOpen + BearClose + BearOC)/3;
BOP = BullReward - BearReward;
Period1 = 34;
SmoothBOP = EMA(BOP, Period1);
Period2 = 34;
SmootherBOP = TEMA(SmoothBOP, Period2);
//Plot(BOP, "BOP", colorBlack, 1);
Plot(SmoothBOP, "BOP " + Period1, colorLightBlue, 1);
Plot(SmootherBOP, "", colorRed);
Plot(Ref(SmootherBOP, -2), "", colorBlue);
Plot(0.1, "", colorGreen);
Plot(0, "", colorBlack);
Plot(-0.1, "", colorGreen);
_SECTION_END();
الثالثة
_SECTION_BEGIN("ÑÇÚí ÈÚíÑ 5");
/*FastStoch%KFullStoch%K%D
Originally Developed by George C. Lane
For reference, see;
http://stockcharts.com/education/Wha...scillator.html
or,
http://www.aspenres.com/Website/coms...ochastics.html
Values about at OR above the Red line show overbought,
AND about at OR below the Green line show oversold.
where x is the first parameter, y is the second parameter
and (in the case of Full stochastics), z is the third parameter.
In the case of Fast and Slow Stochastics,
x is typically 14 and y is usually set to 3.
The formula could be plotted with three lines,
Hence 14-3-3 or 14-5-3 or 14-3-5
%K (fast)
%K (full) = y-day SMA of %K (fast)
%D (full) = z-day SMA of %K (full)
or just the usual 2 lines,
%K (full) = y-day SMA of %K (fast)
%D (full) = z-day SMA of %K (full)
*/
pds = 14; /*Periods */
/*pds = Optimize("pds",13,2,20,1); */
slw = 3; /*Slowing for Full Stoch%K*/
/*slw = Optimize("slw",3,1,14,1); */
slwd = 3; /*Slowing for Full Stoch%D*/
/*slwd = Optimize("slwd",3,1,14,1); */
ob = 83; /*Overbought */
/*ob = Optimize("ob",83,65,88,1); */
os = 24; /*Oversold */
/*os = Optimize("os",24,20,50,1); */
FSK = 100*(C-LLV(L,pds))/(HHV(H,pds)-LLV(L,pds)); // FASTSTOCHK
FLSK = MA( FSK, slw ); // FULLSTOCHK
FLSD = MA( FLSK, slwd ); // FULLSTOCHD
MaxGraph = 6;
Graph0 = FSK;
Graph0Color = 7;
Graph1 = FLSK;
Graph1Color = 6;
Graph2 = FLSD;
Graph2Color = 23;
Graph3 = FLSD;
Graph3BarColor =
IIf (Graph3 > ob, 13,
IIf (Graph3 < os,8,14));
Graph4 = ob;
Graph4Color = 4;
Graph5 = os;
Graph5Color = 43;
Graph0Style = Graph1Style = Graph2Style = Graph4Style = Graph5Style = 1;
Graph3Style = 2;
Title = Name()+" "+FullName()+
" FastStoch%K=Yellow FullStoch%K = Blue FullStoch%D = Dark Grey";
whengoup = FLSD < os AND Cross(FSK,os) AND FLSK >= Ref(FLSK,-1) AND FLSD >= Ref(FLSD,-1) OR Cross(FLSD,os) AND FSK >= Ref(FSK,-1) AND FLSK >= Ref(FLSK,-1) ;
whengodown = IIf(BarsSince(Cross(os,FSK))==1 AND FLSK < os ,1,0) OR Cross(os,FSK) AND FLSK < Ref(FLSK,-1) OR FLSK < ob AND FLSK > os AND FLSK <= Ref(FLSK,-1) OR FSK > ob AND FLSK > ob AND FLSD > ob AND FSK < Ref(FSK,-1) AND FLSK < Ref(FLSK,-1) AND FLSD <= Ref(FLSD,-1) OR FSK > ob AND FLSK > ob AND FLSD > ob AND Cross(ob,FLSK);
Buy = whengoup;
Sell = whengodown;
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
_SECTION_END();
الرابعة
LookBack = Param("Lookback", 13, 2, 100 );
Smooth1 = Param("Smooth 1", 25, 1, 100 );
Smooth2 = Param("Smooth 2", 2, 1, 100 );
HH = HHV( H, LookBack );
LL = LLV( L, LookBack );
StoMom = 100 * EMA( EMA( C - 0.5 * ( HH + LL ), Smooth1 ), Smooth2 ) /
( 0.5 * EMA( EMA( HH - LL, Smooth1 ), Smooth2 ) );
Buy = StoMom > Ref( StoMom, -1);
Sell = NOT Buy;
Color = IIf( Buy, colorGreen, colorRed);
Plot(StoMom, _DEFAULT_NAME(), Color,styleThick );
Buy = ExRem( Buy, Sell);
Sell = ExRem( Sell, Buy);
PlotShapes( Buy*shapeUpArrow, colorGreen );
PlotShapes( Sell*shapeDownArrow, colorRed );
_SECTION_BEGIN("Bollinger Bands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style");
Plot( BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), Color, Style );
Plot( BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), Color, Style );
_SECTION_END();
_SECTION_BEGIN("MA1");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 200, 1, 10 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
الخامسة
_SECTION_BEGIN("ADX color");
//Trend Following Systems DO NOT work when ADX is Below 20 - Tech Analysis A-Z; page 120
P1 = Param("Period",10,0,100,1);
MyPDI= PDI(P1);//Positive Directional Indicator
MyMDI= MDI(P1);//Negative Directional Indicator (Minus)
MyADX= ADX(P1);//Average Directional Movement Index
//Green ADX Line=Rising; Red ADX Line=Falling
col = IIf( MyADX > Ref( MyADX, -1 ), colorBlue, colorYellow );
Plot( MyPDI,"+DI",colorGreen, styleThick);
Plot( MyMDI,"-DI",colorRed, styleThick);
Plot( MyADX,"ADX",col, styleThick);
Title=Name()+ " " + Date() + " Price: " + C + EncodeColor(colorIndigo) +" ADX" + WriteVal( MyADX )+ EncodeColor(colorWhite) + " +DMI" + WriteVal( MyPDI )+ EncodeColor(colorRed) + " -DMI" + WriteVal( MyMDI );
_SECTION_END();
أرجو أن يكون فيها فائدة للأخوة الأفاضل .