قديم 04-03-2016, 11:50 PM
  المشاركه #25

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

تاريخ التسجيل: Apr 2012
المشاركات: 223
amm1430 غير متواجد حالياً  

_SECTION_BEGIN("Natraj EOD Tech Chart");
GraphXSpace = 15;_SECTION_BEGIN("???? ?????");
r1 = Param( "Fast avg", 11, 3, 20, 1 );
r2 = Param( "Slow avg", 35, 10, 35, 1 );
r3 = Param( "Signal avg", 6, 3, 20, 1 );
ml = MACD(r1, r2);
sl = Signal(r1,r2,r3);
Hst = ml-sl;
A1=EMA(C,4)-EMA(C,34);
BBtops=BBandTop(A1,10,1);
BBbots=BBandBot(A1,10,1);

Color_bar=IIf(a1>BBtops, colorBlue,IIf(a1<BBbots,colorRed,colorYellow));

bbtop = BBandTop( Hst, 10, 1 );
bbbot = BBandBot( Hst, 10,1 );

Color = IIf (Hst > BBtop,colorBlue,IIf(hst < bbbot,colorRed, IIf (Hst > 0,colorBlue,colorRed)));Buy = Cross (Hst,bbtop);Sell = Cross (bbtop,Hst);Short = Cross (bbbot,Hst);Cover = Cross (Hst,bbbot);
Plot (Close,"close",Color_bar,styleCandle);

//==============================
psh= ParamToggle("Pivot Shapes","Off|On",1);
plb= ParamToggle("Pivot Labels","Off|On",1);
snd= ParamToggle("Sound Alerts","Off|On",1);
lbk= Param("Hi Lo Lookback",350,50,5000,10);
nbz= Param("Swing Bars",5,5,150,1);
tht= Param("Hi Label Adjust",0.65,0.10,5,0.05)*ATR(5);
lbk= Min(BarCount-1,Lbk);
bc=BarCount-1;
//================
xH=H-H; xL=L-L; yH=H-H; yL=L-L; xR=H-H; xS=L-L;
xrb=0; xSb=0; yR0=0; yS0=0; xR0=0; xS0=0; xx=0;
xHH= HHVBars(H,nbz); xLL= LLVBars(L,nbz);
yHH= HHV(H,nbz); yLL= LLV(L,nbz);
viz= Status("BarVisible");
vbz= LastValue(Highest(IIf(viz,BarIndex(),0)));
_TRACE("Last visible bar: "+ vbz);
bct= (BarCount-1); = "";
if(xLL[bc]<xHH[bc]) { ="D"; } else { ="U"; }
for(i=0; i<lbk; i++) { bc=bct-i;
if(xLL[bc]<xHH[bc]) { if(=="U"){="D";
xx=bc-xLL[bc]; xL[xx]=1;
yL[xSb]=L[xx]; xS[xSb]=xx; xSb++; }
} else { if(=="D") { = "U";
xx=bc-xHH[bc]; xH[xx]=1; yH[xrb]=H[xx]; xR[xrb]=xx;xrb++; }}}
xP= 0; yP= 0; xS0= xS[0]; yS0=yL[0]; xR0= xR[0]; yR0= yH[0];
if(xS0>xR0) { xP=bc-xHH[bc]; yP= yHH[bc];
if(yR0<yP AND xP>xS0 AND xP<bc) { xH[xP]=1;
for(j=0; j<xrb; j++) { yH[xrb-j]= yH[xrb-(j+1)];
xR[xrb-j]= xR[xrb-(j+1)]; }
yH[0]= yP; xR[0]= xP; xrb++; }
} else { xP= bc-xLL[bc]; yP= yLL[bc];
if(yS0>yP AND xP>xR0 AND xP<bc) { xL[xP]=1;
for(j=0; j<xSb; j++) { yL[xSb-j]= yL[xSb-(j+1)]; xS[xSb-j]= xS[xSb-(j+1)]; }
yL[0]=yP; xS[0]=xP; xSb++; }}
ushp=shapeHollowUpArrow; dshp=shapeHollowDownArrow;
if(psh)
if(snd) {
AlertIf(xL==1,"SOUND C:\\Windows\\Media\\Windows XP Startup.wav","Audio alert",2);
AlertIf(xH==1,"SOUND C:\\Windows\\Media\\Ringin.wav","Audio alert",2); }
Buy=(xL); Sell=(xH); Cover=(xL); Short=(xH); Long=Flip(Buy,Sell); Shrt=Flip(Sell,Buy);
SellPrice=ValueWhen(Sell,H,1); BuyPrice= ValueWhen(Buy,L,1);
if(plb) {
for(i=0; i<BarCount; i++) {
if(Buy[i] )PlotText("\n\n"+ StrRight(NumToStr(L[i],6.2),10),i-1,L[i],colorWhite);
if(Sell[i])PlotText(StrRight(NumToStr(H[i],6.2),10),i-1,H[i]+tht[i],colorWhite); }
}
_SECTION_BEGIN("NICK MA Swing");
SetBarsRequired(200,0);

GraphXSpace = 5;
SetChartOptions(0,chartShowArrows|chartShowDates);
k = Optimize("K",Param("K",1,0.25,5,0.25),0.25,5,0.25);
Per= Optimize("atr",Param("atr",4,3,20,1),3,20,1);
HACLOSE=(O+H+L+C)/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
j=Haclose;

//============================================================================== =========================================
//=========================Indicator============================================ ==================================================
f=ATR(14);

rfsctor = WMA(H-L, Per);

revers = k * rfsctor;

Trend = 1;
NW[0] = 0;


for(i = 1; i < BarCount; i++)
{
if(Trend[i-1] == 1)
{
if(j[i] < NW[i-1])
{
Trend[i] = -1;
NW[i] = j[i] + Revers[i];
}
else
{
Trend[i] = 1;
if((j[i] - Revers[i]) > NW[i-1])
{
NW[i] = j[i] - Revers[i];
}
else
{
NW[i] = NW[i-1];
}
}
}
if(Trend[i-1] == -1)
{
if(j[i] > NW[i-1])
{
Trend[i] = 1;
NW[i] = j[i] - Revers[i];
}
else
{
Trend[i] = -1;
if((j[i] + Revers[i]) < NW[i-1])
{
NW[i] = j[i] + Revers[i];
}
else
{
NW[i] = NW[i-1];
}
}
}
}

//===============system================

Plot(NW, "", IIf(Trend == 1, 27, 4), 4);
Buy=Cover=Cross(j,nw);
Sell=Short=Cross(nw,j);
SellPrice=ValueWhen(Sell,C,1);
BuyPrice=ValueWhen(Buy,C,1);
Long=Flip(Buy,Sell);
Shrt=Flip(Sell,Buy );
_SECTION_END();
//=================TITLE======================================================== ========================================
_SECTION_BEGIN("Title");
if( Status("action") == actionIndicator )
(
Title = EncodeColor(colorWhite)+ "NICK MA Swing System" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"\n"+
EncodeColor(colorLime)+
WriteIf (Buy , " GO LONG / Reverse Signal at "+C+" ","")+
WriteIf (Sell , " EXIT LONG / Reverse Signal at "+C+" ","")+"\n"+EncodeColor(colorWhite)+
WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+
WriteIf(Buy , "Total Profit/Loss for the Last trade Rs."+(SellPrice-C)+"","")+
WriteIf(Long AND NOT Buy, "Trade : Long - Entry price Rs."+(BuyPrice),"")+
WriteIf(shrt AND NOT Sell, "Trade : Short - Entry price Rs."+(SellPrice),"")+"\n"+
WriteIf(Long AND NOT Buy, "Current Profit/Loss Rs."+(C-BuyPrice)+"","")+
WriteIf(shrt AND NOT Sell, "Current Profit/Loss Rs."+(SellPrice-C)+"",""));
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
_SECTION_END();



رد مع اقتباس
 
 

قديم 11-03-2016, 10:50 PM
  المشاركه #26

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

تاريخ التسجيل: Apr 2012
المشاركات: 223
amm1430 غير متواجد حالياً  

//==============================
psh= ParamToggle("Pivot Shapes","Off|On",1);
plb= ParamToggle("Pivot Labels","Off|On",1);
snd= ParamToggle("Sound Alerts","Off|On",1);
lbk= Param("Hi Lo Lookback",350,50,5000,10);
nbz= Param("Swing Bars",5,5,150,1);
tht= Param("Hi Label Adjust",0.65,0.10,5,0.05)*ATR(5);
lbk= Min(BarCount-1,Lbk);
bc=BarCount-1;
//================
xH=H-H; xL=L-L; yH=H-H; yL=L-L; xR=H-H; xS=L-L;
xrb=0; xSb=0; yR0=0; yS0=0; xR0=0; xS0=0; xx=0;
xHH= HHVBars(H,nbz); xLL= LLVBars(L,nbz);
yHH= HHV(H,nbz); yLL= LLV(L,nbz);
viz= Status("BarVisible");
vbz= LastValue(Highest(IIf(viz,BarIndex(),0)));
_TRACE("Last visible bar: "+ vbz);
bct= (BarCount-1); = "";
if(xLL[bc]<xHH[bc]) { ="D"; } else { ="U"; }
for(i=0; i<lbk; i++) { bc=bct-i;
if(xLL[bc]<xHH[bc]) { if(=="U"){="D";
xx=bc-xLL[bc]; xL[xx]=1;
yL[xSb]=L[xx]; xS[xSb]=xx; xSb++; }
} else { if(=="D") { = "U";
xx=bc-xHH[bc]; xH[xx]=1; yH[xrb]=H[xx]; xR[xrb]=xx;xrb++; }}}
xP= 0; yP= 0; xS0= xS[0]; yS0=yL[0]; xR0= xR[0]; yR0= yH[0];
if(xS0>xR0) { xP=bc-xHH[bc]; yP= yHH[bc];
if(yR0<yP AND xP>xS0 AND xP<bc) { xH[xP]=1;
for(j=0; j<xrb; j++) { yH[xrb-j]= yH[xrb-(j+1)];
xR[xrb-j]= xR[xrb-(j+1)]; }
yH[0]= yP; xR[0]= xP; xrb++; }
} else { xP= bc-xLL[bc]; yP= yLL[bc];
if(yS0>yP AND xP>xR0 AND xP<bc) { xL[xP]=1;
for(j=0; j<xSb; j++) { yL[xSb-j]= yL[xSb-(j+1)]; xS[xSb-j]= xS[xSb-(j+1)]; }
yL[0]=yP; xS[0]=xP; xSb++; }}
ushp=shapeHollowUpArrow; dshp=shapeHollowDownArrow;
if(psh)
if(snd) {
AlertIf(xL==1,"SOUND C:\\Windows\\Media\\Windows XP Startup.wav","Audio alert",2);
AlertIf(xH==1,"SOUND C:\\Windows\\Media\\Ringin.wav","Audio alert",2); }
Buy=(xL); Sell=(xH); Cover=(xL); Short=(xH); Long=Flip(Buy,Sell); Shrt=Flip(Sell,Buy);
SellPrice=ValueWhen(Sell,H,1); BuyPrice= ValueWhen(Buy,L,1);
if(plb) {
for(i=0; i<BarCount; i++) {
if(Buy[i] )PlotText("\n\n"+ StrRight(NumToStr(L[i],6.2),10),i-1,L[i],colorWhite);
if(Sell[i])PlotText(StrRight(NumToStr(H[i],6.2),10),i-1,H[i]+tht[i],colorWhite); }
}



_SECTION_BEGIN("Natraj EOD Tech Chart");
GraphXSpace = 15;_SECTION_BEGIN("???? ?????");
r1 = Param( "Fast avg", 11, 3, 20, 1 );
r2 = Param( "Slow avg", 35, 10, 35, 1 );
r3 = Param( "Signal avg", 6, 3, 20, 1 );
ml = MACD(r1, r2);
sl = Signal(r1,r2,r3);
Hst = ml-sl;
A1=EMA(C,4)-EMA(C,34);
BBtops=BBandTop(A1,10,1);
BBbots=BBandBot(A1,10,1);

Color_bar=IIf(a1>BBtops, colorBlue,IIf(a1<BBbots,colorRed,colorYellow));

bbtop = BBandTop( Hst, 10, 1 );
bbbot = BBandBot( Hst, 10,1 );

Color = IIf (Hst > BBtop,colorBlue,IIf(hst < bbbot,colorRed, IIf (Hst > 0,colorBlue,colorRed)));Buy = Cross (Hst,bbtop);Sell = Cross (bbtop,Hst);Short = Cross (bbbot,Hst);Cover = Cross (Hst,bbbot);
Plot (Close,"close",Color_bar,styleCandle);



_SECTION_BEGIN("EMA1");
P = ParamField("Price field",-1);
_SECTION_END();

PI = atan(1.00) * 4;
periods = 30;
HighHigh = HHV(H, periods);
LowLow = LLV(L, periods);
range = 25 / (HighHigh - LowLow) * LowLow;
MA1= EMA(C,200);
x1_MA = 0;
x2_MA= 1;
y1_MA= 0;
y2_MA= (Ref(MA1, -1) - MA1) / Avg * range;
c_MA= sqrt((x2_MA- x1_MA)*(x2_MA- x1_MA) + (y2_MA- y1_MA)*(y2_MA- y1_MA));
angle_MA= round(180 * acos((x2_MA - x1_MA)/c_MA) / PI);
angle_MA= IIf(y2_MA> 0, - angle_MA, angle_MA);
Col=IIf(angle_MA>3,colorWhite,IIf(angle_MA<(-3),colorRed,colorBlack));
Plot(EMA( P,200), _DEFAULT_NAME(), Col, ParamStyle("Style") );










/*
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);

AlertIf(Down AND (ValidLow OR ZeroValid), "SOUND C:\\Windows\\Media\\Chord.wav", "Audio alert", 2);
AlertIf(Up AND (ValidHigh OR ZeroValid), "SOUND C:\\Windows\\Media\\Ding.wav", "Audio alert", 2);
//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_BEGIN("EMA1");
P = ParamField("Price field",-1);
_SECTION_END();

PI = atan(1.00) * 4;
periods = 30;
HighHigh = HHV(H, periods);
LowLow = LLV(L, periods);
range = 25 / (HighHigh - LowLow) * LowLow;
MA1= EMA(C,200);
x1_MA = 0;
x2_MA= 1;
y1_MA= 0;
y2_MA= (Ref(MA1, -1) - MA1) / Avg * range;
c_MA= sqrt((x2_MA- x1_MA)*(x2_MA- x1_MA) + (y2_MA- y1_MA)*(y2_MA- y1_MA));
angle_MA= round(180 * acos((x2_MA - x1_MA)/c_MA) / PI);
angle_MA= IIf(y2_MA> 0, - angle_MA, angle_MA);
Col=IIf(angle_MA>3,colorWhite,IIf(angle_MA<(-3),colorRed,colorBlack));
Plot(EMA( P,200), _DEFAULT_NAME(), Col, ParamStyle("Style") );


_SECTION_BEGIN("Natraj EOD Tech Chart");
GraphXSpace = 15;_SECTION_BEGIN("???? ?????");
r1 = Param( "Fast avg", 11, 3, 20, 1 );
r2 = Param( "Slow avg", 35, 10, 35, 1 );
r3 = Param( "Signal avg", 6, 3, 20, 1 );
ml = MACD(r1, r2);
sl = Signal(r1,r2,r3);
Hst = ml-sl;
A1=EMA(C,4)-EMA(C,34);
BBtops=BBandTop(A1,10,1);
BBbots=BBandBot(A1,10,1);

Color_bar=IIf(a1>BBtops, colorBlue,IIf(a1<BBbots,colorRed,colorYellow));

bbtop = BBandTop( Hst, 10, 1 );
bbbot = BBandBot( Hst, 10,1 );

Color = IIf (Hst > BBtop,colorBlue,IIf(hst < bbbot,colorRed, IIf (Hst > 0,colorBlue,colorRed)));Buy = Cross (Hst,bbtop);Sell = Cross (bbtop,Hst);Short = Cross (bbbot,Hst);Cover = Cross (Hst,bbbot);
Plot (Close,"close",Color_bar,styleCandle);



_SECTION_BEGIN("EMA1");
P = ParamField("Price field",-1);
_SECTION_END();

PI = atan(1.00) * 4;
periods = 30;
HighHigh = HHV(H, periods);
LowLow = LLV(L, periods);
range = 25 / (HighHigh - LowLow) * LowLow;
MA1= EMA(C,200);
x1_MA = 0;
x2_MA= 1;
y1_MA= 0;
y2_MA= (Ref(MA1, -1) - MA1) / Avg * range;
c_MA= sqrt((x2_MA- x1_MA)*(x2_MA- x1_MA) + (y2_MA- y1_MA)*(y2_MA- y1_MA));
angle_MA= round(180 * acos((x2_MA - x1_MA)/c_MA) / PI);
angle_MA= IIf(y2_MA> 0, - angle_MA, angle_MA);
Col=IIf(angle_MA>3,colorWhite,IIf(angle_MA<(-3),colorRed,colorBlack));
Plot(EMA( P,200), _DEFAULT_NAME(), Col, ParamStyle("Style") );


_SECTION_BEGIN("Intraday System_Candle_Alerts BS on 200 ema");
/* Intraday template */

GraphXSpace = 3 ;

/* These are the calcs for the oscilator values and plots the paint
bars*/
Osc = EMA(C,8) - EMA(C,34);
acc = Osc - EMA(Osc,13);
col = IIf(Osc > Ref(Osc,-1) AND acc > Ref(acc,-1),colorTurquoise,IIf(Osc < Ref(Osc,-1) AND acc < Ref(acc,-1),colorTan,colorLightBlue));
barcolor= 1;
Plot( Close, "Intraday Template" ,col/barcolor, styleCandle,styleThick|styleNoLabel);
// this sets the color of the body of the candlesticks to default

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

/* This is the code for the exponential moving average flipper */

mov = 200;
hi = EMA(H,mov);
lo = EMA(L,mov) ;
x1 = IIf(C>Ref(hi,-1),1,IIf(C<Ref(lo,-1),-1,0));
x2 = ValueWhen(x1!=0,x1,1);
st = IIf(x2==-1,Hi,Lo);
//Plot(st,"",colorYellow,styleNoLine|styleDots);
Buy=Cross(C,st);
Sell=Cross( Signal(), MACD() ) OR TimeNum()>151500;
Short=Cross(st,C);
Cover=Cross( MACD(), Signal() ) OR TimeNum()>151500;
shape = Buy * shapeUpTriangle + Short * shapeDownTriangle;
AlertIf( Short, "SOUND C:\\Windows\\Media\\ringout.wav", "Audio alert", 2 );
AlertIf( Buy, "SOUND C:\\Windows\\Media\\ringout.wav", "Audio alert", 2 );
PlotShapes( shape, IIf( Buy, colorYellow, colorCustom12 ),0, IIf( Buy, Low,
High ) );

GraphXSpace = 5;
dist = 2.5*ATR(10);

for( i = 0; i < BarCount; i++ )
{
if( Buy[i] ) PlotText( "Buy\n" + C[ i ], i, L[ i ]-dist[i], colorGreen
);
if( Short[i] ) PlotText( "Short\n" + C[ i ], i, H[ i ]+dist[i],
colorRed);
}
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g,
Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C,SelectedValue( ROC( C,
1 ) ) ));


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

/* This next code calculates the previous days high, low and close */

Hi1 =
IIf(Day()!=Ref(Day(),-1),Ref(HighestSince(Day()!=Ref(Day(),-1),H,1),-1),0);
Hi = ValueWhen(Day()!=Ref(Day(),-1),Hi1,1);
Lo1 =
IIf(Day()!=Ref(Day(),-1),Ref(LowestSince(Day()!=Ref(Day(),-1),L,1),-1),0);
Lo = ValueWhen(Day()!=Ref(Day(),-1),Lo1,1);
Cl1 = IIf(Day()!=Ref(Day(),-1),Ref(C,-1),0);
Cl = ValueWhen(Day()!=Ref(Day(),-1),Cl1,1);

/*This code calculates the time left in the bar*/

//File: TimeLeft in Bar
//Sept 20, 2005
// Compute Time Left In Bar
//

BarTime1 = LastValue(TimeNum() - Now(4));
DataError = IIf(Now(4) > TimeNum(),True,False);
TimeBase = IIf(Interval(1)>0,1,0);


_N(StrBarTime = NumToStr(BarTime1,1.0,False));
BT_Length = StrLen(StrBarTime);


_N(TimeLeft_ = WriteIf(BT_Length==1,"0:0"+StrBarTime,WriteIf(BT_Length==2,"0:"+StrBarTime,
WriteIf(BT_Length==3,StrLeft(StrBarTime,1)+":"+StrRight(StrBarTime,2),
StrLeft(StrBarTime,2)+":"+StrRight(StrBarTime,2))) ));

TimeLeft = WriteIf(TimeBase==1,TimeLeft_,"N/A");



//////////////////////////////////////////////////////////////////////////////
Filter=Buy OR Short;

AddColumn( IIf(Buy,1,IIf(Short,-1,Null)) ,"Buy/Short",1.0,colorWhite,IIf(Buy,colorDarkGreen,IIf(Short,colorRed,Null)),100);
AddColumn( IIf(Cover,2,IIf(Sell,-2,Null)) ,"Cover/Sell",1.0,colorWhite,IIf(Cover,colorLightBlue,IIf( Sell,colorCustom12,Null)),100);




_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | styleHidden | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("BB_double_(H+L)_20");



////BOL BAND 18////////////////////////////////////////////////////////




P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );


M = (H+L)/2;

BT = BBandTop( M, 20, 1.5 );
BB = BBandBot( M, 20, 1.5 );

BColor = ColorRGB(5,125,150);
//Plot( BT, "BBTop" + _PARAM_VALUES(), BColor, styleDots|styleThick|styleNoLabel);
//Plot( BB, "BBBot" + _PARAM_VALUES(), BColor, styleDots|styleThick|styleNoLabel);



BT1 = BBandTop( M, 20, 2.2 );
BB1 = BBandBot( M, 20, 2.2 );
//Plot( BT1, "BBTop1" + _PARAM_VALUES(), BColor, styleDots|styleNoLabel);
//Plot( BB1, "BBBot1" + _PARAM_VALUES(), BColor, styleDots|styleNoLabel);

PlotOHLC( 0, BT1 , BT , BT , "Cloud", IIf(BT1 > BT ,ColorRGB(25,25,100),colorDarkTeal), styleCloud | styleNoLabel);

PlotOHLC( 0, BB , BB1 , BB1 , "Cloud", IIf(BB > BB1 ,ColorRGB(25,25,100),colorDarkTeal), styleCloud | styleNoLabel);

_SECTION_END();Plot(EMA(C,20),"",IIf(C > EMA(C,20),colorBrightGreen,colorRed),styleLine|styleThick);



رد مع اقتباس
قديم 12-03-2016, 07:35 PM
  المشاركه #27

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

تاريخ التسجيل: Apr 2012
المشاركات: 223
amm1430 غير متواجد حالياً  

AddTextColumn( FullName(), "full____________ name", 77 , colorDefault );
_SECTION_BEGIN("SAR");
acc = Param("Acceleration", 0.02, 0, 1, 0.001 );
accm = Param("Max. acceleration", 0.2, 0, 1, 0.001 );
Plot( SAR( acc, accm ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style", styleDots | styleNoLine, maskDefault | styleDots | styleNoLine ) );
_SECTION_END();
_SECTION_BEGIN("EMA CROSSOVER CHART");
LongPer = Param("Long Period", 25, 30, 100, 5);
ShortPer = Param("Short Period", 50, 30, 100, 5);
LongMA = EMA(C, LongPer);
ShortMA = EMA(C, ShortPer);
LastHigh = HHV(H, LongPer);
GraphXSpace = 10;
Buy = Cross(LongMA, ShortMA);
Short=SAR( acc, accm )>C;
Sell = Cross(ShortMA, LongMA);
Cover=SAR( acc, accm )<C;

Buy=ExRem(Buy,Sell);
Short=ExRem(Short,Cover);
Sell=ExRem(Sell,Buy);
Cover=ExRem(Cover,Short);

PlotShapes(Buy*shapeSmallUpTriangle,colorBlue ,0,L,-51);
PlotShapes(Short*shapeHollowDownTriangle,colorPink , 0,L,-45);
PlotShapes(Sell*shapeSmallDownTriangle,colorRed,0, H,-51);
PlotShapes(Cover*shapeHollowUpTriangle,colorSkyblue,0,H,-45);




per=Param("ZigZag change amount", 1, 0.1,100,0.1);
cbar = Param("cbar",4,2,50,1);
pk=PeakBars(H,per)==0;
tr=TroughBars(L,per)==0;
zzHi=Zig(H,per);
zzLo=Zig(L,per);
Avg=(zzHi+zzLo)/2;
x=IIf(pk,zzHi,IIf(tr,zzLo,IIf(Avg>Ref(Avg,-1),H,L)));
zzHiLo=Zig(x,per);
Plot( zzHiLo, "", ParamColor("Color",colorRed), ParamStyle("Style"));

pR=PeakBars(H,per)==0;
pS =TroughBars(L,per)==0;
RF=ValueWhen(pR,H);
SF=ValueWhen(pS,L);
RF1 = IIf(RF AND BarsSince(pR) <=cbar,RF,Null);
SF1 = IIf(SF AND BarsSince(pS ) <=cbar,SF,Null);
Plot(RF1,"",colorWhite,styleDots | styleNoLine);
Plot(SF1,"",colorWhite,styleDots | styleNoLine);
Plot(RF,"",colorBlack,40+16);
Plot(SF,"",colorBlack,40+16);

Buy=Cross(C,RF1);
Sell=Cross(SF1,C);
PlotShapes(IIf(Buy,shapeSmallUpTriangle,shapeNone),colorWhite,0,L,-12);
PlotShapes(IIf(Sell,shapeSmallDownTriangle, shapeNone),colorWhite,0,H,-12);
_SECTION_BEGIN("Exploration");
Filter=Close;
Var = WriteIf(Buy,"BUY",WriteIf(Sell,"SELL",""));
AddTextColumn(Var , "Buy/Sell", 1.2 , colorWhite, IIf( Buy, colorBlue,IIf(Sell,colorRed,colorWhite) ));
//==============================
psh= ParamToggle("Pivot Shapes","Off|On",1);
plb= ParamToggle("Pivot Labels","Off|On",1);
snd= ParamToggle("Sound Alerts","Off|On",1);
lbk= Param("Hi Lo Lookback",350,50,5000,10);
nbz= Param("Swing Bars",5,5,150,1);
tht= Param("Hi Label Adjust",0.65,0.10,5,0.05)*ATR(5);
lbk= Min(BarCount-1,Lbk);
bc=BarCount-1;
//================
xH=H-H; xL=L-L; yH=H-H; yL=L-L; xR=H-H; xS=L-L;
xrb=0; xSb=0; yR0=0; yS0=0; xR0=0; xS0=0; xx=0;
xHH= HHVBars(H,nbz); xLL= LLVBars(L,nbz);
yHH= HHV(H,nbz); yLL= LLV(L,nbz);
viz= Status("BarVisible");
vbz= LastValue(Highest(IIf(viz,BarIndex(),0)));
_TRACE("Last visible bar: "+ vbz);
bct= (BarCount-1); = "";
if(xLL[bc]<xHH[bc]) { ="D"; } else { ="U"; }
for(i=0; i<lbk; i++) { bc=bct-i;
if(xLL[bc]<xHH[bc]) { if(=="U"){="D";
xx=bc-xLL[bc]; xL[xx]=1;
yL[xSb]=L[xx]; xS[xSb]=xx; xSb++; }
} else { if(=="D") { = "U";
xx=bc-xHH[bc]; xH[xx]=1; yH[xrb]=H[xx]; xR[xrb]=xx;xrb++; }}}
xP= 0; yP= 0; xS0= xS[0]; yS0=yL[0]; xR0= xR[0]; yR0= yH[0];
if(xS0>xR0) { xP=bc-xHH[bc]; yP= yHH[bc];
if(yR0<yP AND xP>xS0 AND xP<bc) { xH[xP]=1;
for(j=0; j<xrb; j++) { yH[xrb-j]= yH[xrb-(j+1)];
xR[xrb-j]= xR[xrb-(j+1)]; }
yH[0]= yP; xR[0]= xP; xrb++; }
} else { xP= bc-xLL[bc]; yP= yLL[bc];
if(yS0>yP AND xP>xR0 AND xP<bc) { xL[xP]=1;
for(j=0; j<xSb; j++) { yL[xSb-j]= yL[xSb-(j+1)]; xS[xSb-j]= xS[xSb-(j+1)]; }
yL[0]=yP; xS[0]=xP; xSb++; }}
ushp=shapeHollowUpArrow; dshp=shapeHollowDownArrow;
if(psh)
if(snd) {
AlertIf(xL==1,"SOUND C:\\Windows\\Media\\Windows XP Startup.wav","Audio alert",2);
AlertIf(xH==1,"SOUND C:\\Windows\\Media\\Ringin.wav","Audio alert",2); }
Buy=(xL); Sell=(xH); Cover=(xL); Short=(xH); Long=Flip(Buy,Sell); Shrt=Flip(Sell,Buy);
SellPrice=ValueWhen(Sell,H,1); BuyPrice= ValueWhen(Buy,L,1);
if(plb) {
for(i=0; i<BarCount; i++) {
if(Buy[i] )PlotText("\n\n"+ StrRight(NumToStr(L[i],6.2),10),i-1,L[i],colorWhite);
if(Sell[i])PlotText(StrRight(NumToStr(H[i],6.2),10),i-1,H[i]+tht[i],colorWhite); }
}



_SECTION_BEGIN("Natraj EOD Tech Chart");
GraphXSpace = 15;_SECTION_BEGIN("???? ?????");
r1 = Param( "Fast avg", 11, 3, 20, 1 );
r2 = Param( "Slow avg", 35, 10, 35, 1 );
r3 = Param( "Signal avg", 6, 3, 20, 1 );
ml = MACD(r1, r2);
sl = Signal(r1,r2,r3);
Hst = ml-sl;
A1=EMA(C,4)-EMA(C,34);
BBtops=BBandTop(A1,10,1);
BBbots=BBandBot(A1,10,1);

Color_bar=IIf(a1>BBtops, colorBlue,IIf(a1<BBbots,colorRed,colorYellow));

bbtop = BBandTop( Hst, 10, 1 );
bbbot = BBandBot( Hst, 10,1 );

Color = IIf (Hst > BBtop,colorBlue,IIf(hst < bbbot,colorRed, IIf (Hst > 0,colorBlue,colorRed)));Buy = Cross (Hst,bbtop);Sell = Cross (bbtop,Hst);Short = Cross (bbbot,Hst);Cover = Cross (Hst,bbbot);
Plot (Close,"close",Color_bar,styleCandle);



_SECTION_BEGIN("EMA1");
P = ParamField("Price field",-1);
_SECTION_END();

PI = atan(1.00) * 4;
periods = 30;
HighHigh = HHV(H, periods);
LowLow = LLV(L, periods);
range = 25 / (HighHigh - LowLow) * LowLow;
MA1= EMA(C,200);
x1_MA = 0;
x2_MA= 1;
y1_MA= 0;
y2_MA= (Ref(MA1, -1) - MA1) / Avg * range;
c_MA= sqrt((x2_MA- x1_MA)*(x2_MA- x1_MA) + (y2_MA- y1_MA)*(y2_MA- y1_MA));
angle_MA= round(180 * acos((x2_MA - x1_MA)/c_MA) / PI);
angle_MA= IIf(y2_MA> 0, - angle_MA, angle_MA);
Col=IIf(angle_MA>3,colorWhite,IIf(angle_MA<(-3),colorRed,colorBlack));
Plot(EMA( P,200), _DEFAULT_NAME(), Col, ParamStyle("Style") );










/*
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);

AlertIf(Down AND (ValidLow OR ZeroValid), "SOUND C:\\Windows\\Media\\Chord.wav", "Audio alert", 2);
AlertIf(Up AND (ValidHigh OR ZeroValid), "SOUND C:\\Windows\\Media\\Ding.wav", "Audio alert", 2);
//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_BEGIN("EMA1");
P = ParamField("Price field",-1);
_SECTION_END();

PI = atan(1.00) * 4;
periods = 30;
HighHigh = HHV(H, periods);
LowLow = LLV(L, periods);
range = 25 / (HighHigh - LowLow) * LowLow;
MA1= EMA(C,200);
x1_MA = 0;
x2_MA= 1;
y1_MA= 0;
y2_MA= (Ref(MA1, -1) - MA1) / Avg * range;
c_MA= sqrt((x2_MA- x1_MA)*(x2_MA- x1_MA) + (y2_MA- y1_MA)*(y2_MA- y1_MA));
angle_MA= round(180 * acos((x2_MA - x1_MA)/c_MA) / PI);
angle_MA= IIf(y2_MA> 0, - angle_MA, angle_MA);
Col=IIf(angle_MA>3,colorWhite,IIf(angle_MA<(-3),colorRed,colorBlack));
Plot(EMA( P,200), _DEFAULT_NAME(), Col, ParamStyle("Style") );


_SECTION_BEGIN("Natraj EOD Tech Chart");
GraphXSpace = 15;_SECTION_BEGIN("???? ?????");
r1 = Param( "Fast avg", 11, 3, 20, 1 );
r2 = Param( "Slow avg", 35, 10, 35, 1 );
r3 = Param( "Signal avg", 6, 3, 20, 1 );
ml = MACD(r1, r2);
sl = Signal(r1,r2,r3);
Hst = ml-sl;
A1=EMA(C,4)-EMA(C,34);
BBtops=BBandTop(A1,10,1);
BBbots=BBandBot(A1,10,1);

Color_bar=IIf(a1>BBtops, colorBlue,IIf(a1<BBbots,colorRed,colorYellow));

bbtop = BBandTop( Hst, 10, 1 );
bbbot = BBandBot( Hst, 10,1 );

Color = IIf (Hst > BBtop,colorBlue,IIf(hst < bbbot,colorRed, IIf (Hst > 0,colorBlue,colorRed)));Buy = Cross (Hst,bbtop);Sell = Cross (bbtop,Hst);Short = Cross (bbbot,Hst);Cover = Cross (Hst,bbbot);
Plot (Close,"close",Color_bar,styleCandle);



_SECTION_BEGIN("EMA1");
P = ParamField("Price field",-1);
_SECTION_END();

PI = atan(1.00) * 4;
periods = 30;
HighHigh = HHV(H, periods);
LowLow = LLV(L, periods);
range = 25 / (HighHigh - LowLow) * LowLow;
MA1= EMA(C,200);
x1_MA = 0;
x2_MA= 1;
y1_MA= 0;
y2_MA= (Ref(MA1, -1) - MA1) / Avg * range;
c_MA= sqrt((x2_MA- x1_MA)*(x2_MA- x1_MA) + (y2_MA- y1_MA)*(y2_MA- y1_MA));
angle_MA= round(180 * acos((x2_MA - x1_MA)/c_MA) / PI);
angle_MA= IIf(y2_MA> 0, - angle_MA, angle_MA);
Col=IIf(angle_MA>3,colorWhite,IIf(angle_MA<(-3),colorRed,colorBlack));
Plot(EMA( P,200), _DEFAULT_NAME(), Col, ParamStyle("Style") );


_SECTION_BEGIN("Intraday System_Candle_Alerts BS on 200 ema");
/* Intraday template */

GraphXSpace = 3 ;

/* These are the calcs for the oscilator values and plots the paint
bars*/
Osc = EMA(C,8) - EMA(C,34);
acc = Osc - EMA(Osc,13);
col = IIf(Osc > Ref(Osc,-1) AND acc > Ref(acc,-1),colorTurquoise,IIf(Osc < Ref(Osc,-1) AND acc < Ref(acc,-1),colorTan,colorLightBlue));
barcolor= 1;
Plot( Close, "Intraday Template" ,col/barcolor, styleCandle,styleThick|styleNoLabel);
// this sets the color of the body of the candlesticks to default

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

/* This is the code for the exponential moving average flipper */

mov = 200;
hi = EMA(H,mov);
lo = EMA(L,mov) ;
x1 = IIf(C>Ref(hi,-1),1,IIf(C<Ref(lo,-1),-1,0));
x2 = ValueWhen(x1!=0,x1,1);
st = IIf(x2==-1,Hi,Lo);
//Plot(st,"",colorYellow,styleNoLine|styleDots);
Buy=Cross(C,st);
Sell=Cross( Signal(), MACD() ) OR TimeNum()>151500;
Short=Cross(st,C);
Cover=Cross( MACD(), Signal() ) OR TimeNum()>151500;
shape = Buy * shapeUpTriangle + Short * shapeDownTriangle;
AlertIf( Short, "SOUND C:\\Windows\\Media\\ringout.wav", "Audio alert", 2 );
AlertIf( Buy, "SOUND C:\\Windows\\Media\\ringout.wav", "Audio alert", 2 );
PlotShapes( shape, IIf( Buy, colorYellow, colorCustom12 ),0, IIf( Buy, Low,
High ) );

GraphXSpace = 5;
dist = 2.5*ATR(10);

for( i = 0; i < BarCount; i++ )
{
if( Buy[i] ) PlotText( "Buy\n" + C[ i ], i, L[ i ]-dist[i], colorGreen
);
if( Short[i] ) PlotText( "Short\n" + C[ i ], i, H[ i ]+dist[i],
colorRed);
}
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g,
Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C,SelectedValue( ROC( C,
1 ) ) ));


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

/* This next code calculates the previous days high, low and close */

Hi1 =
IIf(Day()!=Ref(Day(),-1),Ref(HighestSince(Day()!=Ref(Day(),-1),H,1),-1),0);
Hi = ValueWhen(Day()!=Ref(Day(),-1),Hi1,1);
Lo1 =
IIf(Day()!=Ref(Day(),-1),Ref(LowestSince(Day()!=Ref(Day(),-1),L,1),-1),0);
Lo = ValueWhen(Day()!=Ref(Day(),-1),Lo1,1);
Cl1 = IIf(Day()!=Ref(Day(),-1),Ref(C,-1),0);
Cl = ValueWhen(Day()!=Ref(Day(),-1),Cl1,1);

/*This code calculates the time left in the bar*/

//File: TimeLeft in Bar
//Sept 20, 2005
// Compute Time Left In Bar
//

BarTime1 = LastValue(TimeNum() - Now(4));
DataError = IIf(Now(4) > TimeNum(),True,False);
TimeBase = IIf(Interval(1)>0,1,0);


_N(StrBarTime = NumToStr(BarTime1,1.0,False));
BT_Length = StrLen(StrBarTime);


_N(TimeLeft_ = WriteIf(BT_Length==1,"0:0"+StrBarTime,WriteIf(BT_Length==2,"0:"+StrBarTime,
WriteIf(BT_Length==3,StrLeft(StrBarTime,1)+":"+StrRight(StrBarTime,2),
StrLeft(StrBarTime,2)+":"+StrRight(StrBarTime,2))) ));

TimeLeft = WriteIf(TimeBase==1,TimeLeft_,"N/A");



//////////////////////////////////////////////////////////////////////////////
Filter=Buy OR Short;

AddColumn( IIf(Buy,1,IIf(Short,-1,Null)) ,"Buy/Short",1.0,colorWhite,IIf(Buy,colorDarkGreen,IIf(Short,colorRed,Null)),100);
AddColumn( IIf(Cover,2,IIf(Sell,-2,Null)) ,"Cover/Sell",1.0,colorWhite,IIf(Cover,colorLightBlue,IIf( Sell,colorCustom12,Null)),100);




_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | styleHidden | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("BB_double_(H+L)_20");



////BOL BAND 18////////////////////////////////////////////////////////




P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );


M = (H+L)/2;

BT = BBandTop( M, 20, 1.5 );
BB = BBandBot( M, 20, 1.5 );

BColor = ColorRGB(5,125,150);
//Plot( BT, "BBTop" + _PARAM_VALUES(), BColor, styleDots|styleThick|styleNoLabel);
//Plot( BB, "BBBot" + _PARAM_VALUES(), BColor, styleDots|styleThick|styleNoLabel);



BT1 = BBandTop( M, 20, 2.2 );
BB1 = BBandBot( M, 20, 2.2 );
//Plot( BT1, "BBTop1" + _PARAM_VALUES(), BColor, styleDots|styleNoLabel);
//Plot( BB1, "BBBot1" + _PARAM_VALUES(), BColor, styleDots|styleNoLabel);

PlotOHLC( 0, BT1 , BT , BT , "Cloud", IIf(BT1 > BT ,ColorRGB(25,25,100),colorDarkTeal), styleCloud | styleNoLabel);

PlotOHLC( 0, BB , BB1 , BB1 , "Cloud", IIf(BB > BB1 ,ColorRGB(25,25,100),colorDarkTeal), styleCloud | styleNoLabel);

_SECTION_END();Plot(EMA(C,20),"",IIf(C > EMA(C,20),colorBrightGreen,colorRed),styleLine|styleThick);


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



رد مع اقتباس
قديم 18-03-2016, 01:41 PM
  المشاركه #28

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

تاريخ التسجيل: Jul 2005
المشاركات: 1,307
أسعار غير متواجد حالياً  

الف شكر اخوي amm1430

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



رد مع اقتباس
قديم 19-03-2016, 02:04 AM
  المشاركه #29

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

تاريخ التسجيل: Oct 2011
المشاركات: 232
fhfh1 غير متواجد حالياً  

ممكن البرنامج مع الكراك اغلب الموجوده بالموقع غير موجود بالرابط او تم ازالته
مشكورين
( الايمي بروكر )



رد مع اقتباس
قديم 20-03-2016, 10:24 PM
  المشاركه #30

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

تاريخ التسجيل: Apr 2012
المشاركات: 223
amm1430 غير متواجد حالياً  

[QUOTE=أسعار;33410222]الف شكر اخوي amm1430

لكن ياليتك فرقت بين المعادلات او ارفقتها نكون ممنونين
[/QUOTE
يعطيك العافيه اخوى تفضل المعادله الاخيره

























AddTextColumn( FullName(), "full____________ name", 77 , colorDefault );


_SECTION_BEGIN("Natraj EOD Tech Chart");
GraphXSpace = 15;_SECTION_BEGIN("???? ?????");
r1 = Param( "Fast avg", 11, 3, 20, 1 );
r2 = Param( "Slow avg", 35, 10, 35, 1 );
r3 = Param( "Signal avg", 6, 3, 20, 1 );
ml = MACD(r1, r2);
sl = Signal(r1,r2,r3);
Hst = ml-sl;
A1=EMA(C,4)-EMA(C,34);
BBtops=BBandTop(A1,10,1);
BBbots=BBandBot(A1,10,1);

Color_bar=IIf(a1>BBtops, colorBlue,IIf(a1<BBbots,colorRed,colorYellow));

bbtop = BBandTop( Hst, 10, 1 );
bbbot = BBandBot( Hst, 10,1 );

Color = IIf (Hst > BBtop,colorBlue,IIf(hst < bbbot,colorRed, IIf (Hst > 0,colorBlue,colorRed)));Buy = Cross (Hst,bbtop);Sell = Cross (bbtop,Hst);Short = Cross (bbbot,Hst);Cover = Cross (Hst,bbbot);
Plot (Close,"close",Color_bar,styleCandle);

_SECTION_BEGIN("SAR");
acc = Param("Acceleration", 0.02, 0, 1, 0.001 );
accm = Param("Max. acceleration", 0.2, 0, 1, 0.001 );
Plot( SAR( acc, accm ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style", styleDots | styleNoLine, maskDefault | styleDots | styleNoLine ) );
_SECTION_END();
_SECTION_BEGIN("EMA CROSSOVER CHART");
LongPer = Param("Long Period", 25, 30, 100, 5);
ShortPer = Param("Short Period", 50, 30, 100, 5);
LongMA = EMA(C, LongPer);
ShortMA = EMA(C, ShortPer);
LastHigh = HHV(H, LongPer);
GraphXSpace = 10;
Buy = Cross(LongMA, ShortMA);
Short=SAR( acc, accm )>C;
Sell = Cross(ShortMA, LongMA);
Cover=SAR( acc, accm )<C;

Buy=ExRem(Buy,Sell);
Short=ExRem(Short,Cover);
Sell=ExRem(Sell,Buy);
Cover=ExRem(Cover,Short);

PlotShapes(Buy*shapeSmallUpTriangle,colorBlue ,0,L,-51);
PlotShapes(Short*shapeHollowDownTriangle,colorPink , 0,L,-45);
PlotShapes(Sell*shapeSmallDownTriangle,colorRed,0, H,-51);
PlotShapes(Cover*shapeHollowUpTriangle,colorSkyblue,0,H,-45);




per=Param("ZigZag change amount", 1, 0.1,100,0.1);
cbar = Param("cbar",4,2,50,1);
pk=PeakBars(H,per)==0;
tr=TroughBars(L,per)==0;
zzHi=Zig(H,per);
zzLo=Zig(L,per);
Avg=(zzHi+zzLo)/2;
x=IIf(pk,zzHi,IIf(tr,zzLo,IIf(Avg>Ref(Avg,-1),H,L)));
zzHiLo=Zig(x,per);
Plot( zzHiLo, "", ParamColor("Color",colorRed), ParamStyle("Style"));

pR=PeakBars(H,per)==0;
pS =TroughBars(L,per)==0;
RF=ValueWhen(pR,H);
SF=ValueWhen(pS,L);
RF1 = IIf(RF AND BarsSince(pR) <=cbar,RF,Null);
SF1 = IIf(SF AND BarsSince(pS ) <=cbar,SF,Null);
Plot(RF1,"",colorWhite,styleDots | styleNoLine);
Plot(SF1,"",colorWhite,styleDots | styleNoLine);
Plot(RF,"",colorBlack,40+16);
Plot(SF,"",colorBlack,40+16);

Buy=Cross(C,RF1);
Sell=Cross(SF1,C);
PlotShapes(IIf(Buy,shapeSmallUpTriangle,shapeNone),colorWhite,0,L,-12);
PlotShapes(IIf(Sell,shapeSmallDownTriangle, shapeNone),colorWhite,0,H,-12);
_SECTION_BEGIN("Exploration");
Filter=Close;
Var = WriteIf(Buy,"BUY",WriteIf(Sell,"SELL",""));
AddTextColumn(Var , "Buy/Sell", 1.2 , colorWhite, IIf( Buy, colorBlue,IIf(Sell,colorRed,colorWhite) ));
//==============================
psh= ParamToggle("Pivot Shapes","Off|On",1);
plb= ParamToggle("Pivot Labels","Off|On",1);
snd= ParamToggle("Sound Alerts","Off|On",1);
lbk= Param("Hi Lo Lookback",350,50,5000,10);
nbz= Param("Swing Bars",5,5,150,1);
tht= Param("Hi Label Adjust",0.65,0.10,5,0.05)*ATR(5);
lbk= Min(BarCount-1,Lbk);
bc=BarCount-1;
//================
xH=H-H; xL=L-L; yH=H-H; yL=L-L; xR=H-H; xS=L-L;
xrb=0; xSb=0; yR0=0; yS0=0; xR0=0; xS0=0; xx=0;
xHH= HHVBars(H,nbz); xLL= LLVBars(L,nbz);
yHH= HHV(H,nbz); yLL= LLV(L,nbz);
viz= Status("BarVisible");
vbz= LastValue(Highest(IIf(viz,BarIndex(),0)));
_TRACE("Last visible bar: "+ vbz);
bct= (BarCount-1); = "";
if(xLL[bc]<xHH[bc]) { ="D"; } else { ="U"; }
for(i=0; i<lbk; i++) { bc=bct-i;
if(xLL[bc]<xHH[bc]) { if(=="U"){="D";
xx=bc-xLL[bc]; xL[xx]=1;
yL[xSb]=L[xx]; xS[xSb]=xx; xSb++; }
} else { if(=="D") { = "U";
xx=bc-xHH[bc]; xH[xx]=1; yH[xrb]=H[xx]; xR[xrb]=xx;xrb++; }}}
xP= 0; yP= 0; xS0= xS[0]; yS0=yL[0]; xR0= xR[0]; yR0= yH[0];
if(xS0>xR0) { xP=bc-xHH[bc]; yP= yHH[bc];
if(yR0<yP AND xP>xS0 AND xP<bc) { xH[xP]=1;
for(j=0; j<xrb; j++) { yH[xrb-j]= yH[xrb-(j+1)];
xR[xrb-j]= xR[xrb-(j+1)]; }
yH[0]= yP; xR[0]= xP; xrb++; }
} else { xP= bc-xLL[bc]; yP= yLL[bc];
if(yS0>yP AND xP>xR0 AND xP<bc) { xL[xP]=1;
for(j=0; j<xSb; j++) { yL[xSb-j]= yL[xSb-(j+1)]; xS[xSb-j]= xS[xSb-(j+1)]; }
yL[0]=yP; xS[0]=xP; xSb++; }}
ushp=shapeHollowUpArrow; dshp=shapeHollowDownArrow;
if(psh)
if(snd) {
AlertIf(xL==1,"SOUND C:\\Windows\\Media\\Windows XP Startup.wav","Audio alert",2);
AlertIf(xH==1,"SOUND C:\\Windows\\Media\\Ringin.wav","Audio alert",2); }
Buy=(xL); Sell=(xH); Cover=(xL); Short=(xH); Long=Flip(Buy,Sell); Shrt=Flip(Sell,Buy);
SellPrice=ValueWhen(Sell,H,1); BuyPrice= ValueWhen(Buy,L,1);
if(plb) {
for(i=0; i<BarCount; i++) {
if(Buy[i] )PlotText("\n\n"+ StrRight(NumToStr(L[i],6.2),10),i-1,L[i],colorWhite);
if(Sell[i])PlotText(StrRight(NumToStr(H[i],6.2),10),i-1,H[i]+tht[i],colorWhite); }
}






_SECTION_BEGIN("EMA1");
P = ParamField("Price field",-1);
_SECTION_END();

PI = atan(1.00) * 4;
periods = 30;
HighHigh = HHV(H, periods);
LowLow = LLV(L, periods);
range = 25 / (HighHigh - LowLow) * LowLow;
MA1= EMA(C,200);
x1_MA = 0;
x2_MA= 1;
y1_MA= 0;
y2_MA= (Ref(MA1, -1) - MA1) / Avg * range;
c_MA= sqrt((x2_MA- x1_MA)*(x2_MA- x1_MA) + (y2_MA- y1_MA)*(y2_MA- y1_MA));
angle_MA= round(180 * acos((x2_MA - x1_MA)/c_MA) / PI);
angle_MA= IIf(y2_MA> 0, - angle_MA, angle_MA);
Col=IIf(angle_MA>3,colorWhite,IIf(angle_MA<(-3),colorRed,colorBlack));
Plot(EMA( P,200), _DEFAULT_NAME(), Col, ParamStyle("Style") );










/*
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);

AlertIf(Down AND (ValidLow OR ZeroValid), "SOUND C:\\Windows\\Media\\Chord.wav", "Audio alert", 2);
AlertIf(Up AND (ValidHigh OR ZeroValid), "SOUND C:\\Windows\\Media\\Ding.wav", "Audio alert", 2);
//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_BEGIN("EMA1");
P = ParamField("Price field",-1);
_SECTION_END();

PI = atan(1.00) * 4;
periods = 30;
HighHigh = HHV(H, periods);
LowLow = LLV(L, periods);
range = 25 / (HighHigh - LowLow) * LowLow;
MA1= EMA(C,200);
x1_MA = 0;
x2_MA= 1;
y1_MA= 0;
y2_MA= (Ref(MA1, -1) - MA1) / Avg * range;
c_MA= sqrt((x2_MA- x1_MA)*(x2_MA- x1_MA) + (y2_MA- y1_MA)*(y2_MA- y1_MA));
angle_MA= round(180 * acos((x2_MA - x1_MA)/c_MA) / PI);
angle_MA= IIf(y2_MA> 0, - angle_MA, angle_MA);
Col=IIf(angle_MA>3,colorWhite,IIf(angle_MA<(-3),colorRed,colorBlack));
Plot(EMA( P,200), _DEFAULT_NAME(), Col, ParamStyle("Style") );


_SECTION_BEGIN("Natraj EOD Tech Chart");
GraphXSpace = 15;_SECTION_BEGIN("???? ?????");
r1 = Param( "Fast avg", 11, 3, 20, 1 );
r2 = Param( "Slow avg", 35, 10, 35, 1 );
r3 = Param( "Signal avg", 6, 3, 20, 1 );
ml = MACD(r1, r2);
sl = Signal(r1,r2,r3);
Hst = ml-sl;
A1=EMA(C,4)-EMA(C,34);
BBtops=BBandTop(A1,10,1);
BBbots=BBandBot(A1,10,1);

Color_bar=IIf(a1>BBtops, colorBlue,IIf(a1<BBbots,colorRed,colorYellow));

bbtop = BBandTop( Hst, 10, 1 );
bbbot = BBandBot( Hst, 10,1 );

Color = IIf (Hst > BBtop,colorBlue,IIf(hst < bbbot,colorRed, IIf (Hst > 0,colorBlue,colorRed)));Buy = Cross (Hst,bbtop);Sell = Cross (bbtop,Hst);Short = Cross (bbbot,Hst);Cover = Cross (Hst,bbbot);
Plot (Close,"close",Color_bar,styleCandle);



_SECTION_BEGIN("EMA1");
P = ParamField("Price field",-1);
_SECTION_END();

PI = atan(1.00) * 4;
periods = 30;
HighHigh = HHV(H, periods);
LowLow = LLV(L, periods);
range = 25 / (HighHigh - LowLow) * LowLow;
MA1= EMA(C,200);
x1_MA = 0;
x2_MA= 1;
y1_MA= 0;
y2_MA= (Ref(MA1, -1) - MA1) / Avg * range;
c_MA= sqrt((x2_MA- x1_MA)*(x2_MA- x1_MA) + (y2_MA- y1_MA)*(y2_MA- y1_MA));
angle_MA= round(180 * acos((x2_MA - x1_MA)/c_MA) / PI);
angle_MA= IIf(y2_MA> 0, - angle_MA, angle_MA);
Col=IIf(angle_MA>3,colorWhite,IIf(angle_MA<(-3),colorRed,colorBlack));
Plot(EMA( P,200), _DEFAULT_NAME(), Col, ParamStyle("Style") );


_SECTION_BEGIN("Intraday System_Candle_Alerts BS on 200 ema");
/* Intraday template */

GraphXSpace = 3 ;

/* These are the calcs for the oscilator values and plots the paint
bars*/
Osc = EMA(C,8) - EMA(C,34);
acc = Osc - EMA(Osc,13);
col = IIf(Osc > Ref(Osc,-1) AND acc > Ref(acc,-1),colorTurquoise,IIf(Osc < Ref(Osc,-1) AND acc < Ref(acc,-1),colorTan,colorLightBlue));
barcolor= 1;
Plot( Close, "Intraday Template" ,col/barcolor, styleCandle,styleThick|styleNoLabel);
// this sets the color of the body of the candlesticks to default

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

/* This is the code for the exponential moving average flipper */

mov = 200;
hi = EMA(H,mov);
lo = EMA(L,mov) ;
x1 = IIf(C>Ref(hi,-1),1,IIf(C<Ref(lo,-1),-1,0));
x2 = ValueWhen(x1!=0,x1,1);
st = IIf(x2==-1,Hi,Lo);
//Plot(st,"",colorYellow,styleNoLine|styleDots);
Buy=Cross(C,st);
Sell=Cross( Signal(), MACD() ) OR TimeNum()>151500;
Short=Cross(st,C);
Cover=Cross( MACD(), Signal() ) OR TimeNum()>151500;
shape = Buy * shapeUpTriangle + Short * shapeDownTriangle;
AlertIf( Short, "SOUND C:\\Windows\\Media\\ringout.wav", "Audio alert", 2 );
AlertIf( Buy, "SOUND C:\\Windows\\Media\\ringout.wav", "Audio alert", 2 );
PlotShapes( shape, IIf( Buy, colorYellow, colorCustom12 ),0, IIf( Buy, Low,
High ) );

GraphXSpace = 5;
dist = 2.5*ATR(10);

for( i = 0; i < BarCount; i++ )
{
if( Buy[i] ) PlotText( "Buy\n" + C[ i ], i, L[ i ]-dist[i], colorGreen
);
if( Short[i] ) PlotText( "Short\n" + C[ i ], i, H[ i ]+dist[i],
colorRed);
}
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g,
Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C,SelectedValue( ROC( C,
1 ) ) ));


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

/* This next code calculates the previous days high, low and close */

Hi1 =
IIf(Day()!=Ref(Day(),-1),Ref(HighestSince(Day()!=Ref(Day(),-1),H,1),-1),0);
Hi = ValueWhen(Day()!=Ref(Day(),-1),Hi1,1);
Lo1 =
IIf(Day()!=Ref(Day(),-1),Ref(LowestSince(Day()!=Ref(Day(),-1),L,1),-1),0);
Lo = ValueWhen(Day()!=Ref(Day(),-1),Lo1,1);
Cl1 = IIf(Day()!=Ref(Day(),-1),Ref(C,-1),0);
Cl = ValueWhen(Day()!=Ref(Day(),-1),Cl1,1);

/*This code calculates the time left in the bar*/

//File: TimeLeft in Bar
//Sept 20, 2005
// Compute Time Left In Bar
//

BarTime1 = LastValue(TimeNum() - Now(4));
DataError = IIf(Now(4) > TimeNum(),True,False);
TimeBase = IIf(Interval(1)>0,1,0);


_N(StrBarTime = NumToStr(BarTime1,1.0,False));
BT_Length = StrLen(StrBarTime);


_N(TimeLeft_ = WriteIf(BT_Length==1,"0:0"+StrBarTime,WriteIf(BT_Length==2,"0:"+StrBarTime,
WriteIf(BT_Length==3,StrLeft(StrBarTime,1)+":"+StrRight(StrBarTime,2),
StrLeft(StrBarTime,2)+":"+StrRight(StrBarTime,2))) ));

TimeLeft = WriteIf(TimeBase==1,TimeLeft_,"N/A");



//////////////////////////////////////////////////////////////////////////////
Filter=Buy OR Short;

AddColumn( IIf(Buy,1,IIf(Short,-1,Null)) ,"Buy/Short",1.0,colorWhite,IIf(Buy,colorDarkGreen,IIf(Short,colorRed,Null)),100);
AddColumn( IIf(Cover,2,IIf(Sell,-2,Null)) ,"Cover/Sell",1.0,colorWhite,IIf(Cover,colorLightBlue,IIf( Sell,colorCustom12,Null)),100);




_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | styleHidden | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("BB_double_(H+L)_20");



////BOL BAND 18////////////////////////////////////////////////////////




P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );


M = (H+L)/2;

BT = BBandTop( M, 20, 1.5 );
BB = BBandBot( M, 20, 1.5 );

BColor = ColorRGB(5,125,150);
//Plot( BT, "BBTop" + _PARAM_VALUES(), BColor, styleDots|styleThick|styleNoLabel);
//Plot( BB, "BBBot" + _PARAM_VALUES(), BColor, styleDots|styleThick|styleNoLabel);



BT1 = BBandTop( M, 20, 2.2 );
BB1 = BBandBot( M, 20, 2.2 );
//Plot( BT1, "BBTop1" + _PARAM_VALUES(), BColor, styleDots|styleNoLabel);
//Plot( BB1, "BBBot1" + _PARAM_VALUES(), BColor, styleDots|styleNoLabel);

PlotOHLC( 0, BT1 , BT , BT , "Cloud", IIf(BT1 > BT ,ColorRGB(25,25,100),colorDarkTeal), styleCloud | styleNoLabel);

PlotOHLC( 0, BB , BB1 , BB1 , "Cloud", IIf(BB > BB1 ,ColorRGB(25,25,100),colorDarkTeal), styleCloud | styleNoLabel);

_SECTION_END();Plot(EMA(C,20),"",IIf(C > EMA(C,20),colorBrightGreen,colorRed),styleLine|styleThick);


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



رد مع اقتباس
قديم 27-03-2016, 04:36 PM
  المشاركه #31

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

تاريخ التسجيل: Aug 2005
المشاركات: 1,834
غنيمة غير متواجد حالياً  

يعطيك الف عافيه مجهوود تشكر عليه


رد مع اقتباس
قديم 27-03-2016, 11:03 PM
  المشاركه #32

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

تاريخ التسجيل: Apr 2012
المشاركات: 223
amm1430 غير متواجد حالياً  

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



رد مع اقتباس
قديم 17-06-2016, 10:55 AM
  المشاركه #33

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

تاريخ التسجيل: Dec 2014
المشاركات: 1,001
الكاد غير متواجد حالياً  

بارك الله فيك


رد مع اقتباس
قديم 19-06-2016, 04:58 AM
  المشاركه #34

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

تاريخ التسجيل: Apr 2012
المشاركات: 223
amm1430 غير متواجد حالياً  

الانفجار السعري يتم تعديل البلونجر السفلى الى 10و2.50 وتختار اللون المفضلرد: معادلات للمضارب اللحظي على الايمى بروكر
















AddTextColumn( FullName(), "full____________ name", 77 , colorDefault );


_SECTION_BEGIN("Natraj EOD Tech Chart");
GraphXSpace = 15;_SECTION_BEGIN("???? ?????");
r1 = Param( "Fast avg", 11, 3, 20, 1 );
r2 = Param( "Slow avg", 35, 10, 35, 1 );
r3 = Param( "Signal avg", 6, 3, 20, 1 );
ml = MACD(r1, r2);
sl = Signal(r1,r2,r3);
Hst = ml-sl;
A1=EMA(C,4)-EMA(C,34);
BBtops=BBandTop(A1,10,1);
BBbots=BBandBot(A1,10,1);

Color_bar=IIf(a1>BBtops, colorBlue,IIf(a1<BBbots,colorRed,colorYellow));

bbtop = BBandTop( Hst, 10, 1 );
bbbot = BBandBot( Hst, 10,1 );

Color = IIf (Hst > BBtop,colorBlue,IIf(hst < bbbot,colorRed, IIf (Hst > 0,colorBlue,colorRed)));Buy = Cross (Hst,bbtop);Sell = Cross (bbtop,Hst);Short = Cross (bbbot,Hst);Cover = Cross (Hst,bbbot);
Plot (Close,"close",Color_bar,styleCandle);

_SECTION_BEGIN("SAR");
acc = Param("Acceleration", 0.02, 0, 1, 0.001 );
accm = Param("Max. acceleration", 0.2, 0, 1, 0.001 );
Plot( SAR( acc, accm ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style", styleDots | styleNoLine, maskDefault | styleDots | styleNoLine ) );
_SECTION_END();
_SECTION_BEGIN("EMA CROSSOVER CHART");
LongPer = Param("Long Period", 25, 30, 100, 5);
ShortPer = Param("Short Period", 50, 30, 100, 5);
LongMA = EMA(C, LongPer);
ShortMA = EMA(C, ShortPer);
LastHigh = HHV(H, LongPer);
GraphXSpace = 10;
Buy = Cross(LongMA, ShortMA);
Short=SAR( acc, accm )>C;
Sell = Cross(ShortMA, LongMA);
Cover=SAR( acc, accm )<C;

Buy=ExRem(Buy,Sell);
Short=ExRem(Short,Cover);
Sell=ExRem(Sell,Buy);
Cover=ExRem(Cover,Short);

PlotShapes(Buy*shapeSmallUpTriangle,colorBlue ,0,L,-51);
PlotShapes(Short*shapeHollowDownTriangle,colorPink , 0,L,-45);
PlotShapes(Sell*shapeSmallDownTriangle,colorRed,0, H,-51);
PlotShapes(Cover*shapeHollowUpTriangle,colorSkyblue,0,H,-45);




per=Param("ZigZag change amount", 1, 0.1,100,0.1);
cbar = Param("cbar",4,2,50,1);
pk=PeakBars(H,per)==0;
tr=TroughBars(L,per)==0;
zzHi=Zig(H,per);
zzLo=Zig(L,per);
Avg=(zzHi+zzLo)/2;
x=IIf(pk,zzHi,IIf(tr,zzLo,IIf(Avg>Ref(Avg,-1),H,L)));
zzHiLo=Zig(x,per);
Plot( zzHiLo, "", ParamColor("Color",colorRed), ParamStyle("Style"));

pR=PeakBars(H,per)==0;
pS =TroughBars(L,per)==0;
RF=ValueWhen(pR,H);
SF=ValueWhen(pS,L);
RF1 = IIf(RF AND BarsSince(pR) <=cbar,RF,Null);
SF1 = IIf(SF AND BarsSince(pS ) <=cbar,SF,Null);
Plot(RF1,"",colorWhite,styleDots | styleNoLine);
Plot(SF1,"",colorWhite,styleDots | styleNoLine);
Plot(RF,"",colorBlack,40+16);
Plot(SF,"",colorBlack,40+16);

Buy=Cross(C,RF1);
Sell=Cross(SF1,C);
PlotShapes(IIf(Buy,shapeSmallUpTriangle,shapeNone),colorWhite,0,L,-12);
PlotShapes(IIf(Sell,shapeSmallDownTriangle, shapeNone),colorWhite,0,H,-12);
_SECTION_BEGIN("Exploration");
Filter=Close;
Var = WriteIf(Buy,"BUY",WriteIf(Sell,"SELL",""));
AddTextColumn(Var , "Buy/Sell", 1.2 , colorWhite, IIf( Buy, colorBlue,IIf(Sell,colorRed,colorWhite) ));
//==============================
psh= ParamToggle("Pivot Shapes","Off|On",1);
plb= ParamToggle("Pivot Labels","Off|On",1);
snd= ParamToggle("Sound Alerts","Off|On",1);
lbk= Param("Hi Lo Lookback",350,50,5000,10);
nbz= Param("Swing Bars",5,5,150,1);
tht= Param("Hi Label Adjust",0.65,0.10,5,0.05)*ATR(5);
lbk= Min(BarCount-1,Lbk);
bc=BarCount-1;
//================
xH=H-H; xL=L-L; yH=H-H; yL=L-L; xR=H-H; xS=L-L;
xrb=0; xSb=0; yR0=0; yS0=0; xR0=0; xS0=0; xx=0;
xHH= HHVBars(H,nbz); xLL= LLVBars(L,nbz);
yHH= HHV(H,nbz); yLL= LLV(L,nbz);
viz= Status("BarVisible");
vbz= LastValue(Highest(IIf(viz,BarIndex(),0)));
_TRACE("Last visible bar: "+ vbz);
bct= (BarCount-1); = "";
if(xLL[bc]<xHH[bc]) { ="D"; } else { ="U"; }
for(i=0; i<lbk; i++) { bc=bct-i;
if(xLL[bc]<xHH[bc]) { if(=="U"){="D";
xx=bc-xLL[bc]; xL[xx]=1;
yL[xSb]=L[xx]; xS[xSb]=xx; xSb++; }
} else { if(=="D") { = "U";
xx=bc-xHH[bc]; xH[xx]=1; yH[xrb]=H[xx]; xR[xrb]=xx;xrb++; }}}
xP= 0; yP= 0; xS0= xS[0]; yS0=yL[0]; xR0= xR[0]; yR0= yH[0];
if(xS0>xR0) { xP=bc-xHH[bc]; yP= yHH[bc];
if(yR0<yP AND xP>xS0 AND xP<bc) { xH[xP]=1;
for(j=0; j<xrb; j++) { yH[xrb-j]= yH[xrb-(j+1)];
xR[xrb-j]= xR[xrb-(j+1)]; }
yH[0]= yP; xR[0]= xP; xrb++; }
} else { xP= bc-xLL[bc]; yP= yLL[bc];
if(yS0>yP AND xP>xR0 AND xP<bc) { xL[xP]=1;
for(j=0; j<xSb; j++) { yL[xSb-j]= yL[xSb-(j+1)]; xS[xSb-j]= xS[xSb-(j+1)]; }
yL[0]=yP; xS[0]=xP; xSb++; }}
ushp=shapeHollowUpArrow; dshp=shapeHollowDownArrow;
if(psh)
if(snd) {
AlertIf(xL==1,"SOUND C:\\Windows\\Media\\Windows XP Startup.wav","Audio alert",2);
AlertIf(xH==1,"SOUND C:\\Windows\\Media\\Ringin.wav","Audio alert",2); }
Buy=(xL); Sell=(xH); Cover=(xL); Short=(xH); Long=Flip(Buy,Sell); Shrt=Flip(Sell,Buy);
SellPrice=ValueWhen(Sell,H,1); BuyPrice= ValueWhen(Buy,L,1);
if(plb) {
for(i=0; i<BarCount; i++) {
if(Buy[i] )PlotText("\n\n"+ StrRight(NumToStr(L[i],6.2),10),i-1,L[i],colorWhite);
if(Sell[i])PlotText(StrRight(NumToStr(H[i],6.2),10),i-1,H[i]+tht[i],colorWhite); }
}






_SECTION_BEGIN("EMA1");
P = ParamField("Price field",-1);
_SECTION_END();

PI = atan(1.00) * 4;
periods = 30;
HighHigh = HHV(H, periods);
LowLow = LLV(L, periods);
range = 25 / (HighHigh - LowLow) * LowLow;
MA1= EMA(C,200);
x1_MA = 0;
x2_MA= 1;
y1_MA= 0;
y2_MA= (Ref(MA1, -1) - MA1) / Avg * range;
c_MA= sqrt((x2_MA- x1_MA)*(x2_MA- x1_MA) + (y2_MA- y1_MA)*(y2_MA- y1_MA));
angle_MA= round(180 * acos((x2_MA - x1_MA)/c_MA) / PI);
angle_MA= IIf(y2_MA> 0, - angle_MA, angle_MA);
Col=IIf(angle_MA>3,colorWhite,IIf(angle_MA<(-3),colorRed,colorBlack));
Plot(EMA( P,200), _DEFAULT_NAME(), Col, ParamStyle("Style") );










/*
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);

AlertIf(Down AND (ValidLow OR ZeroValid), "SOUND C:\\Windows\\Media\\Chord.wav", "Audio alert", 2);
AlertIf(Up AND (ValidHigh OR ZeroValid), "SOUND C:\\Windows\\Media\\Ding.wav", "Audio alert", 2);
//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_BEGIN("EMA1");
P = ParamField("Price field",-1);
_SECTION_END();

PI = atan(1.00) * 4;
periods = 30;
HighHigh = HHV(H, periods);
LowLow = LLV(L, periods);
range = 25 / (HighHigh - LowLow) * LowLow;
MA1= EMA(C,200);
x1_MA = 0;
x2_MA= 1;
y1_MA= 0;
y2_MA= (Ref(MA1, -1) - MA1) / Avg * range;
c_MA= sqrt((x2_MA- x1_MA)*(x2_MA- x1_MA) + (y2_MA- y1_MA)*(y2_MA- y1_MA));
angle_MA= round(180 * acos((x2_MA - x1_MA)/c_MA) / PI);
angle_MA= IIf(y2_MA> 0, - angle_MA, angle_MA);
Col=IIf(angle_MA>3,colorWhite,IIf(angle_MA<(-3),colorRed,colorBlack));
Plot(EMA( P,200), _DEFAULT_NAME(), Col, ParamStyle("Style") );


_SECTION_BEGIN("Natraj EOD Tech Chart");
GraphXSpace = 15;_SECTION_BEGIN("???? ?????");
r1 = Param( "Fast avg", 11, 3, 20, 1 );
r2 = Param( "Slow avg", 35, 10, 35, 1 );
r3 = Param( "Signal avg", 6, 3, 20, 1 );
ml = MACD(r1, r2);
sl = Signal(r1,r2,r3);
Hst = ml-sl;
A1=EMA(C,4)-EMA(C,34);
BBtops=BBandTop(A1,10,1);
BBbots=BBandBot(A1,10,1);

Color_bar=IIf(a1>BBtops, colorBlue,IIf(a1<BBbots,colorRed,colorYellow));

bbtop = BBandTop( Hst, 10, 1 );
bbbot = BBandBot( Hst, 10,1 );

Color = IIf (Hst > BBtop,colorBlue,IIf(hst < bbbot,colorRed, IIf (Hst > 0,colorBlue,colorRed)));Buy = Cross (Hst,bbtop);Sell = Cross (bbtop,Hst);Short = Cross (bbbot,Hst);Cover = Cross (Hst,bbbot);
Plot (Close,"close",Color_bar,styleCandle);



_SECTION_BEGIN("EMA1");
P = ParamField("Price field",-1);
_SECTION_END();

PI = atan(1.00) * 4;
periods = 30;
HighHigh = HHV(H, periods);
LowLow = LLV(L, periods);
range = 25 / (HighHigh - LowLow) * LowLow;
MA1= EMA(C,200);
x1_MA = 0;
x2_MA= 1;
y1_MA= 0;
y2_MA= (Ref(MA1, -1) - MA1) / Avg * range;
c_MA= sqrt((x2_MA- x1_MA)*(x2_MA- x1_MA) + (y2_MA- y1_MA)*(y2_MA- y1_MA));
angle_MA= round(180 * acos((x2_MA - x1_MA)/c_MA) / PI);
angle_MA= IIf(y2_MA> 0, - angle_MA, angle_MA);
Col=IIf(angle_MA>3,colorWhite,IIf(angle_MA<(-3),colorRed,colorBlack));
Plot(EMA( P,200), _DEFAULT_NAME(), Col, ParamStyle("Style") );


_SECTION_BEGIN("Intraday System_Candle_Alerts BS on 200 ema");
/* Intraday template */

GraphXSpace = 3 ;

/* These are the calcs for the oscilator values and plots the paint
bars*/
Osc = EMA(C,8) - EMA(C,34);
acc = Osc - EMA(Osc,13);
col = IIf(Osc > Ref(Osc,-1) AND acc > Ref(acc,-1),colorTurquoise,IIf(Osc < Ref(Osc,-1) AND acc < Ref(acc,-1),colorTan,colorLightBlue));
barcolor= 1;
Plot( Close, "Intraday Template" ,col/barcolor, styleCandle,styleThick|styleNoLabel);
// this sets the color of the body of the candlesticks to default

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

/* This is the code for the exponential moving average flipper */

mov = 200;
hi = EMA(H,mov);
lo = EMA(L,mov) ;
x1 = IIf(C>Ref(hi,-1),1,IIf(C<Ref(lo,-1),-1,0));
x2 = ValueWhen(x1!=0,x1,1);
st = IIf(x2==-1,Hi,Lo);
//Plot(st,"",colorYellow,styleNoLine|styleDots);
Buy=Cross(C,st);
Sell=Cross( Signal(), MACD() ) OR TimeNum()>151500;
Short=Cross(st,C);
Cover=Cross( MACD(), Signal() ) OR TimeNum()>151500;
shape = Buy * shapeUpTriangle + Short * shapeDownTriangle;
AlertIf( Short, "SOUND C:\\Windows\\Media\\ringout.wav", "Audio alert", 2 );
AlertIf( Buy, "SOUND C:\\Windows\\Media\\ringout.wav", "Audio alert", 2 );
PlotShapes( shape, IIf( Buy, colorYellow, colorCustom12 ),0, IIf( Buy, Low,
High ) );

GraphXSpace = 5;
dist = 2.5*ATR(10);

for( i = 0; i < BarCount; i++ )
{
if( Buy[i] ) PlotText( "Buy\n" + C[ i ], i, L[ i ]-dist[i], colorGreen
);
if( Short[i] ) PlotText( "Short\n" + C[ i ], i, H[ i ]+dist[i],
colorRed);
}
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g,
Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C,SelectedValue( ROC( C,
1 ) ) ));


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

/* This next code calculates the previous days high, low and close */

Hi1 =
IIf(Day()!=Ref(Day(),-1),Ref(HighestSince(Day()!=Ref(Day(),-1),H,1),-1),0);
Hi = ValueWhen(Day()!=Ref(Day(),-1),Hi1,1);
Lo1 =
IIf(Day()!=Ref(Day(),-1),Ref(LowestSince(Day()!=Ref(Day(),-1),L,1),-1),0);
Lo = ValueWhen(Day()!=Ref(Day(),-1),Lo1,1);
Cl1 = IIf(Day()!=Ref(Day(),-1),Ref(C,-1),0);
Cl = ValueWhen(Day()!=Ref(Day(),-1),Cl1,1);

/*This code calculates the time left in the bar*/

//File: TimeLeft in Bar
//Sept 20, 2005
// Compute Time Left In Bar
//

BarTime1 = LastValue(TimeNum() - Now(4));
DataError = IIf(Now(4) > TimeNum(),True,False);
TimeBase = IIf(Interval(1)>0,1,0);


_N(StrBarTime = NumToStr(BarTime1,1.0,False));
BT_Length = StrLen(StrBarTime);


_N(TimeLeft_ = WriteIf(BT_Length==1,"0:0"+StrBarTime,WriteIf(BT_Length==2,"0:"+StrBarTime,
WriteIf(BT_Length==3,StrLeft(StrBarTime,1)+":"+StrRight(StrBarTime,2),
StrLeft(StrBarTime,2)+":"+StrRight(StrBarTime,2))) ));

TimeLeft = WriteIf(TimeBase==1,TimeLeft_,"N/A");



//////////////////////////////////////////////////////////////////////////////
Filter=Buy OR Short;

AddColumn( IIf(Buy,1,IIf(Short,-1,Null)) ,"Buy/Short",1.0,colorWhite,IIf(Buy,colorDarkGreen,IIf(Short,colorRed,Null)),100);
AddColumn( IIf(Cover,2,IIf(Sell,-2,Null)) ,"Cover/Sell",1.0,colorWhite,IIf(Cover,colorLightBlue,IIf( Sell,colorCustom12,Null)),100);




_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | styleHidden | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("BB_double_(H+L)_20");



////BOL BAND 18////////////////////////////////////////////////////////




P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );


M = (H+L)/2;

BT = BBandTop( M, 20, 1.5 );
BB = BBandBot( M, 20, 1.5 );

BColor = ColorRGB(5,125,150);
//Plot( BT, "BBTop" + _PARAM_VALUES(), BColor, styleDots|styleThick|styleNoLabel);
//Plot( BB, "BBBot" + _PARAM_VALUES(), BColor, styleDots|styleThick|styleNoLabel);



BT1 = BBandTop( M, 20, 2.2 );
BB1 = BBandBot( M, 20, 2.2 );
//Plot( BT1, "BBTop1" + _PARAM_VALUES(), BColor, styleDots|styleNoLabel);
//Plot( BB1, "BBBot1" + _PARAM_VALUES(), BColor, styleDots|styleNoLabel);

PlotOHLC( 0, BT1 , BT , BT , "Cloud", IIf(BT1 > BT ,ColorRGB(25,25,100),colorDarkTeal), styleCloud | styleNoLabel);

PlotOHLC( 0, BB , BB1 , BB1 , "Cloud", IIf(BB > BB1 ,ColorRGB(25,25,100),colorDarkTeal), styleCloud | styleNoLabel);

_SECTION_END();Plot(EMA(C,20),"",IIf(C > EMA(C,20),colorBrightGreen,colorRed),styleLine|styleThick);


_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("BBands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorWhite );
Color = ColorBlend( Color, GetChartBkColor(), 0.5 );
Style = ParamStyle("Style", styleLine | styleNoLabel ) | styleNoRescale;;
Plot( bbt = BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), Color, Style );
Plot( bbb = BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), Color, Style );
PlotOHLC( bbt, bbt, bbb, bbb, "", ColorBlend( Color, GetChartBkColor(), 0.7 ), styleNoLabel | styleCloud | styleNoRescale, Null, Null, Null, -1 );
_SECTION_END();



رد مع اقتباس
قديم 01-09-2018, 02:08 PM
  المشاركه #35

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

تاريخ التسجيل: Apr 2012
المشاركات: 223
amm1430 غير متواجد حالياً  

_SECTION_BEGIN("MFI");
periods = Param( "Periods", 14, 2, 200, 1 );
Plot( MFI(periods), _DEFAULT_NAME(), ParamColor("Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();

_SECTION_BEGIN("EMA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 100, 2, 200, 1, 10 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
_SECTION_BEGIN("MFI");
periods = Param( "Periods", 14, 2, 200, 1 );
Plot( MFI(periods), _DEFAULT_NAME(), ParamColor("Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();

_SECTION_BEGIN("EMA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 100, 2, 200, 1, 10 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
Graph0=50;
Graph1=70;




_SECTION_BEGIN("RSI trendline ");
// RSI trendline formula ver 1.0

SetBarsRequired(sbrAll, sbrAll);
TP = Param("Trend Per", 300,2,1000);
per_RSI= Param("RSI Per", 9, 7, 35,1);
IND = RSI(per_RSI);
Center = 50 ;

Plot( RSI(per_RSI), "", 4, 4);
Plot(50,"",1,1) ;

// CALCULATE UPTREND

startvalue = LastValue( LLV( IND, TP ) );
startbar = LastValue( ValueWhen( IND == startvalue, BarIndex(), 1) );
BP = BarCount - Startbar;

secondvalue = LastValue( LLV( IND, BP - 5 ) );
secondbar = LastValue( ValueWhen( IND == secondvalue, BarIndex(), 1) );
BP2 = BarCount - secondbar;

thirdvalue = LastValue( LLV( IND, BP2 - 5 ) );
thirdbar = LastValue( ValueWhen( IND == thirdvalue, BarIndex(), 1) );
BP3 = BarCount - thirdbar;

fourthvalue = LastValue( LLV( IND, BP3 - 5 ) );
fourthbar = LastValue( ValueWhen( IND ==fourthvalue, BarIndex(), 1) );
BP4 = BarCount - fourthbar;

fifthvalue = LastValue( LLV( IND, BP4 - 5 ) );
fifthbar = LastValue( ValueWhen( IND ==fifthvalue, BarIndex(), 1) );
BP5 = BarCount - fifthbar;

sixthvalue = LastValue( LLV( IND, BP5 - 5 ) );
sixthbar = LastValue( ValueWhen( IND ==sixthvalue, BarIndex(), 1) );

Low_1= IIf( BarIndex() == startbar, 80, Null);
Low_2= IIf( BarIndex() == secondbar, 80, Null);
Low_3= IIf( BarIndex() == thirdbar, 80, Null);
Low_4= IIf( BarIndex() == fourthbar, 80, Null);
Low_5= IIf( BarIndex() == fifthbar, 80, Null);
Low_6= IIf( BarIndex() == sixthbar, 80, Null);

b = startvalue ;
FirstSlope = (secondvalue - b) / (secondbar - startbar) ;
FirstTrendline = FirstSlope * ( BarIndex() - startbar ) + b;
// Plot( IIf( BarIndex() >= startbar AND FirstTrendline <= 90 , FirstTrendline, Null ) , "FirstTrendline", colorGreen, styleThick +2048 );

SecondSlope = (thirdvalue - b) / (thirdbar - startbar) ;
SecondTrendline = SecondSlope * ( BarIndex() - startbar ) + b;

ThirdSlope = (fourthvalue - b) / (fourthbar - startbar) ;
ThirdTrendline = ThirdSlope * ( BarIndex() - startbar ) + b;

FourthSlope = (fifthvalue - b) / (fifthbar - startbar) ;
FourthTrendline = FourthSlope * ( BarIndex() - startbar ) + b;

FifthSlope = (sixthvalue - b) / (sixthbar - startbar) ;
FifthTrendline = FifthSlope * ( BarIndex() - startbar ) + b;

MainSlope = IIf( FirstSlope > SecondSlope, IIf( SecondSlope > ThirdSlope, IIf( ThirdSlope > FourthSlope,
IIf( FourthSlope > FifthSlope, FifthSlope, FourthSlope),ThirdSlope), SecondSlope), FirstSlope) ;

MainLine = MainSlope * ( BarIndex() - startbar ) + b;
Plot( IIf( BarIndex() >= startbar, MainLine, Null ) , "MainLine", colorDarkGreen, styleThick ) ;


IND_Diff = IIf( BarIndex() >= startbar, abs( IND - MainLine), Null) ;
MainTrendLine_Diff = Param("Difference IND from MainTrendLine", 2.5, 0.5,5, 0.5);

Cond_Buy = IIf( BarIndex() >= Thirdbar AND IND_Diff <= MainTrendLine_Diff, IND, 0) AND MainLine < 55 ;

PlotShapes( IIf( Cond_Buy, shapeUpArrow , shapeNone ), colorGreen );



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

// CALCULATE DOWNTREND

starthigh = LastValue( HHV( IND, TP ) );
starthighbar = LastValue( ValueWhen( IND == starthigh, BarIndex(), 1) );
HBP = BarCount - starthighbar;

secondhigh = LastValue( HHV( IND, HBP - 5 ) );
secondhighbar = LastValue( ValueWhen( IND == secondhigh, BarIndex(), 1) );
HBP2 = BarCount - secondhighbar;

thirdhigh = LastValue( HHV( IND, HBP2 - 5 ) );
thirdhighbar = LastValue( ValueWhen( IND == thirdhigh, BarIndex(), 1) );
HBP3 = BarCount - thirdhighbar;

fourthhigh = LastValue( HHV( IND, HBP3 - 5 ) );
fourthhighbar = LastValue( ValueWhen( IND ==fourthhigh, BarIndex(), 1) );
HBP4 = BarCount - fourthhighbar;

fifthhigh = LastValue( HHV( IND, HBP4 - 5 ) );
fifthhighbar = LastValue( ValueWhen( IND ==fifthhigh, BarIndex(), 1) );
HBP5 = BarCount - fifthhighbar;

sixthhigh = LastValue( HHV( IND, HBP5 - 5 ) );
sixthhighbar = LastValue( ValueWhen( IND ==sixthhigh, BarIndex(), 1) );

High_1= IIf( BarIndex() == starthighbar, 90, Null);
High_2= IIf( BarIndex() == secondhighbar, 90, Null);
High_3= IIf( BarIndex() == thirdhighbar, 90, Null);
High_4= IIf( BarIndex() == fourthhighbar, 90, Null);
High_5= IIf( BarIndex() == fifthhighbar, 90, Null);
High_6= IIf( BarIndex() == sixthhighbar, 90, Null);

MainTrendLine_Diff = Param("Difference IND from MainTrendLine", 2.5, 0.5,7, 0.5);

d = starthigh ;
FirstDownSlope = (secondhigh - d) / (secondhighbar - starthighbar) ;
FirstDownTrendline = FirstDownSlope * ( BarIndex() - starthighbar ) + d;

SecondDownSlope = (thirdhigh - d) / (thirdhighbar - starthighbar) ;
SecondDownTrendline = SecondDownSlope * ( BarIndex() - starthighbar ) + d;

ThirdDownSlope = (fourthhigh - d) / (fourthhighbar - starthighbar) ;
ThirdDownTrendline = ThirdDownSlope * ( BarIndex() - starthighbar ) + d;

FourthDownSlope = (fifthhigh - d) / (fifthhighbar - starthighbar) ;
FourthDownTrendline = FourthDownSlope * ( BarIndex() - starthighbar ) + d;

FifthDownSlope = (sixthhigh - d) / (sixthhighbar - starthighbar) ;
FifthDownTrendline = FifthDownSlope * ( BarIndex() - starthighbar ) + d;

MainDownSlope = IIf( FirstDownSlope < SecondDownSlope, IIf( SecondDownSlope < ThirdDownSlope,
IIf( ThirdDownSlope < FourthDownSlope, IIf( FourthDownSlope < FifthDownSlope, FifthDownSlope, FourthDownSlope),ThirdDownSlope), SecondDownSlope), FirstDownSlope) ;

MainDownLine = IIf( MainDownSlope == 0, Null, MainDownSlope * ( BarIndex() - starthighbar ) + d ) ;
Plot( IIf( BarIndex() >= starthighbar, MainDownLine, Null ) , "Main_DOWN_Line", colorViolet, styleThick ) ;

IND_Diff = IIf( BarIndex() >= starthighbar, abs( IND - MainDownLine), Null) ;

Cond_Sell = IIf( BarIndex() >= Thirdbar AND IND_Diff <= MainTrendLine_Diff, IND, 0) AND MainDownLine > 45 ;

PlotShapes( IIf( Cond_Sell, shapeDownArrow , shapeNone ), colorRed );


Title = Name() + "\\c17" + " " +"\\c12" + "RSI" + " " + per_RSI ;
_SECTION_END();



رد مع اقتباس
قديم 01-09-2018, 02:14 PM
  المشاركه #36

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

تاريخ التسجيل: Apr 2012
المشاركات: 223
amm1430 غير متواجد حالياً  

Plot(RSI(14),"",colorYellow,4);
Plot(RSI(34),"",colorBlue,4);
Plot(RSI(55),"",colorWhite,4);
Plot(RSI(100),"",colorRed,4);

Buy=Cross(RSI(14),RSI(34));
Sell=Cross(RSI(34),RSI(14));
PlotShapes(IIf(Buy,shapeSmallUpTriangle,shapeNone),colorWhite,0,RSI(14),-12);
PlotShapes(IIf(Sell,shapeSmallDownTriangle, shapeNone),colorWhite,0,RSI(14),-12);

_SECTION_BEGIN("Exploration");
Filter=Close;
Var = WriteIf(Buy,"BUY",WriteIf(Sell,"SELL",""));
AddTextColumn(Var , "Buy/Sell", 1.2 , colorWhite, IIf( Buy, colorBlue,IIf(Sell,colorRed,colorWhite) ));
_SECTION_END();



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


الكلمات الدلالية (Tags)
للمضارب, معادلات, اللحظي, الايمى, بروكر, على

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

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

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

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



03:40 PM