_SECTION_BEGIN("Ichi 3R 4");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
GraphXSpace = 10;
filt = Param("filter",0,0,20,0.1);
tu = Param("TS ",5,2,50,1);
su = Param("KS ",20,2,100,1);
ku = Param("KUMO ",40,2,200,1);
sh = Param("CS Shift",20,10,50,1);
ks = SL = ( HHV( H, su ) + LLV( L, su) )/2;
ts = TL = ( HHV( H, tu ) + LLV( L, tu ))/2;
Span1 = (( SL + TL )/2);
Span2 = (HHV( H, ku) + LLV(L, ku))/2;
top = IIf(Ref(span1,-su) > Ref(span2,-su),Ref(span1,-su),Ref(span2,-su));
bot = IIf(Ref(span1,-su) < Ref(span2,-su),Ref(span1,-su),Ref(span2,-su));
Plot( Close, "", colorAqua, styleThick+styleLine+styleNoLabel,Null, Null, -sh );
ichi_col =
IIf(ts > ks AND ks > Ref(span2,-su) , colorBlue,
IIf(ts < ks AND ks < Ref(span2,-su), colorCustom12,
colorGrey40));
Plot(SL,"SL",colorWhite,styleThick); // standard, base, or kijun-sen line
Plot(TL,"TL",colorCustom12,styleThick); // turning, conversion, or tenkan-sen line
Plot(Close,"price",colorGrey40,styleBar+styleThick);
Plot (Ref(span2,-su),"",colorDarkYellow,styleThick);
Plot (Ref(span1,-su),"",colorYellow,styleThick);
PlotOHLC(Span1,Span2,Span1,Span2,"",IIf(Span1>Span2,colorDarkOliveGreen,colorDarkRed),styleCloud|4096,0,0,su);
ts = tl;
ks = sl;
Title = EncodeColor(colorWhite)+ "Linkon " + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2)+ EncodeColor(colorWhite) +
" - " + Date() +
"\n"+
WriteIf(Ref(H,-1) > Ref(H,-2),EncodeColor(colorBrightGreen),EncodeColor(colorRed))+"ex "+Ref(H,-1)+WriteIf(H > Ref(H,-1),EncodeColor(colorBrightGreen),EncodeColor(colorRed))+" Hi "+H+
EncodeColor(colorYellow)+"T ="+(Ref(H,-1)+filt)+
"\n"+
EncodeColor(colorWhite)+"Op "+O+WriteIf(C > O, EncodeColor(colorBrightGreen),EncodeColor(colorRed))+" Cl : " +C+
EncodeColor(colorYellow)+"R = "+round(10*(H-L))/10+
"\n"+
WriteIf(Ref(L,-1) < Ref(L,-2),EncodeColor(colorRed),EncodeColor(colorBrightGreen))+"ex "+Ref(L,-1)+WriteIf(L < Ref(L,-1),EncodeColor(colorRed),EncodeColor(colorBrightGreen))+" Lo "+L+
EncodeColor(colorYellow)+"T ="+(Ref(L,-1)-filt)+
"\n"+"\n"+
EncodeColor(colorWhite)+"\nIchi Says :"+
WriteIf(L > ts AND ts > ks AND ks > top,EncodeColor(colorBlue)+"clear UpTrend",
WriteIf(H < ts AND ts < ks AND ks < bot,EncodeColor(colorCustom12)+"clear Dntrend",
""
))+
EncodeColor(colorCustom12) + "\nTF+1 @ " +WriteIf(C > tl, EncodeColor(colorBrightGreen),EncodeColor(colorRed))+tl+
EncodeColor(colorWhite) + " \nTF+2 @ "+WriteIf(C > sL, EncodeColor(colorBrightGreen),EncodeColor(colorRed))+sl+
EncodeColor(colorDarkYellow) + "\nTF+3 @ " +WriteIf(C > Ref(span2,-su), EncodeColor(colorBrightGreen),EncodeColor(colorRed))+Ref(span2,-su) +
EncodeColor(colorYellow) +" \nTD @ "+ WriteIf(C > Ref(span1,-su), EncodeColor(colorBrightGreen),EncodeColor(colorRed))+Ref(span1,-su) +
"\n"+"\n"
;
_SECTION_BEGIN("Time Left");
function GetSecondNum()
{
Time = Now( 4 );
Seconds = int( Time % 100 );
Minutes = int( Time / 100 % 100 );
Hours = int( Time / 10000 % 100 );
SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds );
return SecondNum;
}
RequestTimedRefresh( 1 );
TimeFrame = Interval();
SecNumber = GetSecondNum();
Newperiod = SecNumber % TimeFrame == 0;
SecsLeft = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame;
SecsToGo = TimeFrame - SecsLeft;
x=Param("xposn",0,0,1000,1);
y=Param("yposn",0,0,1000,1);
GfxSelectSolidBrush( ColorRGB( 230, 230, 230 ) );
GfxSelectPen( ColorRGB( 230, 230, 230 ), 2 );
if ( NewPeriod )
{
GfxSelectSolidBrush( colorYellow );
GfxSelectPen( colorYellow, 2 );
// Say( "New period" );
}
GfxRoundRect( x+55, y+17, x-4, y-2, 0, 0 );
GfxSetBkMode(1);
GfxSelectFont( "Arial", 9, 700, False );
GfxSetTextColor( colorBlack );
GfxTextOut( ""+SecsToGo+" / "+NumToStr( TimeFrame, 1.0 ), x, y );
_SECTION_END();
_SECTION_BEGIN("rsi div 20 bar shift");
P = Param("Priod RSI", 14, 9, 14, 1);
VRSI = round(10*DEMA(RSI(14),5))/10;
Length = 100;
Lapse = 3;
fUp = VRSI > Ref(VRSI, -1) & VRSI > Ref(VRSI, 1) & VRSI >55;
fDown = VRSI < Ref(VRSI, -1) & VRSI < Ref(VRSI, 1) & VRSI < 45;
Div = 0;
for(i = Length; i < BarCount; i++)
{
// Down
if(fUp[i])
{
k = i-1;
do
{
if(VRSI[k] > VRSI[i] & fUp[i] & fUp[k])
{
if(C[k] < C[i] & i-k > Lapse)
{
Div[i] = 1;
}
k = i-Length;
}
else
k = k-1;
} while( k > i-Length );
}
////////////////////////////
// Up
if(fDown[i])
{
k = i-1;
do
{
if(VRSI[k] < VRSI[i] & fDown[i] & fDown[k])
{
if(C[k] > C[i] & i-k > Lapse)
{
Div[i] = -1;
}
k = i-Length;
}
else
k = k-1;
} while( k > i-Length );
}
}
Fon = IIf(Div == 0, 0, 1);
Col = IIf(Div == 1, colorRed, IIf(Div == -1, colorBrightGreen, colorGrey40));
Color = IIf(Div == 1, colorRed, IIf(Div == -1, colorBrightGreen, 1));
Color = IIf(fUp == 1, colorRed, IIf(fDown == 1, colorBrightGreen, 1));
Div = IIf(Div == 0, Null, abs(Div));
Fon = abs(Div);
Base = DEMA(RSI(14),5);
for( i = 1; i <= 1; i++ )
{
ResBase = LastValue(Peak(Base,5,i));
SupBase = LastValue(Trough(Base,5,i));
Plot(ValueWhen( ResBase==Base, HHV(base,3) ), "Resist Level", colorRed, styleLine,0,0,-20);
Plot(ValueWhen( supbase==Base, LLV(base,3) ), "Support Level", colorGreen, styleLine,0,0,-20);
Plot(ValueWhen( ResBase==Base, HHV(base,3) ), "Resist Level", colorRed, styleLine+styleNoLabel,0,0,-15);
Plot(ValueWhen( supbase==Base, LLV(base,3) ), "Support Level", colorGreen, styleLine+styleNoLabel,0,0,-15);
Plot(ValueWhen( ResBase==Base, HHV(base,3) ), "Resist Level", colorRed, styleLine+styleNoLabel,0,0,-10);
Plot(ValueWhen( supbase==Base, LLV(base,3) ), "Support Level", colorGreen, styleLine+styleNoLabel,0,0,-10);
Plot(ValueWhen( ResBase==Base, HHV(base,3) ), "Resist Level", colorRed, styleLine+styleNoLabel,0,0,-5);
Plot(ValueWhen( supbase==Base, LLV(base,3) ), "Support Level", colorGreen, styleLine+styleNoLabel,0,0,-5);
Plot(ValueWhen( ResBase==Base, HHV(base,3) ), "Resist Level", colorRed, styleLine+styleNoLabel);
Plot(ValueWhen( supbase==Base, LLV(base,3) ), "Support Level", colorGreen, styleLine+styleNoLabel);
}
Title = EncodeColor(4)+"RSI(" + WriteVal(P, 2.0) + ")" + EncodeColor(colorWhite) + " ="+WriteVal(Vrsi);
Plot( Vrsi, "RSI", Col, 5,0,0,-20);
Plot( 25,"", 4, 16+4096);
Plot( 75,"", 4, 16+4096);
//Plot(Fon, "", Color, 16384+32768+4096, MinValue = 0, MaxValue = 1);
_SECTION_END();
_SECTION_BEGIN("Stochastic Slow");
t = Param("Stoch period",15,5,100,1);
sk = StochK(15,3); //StochK(t,5);
sd = WMA(sk,3);//StochD(t,5,3);
//s = Ref(sk,-1);
Plot( Sk, "", IIf(sk > Ref(sk,-1),colorAqua,colorRed), styleDashed );
Plot( SD, "", IIf(sd > Ref(sd,-1),colorAqua,colorRed), styleThick );
C80 = BarsSince(Cross(sd,80));
C20 = BarsSince(Cross(20,sd));
//Buy = IIf(c20 > 5 ,Cross(sd,20),Cross(sk,sd)) ;
Buy = IIf(c20 > 4 AND Ref(sd,-1) < 20,Cross(sd,20),Cross(sk,sd)) ;
Short = IIf(C80 > 4 AND Ref(sd,-1) > 80,Cross(80,sd),Cross(sd,sk)) ;
//Sell = Short;
//Cover = Buy;
PlotShapes(Buy*shapeHollowSmallUpTriangle,colorYellow);
PlotShapes(Short*shapeHollowSmallDownTriangle,colorYellow);
Plot(80,"",colorGrey40,styleDashed);
Plot(20,"",colorGrey40,styleDashed);
//----------stoch div........................................................
ST33=SD;
TR1=LLVBars(ST33,4);
TR2=IIf(ST33<30 AND TR1>0 AND Ref(TR1,-1)==0,Ref(ST33,-1),0);
TRC=IIf(TR2>0,C,0);
vs=ValueWhen(tr2, Ref(st33,-1), 1);
dvs=vs-Ref(vs,-1);
vc=ValueWhen(trc, LLV(C,3), 1);
dvc=vc-Ref(vc,-1);
diver=IIf(dvs>0 AND dvc<0,30,0);
DAS=BarsSince(Ref(TR2,-1)>0);
DD=IIf(DAS<20 AND C>=Ref(C,-1),DIVER,0);
Buyd=DD>0 ;
ST33=sd;
TR11=HHVBars(ST33,4);
TR21=IIf(ST33>70 AND TR11>0 AND Ref(TR11,-1)==0,Ref(ST33,-1),0);
TRC1=IIf(TR21>0,C,0);
vs1=ValueWhen(tr21, Ref(st33,-1), 1);
dvs1=vs1-Ref(vs1,-1);
vc1=ValueWhen(trc1, HHV(H,3), 1);
dvc1=vc1-Ref(vc1,-1);
diver1=IIf(dvs1<0 AND dvc1>0,90,0);
DAS1=BarsSince(Ref(TR21,-1)>0);
ddd1=IIf(DAS1<20 AND C<Ref(C,-1),DIVER1,0);
Selld=ddd1==90;
PlotShapes ( IIf(Selld, shapeStar, shapeNone), colorRed, 0 , SD,10);
PlotShapes( IIf(Buyd, shapeStar, shapeNone), colorBrightGreen, 0, SD,-10);
filt = 0;
Title =
"SK : " + SK+
"\nsd : " + sd+
"\n"+
WriteIf(C80 > 1 AND Ref(sd,-1) > 80, "c80 "+C80,"")+
WriteIf(C20 > 1 AND Ref(sd,-1) < 20, "c20 "+C20,"")+
"\n"
;
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
N | RBI Puts Currency Trading on Hold | Futures | 0 | |
D | Platforms and languages for automated trading | Algo & Automated Trading | 2 | |
R | What are best trading indicators? | General Trading & Investing Chat | 5 | |
H | can we make our own trading platform | Software | 2 | |
N | Tradingview Competition | General Trading & Investing Chat | 0 |