답변완료
변환좀 해주세요
바쁘신데 송구 합니다 .
아래의 트레이딩뷰의 지표를 예스로 변환좀 부탁 드립니다 .
가격캔들에 컬러를 넣도록 되어 있는것은 빼고 Heatmap Volume 만
보조지표로 만들도록 도움을 청합니다 . 감사합니다 .
이메일로 부탁드립니다 .
cybersta11@ naver.com
//@version=4
study(title="Heatmap Volume [xdecow]", shorttitle="HVol [xdecow]", max_bars_back=2000, format=format.volume)
//------------------------------------------------------------------------------
// Inputs
length = input(610, title="MA Length", type=input.integer, minval=2)
slength = input(610, title='Std Length', type=input.integer, minval=2)
cmode = input('Heatmap', 'Color Mode', options=['Heatmap', 'Up/Down'])
zmode = input('Backgrounds', 'Display Heatmap Zones as', options=['None', 'Lines', 'Backgrounds', 'Both'])
bcolor_enabled = input(true, 'Colored bars')
osc = input(false, 'Show as oscillator')
thresholdExtraHigh = input(4, title="Extra High Volume Threshold", type=input.float)
thresholdHigh = input(2.5, title="High Volume Threshold", type=input.float)
thresholdMedium = input(1, title="Medium Volume Threshold", type=input.float)
thresholdNormal = input(-0.5, title="Normal Volume Threshold", type=input.float)
//------------------------------------------------------------------------------
// Colors
// heatmap colors
chm1 = #ff0000 // extra high red
chm2 = #ff7800 // high orange
chm3 = #ffcf03 // medium yellow
chm4 = #a0d6dc // normal
chm5 = #1f9cac // low
// heatmap colors
chmthresholdExtraHigh = input(chm1, 'Heatmap Extra High')
chmthresholdHigh = input(chm2, 'Heatmap High')
chmthresholdMedium = input(chm3, 'Heatmap Medium')
chmthresholdNormal = input(chm4, 'Heatmap Normal')
chmthresholdLow = input(chm5, 'Heatmap Low')
// up colors
cupthresholdExtraHigh = input(#00FF00, 'Up Extra High')
cupthresholdHigh = input(#30FF30, 'Up High')
cupthresholdMedium = input(#60FF60, 'Up Medium')
cupthresholdNormal = input(#8FFF8F, 'Up Normal')
cupthresholdLow = input(#BFFFBF, 'Up Low')
// down colors
cdnthresholdExtraHigh = input(#FF0000, 'Down Extra High')
cdnthresholdHigh = input(#FF3030, 'Down High')
cdnthresholdMedium = input(#FF6060, 'Down Medium')
cdnthresholdNormal = input(#FF8F8F, 'Down Normal')
cdnthresholdLow = input(#FFBFBF, 'Down Low')
// threshold colors
cthresholdExtraHighUp = cmode == 'Heatmap' ? chmthresholdExtraHigh : cupthresholdExtraHigh
cthresholdHighUp = cmode == 'Heatmap' ? chmthresholdHigh : cupthresholdHigh
cthresholdMediumUp = cmode == 'Heatmap' ? chmthresholdMedium : cupthresholdMedium
cthresholdNormalUp = cmode == 'Heatmap' ? chmthresholdNormal : cupthresholdNormal
cthresholdLowUp = cmode == 'Heatmap' ? chmthresholdLow : cupthresholdLow
cthresholdExtraHighDn = cmode == 'Heatmap' ? chmthresholdExtraHigh : cdnthresholdExtraHigh
cthresholdHighDn = cmode == 'Heatmap' ? chmthresholdHigh : cdnthresholdHigh
cthresholdMediumDn = cmode == 'Heatmap' ? chmthresholdMedium : cdnthresholdMedium
cthresholdNormalDn = cmode == 'Heatmap' ? chmthresholdNormal : cdnthresholdNormal
cthresholdLowDn = cmode == 'Heatmap' ? chmthresholdLow : cdnthresholdLow
//------------------------------------------------------------------------------
// Calcs
length := length > bar_index + 1 ? bar_index + 1 : length
slength := slength > bar_index + 1 ? bar_index + 1 : slength
pstdev(Series, Period) =>
mean = sum(Series, Period) / Period
summation = 0.0
for i=0 to Period-1
sampleMinusMean = nz(Series[i]) - mean
summation := summation + sampleMinusMean * sampleMinusMean
return = sqrt(summation / Period)
mean = sma(volume, length)
std = pstdev(volume, slength)
stdbar = (volume - mean) / std
dir = close > open
v = osc ? volume - mean : volume
mosc = osc ? 0 : mean
bcolor = stdbar > thresholdExtraHigh ? dir ? cthresholdExtraHighUp : cthresholdExtraHighDn :
stdbar > thresholdHigh ? dir ? cthresholdHighUp : cthresholdHighDn :
stdbar > thresholdMedium ? dir ? cthresholdMediumUp : cthresholdMediumDn :
stdbar > thresholdNormal ? dir ? cthresholdNormalUp : cthresholdNormalDn :
dir ? cthresholdLowUp : cthresholdLowDn
// heatmap lines
zshow_lines = zmode == 'Lines' or zmode == 'Both'
zshow_backgrounds = zmode == 'Backgrounds' or zmode == 'Both'
tst = highest(v, min(300, bar_index+1)) * 9999
ts0 = osc ? lowest(v, min(300, bar_index+1)) * 9999 : 0
ts1 = std * thresholdExtraHigh + mosc
ts2 = std * thresholdHigh + mosc
ts3 = std * thresholdMedium + mosc
ts4 = std * thresholdNormal + mosc
//------------------------------------------------------------------------------
// Plots
barcolor(bcolor_enabled ? bcolor : na, editable=false)
// hidden heatmap lines to fill
pt = plot(zshow_backgrounds ? tst : na, color=na, display=display.none, editable=false)
p0 = plot(zshow_backgrounds ? ts0 : na, color=na, display=display.none, editable=false)
p1 = plot(zshow_backgrounds ? ts1 : na, color=na, display=display.none, editable=false)
p2 = plot(zshow_backgrounds ? ts2 : na, color=na, display=display.none, editable=false)
p3 = plot(zshow_backgrounds ? ts3 : na, color=na, display=display.none, editable=false)
p4 = plot(zshow_backgrounds ? ts4 : na, color=na, display=display.none, editable=false)
// heatmap fills
tpf = 85
//fill(pt, p1, chm1, transp=tpf, title='Extra High heatmap zone')
fill(p1, p2, chm2, transp=tpf, title='High heatmap zone')
fill(p2, p3, chm3, transp=tpf, title='Medium heatmap zone')
fill(p3, p4, chm4, transp=tpf, title='Normal heatmap zone')
fill(p4, p0, chm5, transp=tpf, title='Low heatmap zone')
// volume
plot(v, color=bcolor, style=plot.style_columns, title='Volume', transp=0, editable=false)
// moving average
plot(osc ? na : mean, color=#000000, linewidth=2, title='Moving Average', style=plot.style_line, transp=0, display=display.none)
// heatmap lines
tpp = 50
plot(zshow_lines ? ts1 : na, color=chm1, title='Extra High heatmap line', transp=tpp)
plot(zshow_lines ? ts2 : na, color=chm2, title='High heatmap line', transp=tpp)
plot(zshow_lines ? ts3 : na, color=chm3, title='Medium heatmap line', transp=tpp)
plot(zshow_lines ? ts4 : na, color=chm4, title='Normal heatmap line', transp=tpp)
2023-01-05
1122
글번호 165109
지표
답변완료
지표
네 감사합니다.
또 배웠읍니다.
주신 주식에 텍스트크기/색
지표라인크기/색 추가수식 부탁드립니다.
input : 지정가(292.95),진동폭(3.5);
var1 = 지정가;
value1 = 진동폭/5;
Plot1(var1);
plot10(var1+value1*1);
plot11(var1+value1*2);
plot12(var1+value1*3);
plot13(var1+value1*4);
plot14(var1+value1*5);
plot15(var1+value1*6);
plot16(var1+value1*7);
plot17(var1+value1*8);
plot18(var1+value1*9);
plot19(var1+value1*10);
plot20(var1-value1*1);
plot21(var1-value1*2);
plot22(var1-value1*3);
plot23(var1-value1*4);
plot24(var1-value1*5);
plot25(var1-value1*6);
plot26(var1-value1*7);
plot27(var1-value1*8);
plot28(var1-value1*9);
plot29(var1-value1*10);
var : tx1(0);
var : tx10(0),tx11(0),tx12(0),tx13(0),tx14(0),tx15(0),tx16(0),tx17(0),tx18(0),tx19(0);
var : tx20(0),tx21(0),tx22(0),tx23(0),tx24(0),tx25(0),tx26(0),tx27(0),tx28(0),tx29(0);
Text_Delete(tx1);
Text_Delete(tx10);
Text_Delete(tx11);
Text_Delete(tx12);
Text_Delete(tx13);
Text_Delete(tx14);
Text_Delete(tx15);
Text_Delete(tx16);
Text_Delete(tx17);
Text_Delete(tx18);
Text_Delete(tx19);
Text_Delete(tx20);
Text_Delete(tx21);
Text_Delete(tx22);
Text_Delete(tx23);
Text_Delete(tx24);
Text_Delete(tx25);
Text_Delete(tx26);
Text_Delete(tx27);
Text_Delete(tx28);
Text_Delete(tx29);
tx1 = Text_New(NextBarSdate,NextBarStime,var1," 지정가:"+NumToStr(var1,2));
tx10 = Text_New(NextBarSdate,NextBarStime,var1+value1*1," +1:"+NumToStr(var1+value1*1,2));
tx11 = Text_New(NextBarSdate,NextBarStime,var1+value1*2," +2:"+NumToStr(var1+value1*2,2));
tx12 = Text_New(NextBarSdate,NextBarStime,var1+value1*3," +3:"+NumToStr(var1+value1*3,2));
tx13 = Text_New(NextBarSdate,NextBarStime,var1+value1*4," +4:"+NumToStr(var1+value1*4,2));
tx14 = Text_New(NextBarSdate,NextBarStime,var1+value1*5," +5:"+NumToStr(var1+value1*5,2));
tx15 = Text_New(NextBarSdate,NextBarStime,var1+value1*6," +6:"+NumToStr(var1+value1*6,2));
tx16 = Text_New(NextBarSdate,NextBarStime,var1+value1*7," +7:"+NumToStr(var1+value1*7,2));
tx17 = Text_New(NextBarSdate,NextBarStime,var1+value1*8," +8:"+NumToStr(var1+value1*8,2));
tx18 = Text_New(NextBarSdate,NextBarStime,var1+value1*9," +9:"+NumToStr(var1+value1*9,2));
tx19 = Text_New(NextBarSdate,NextBarStime,var1+value1*10," +10:"+NumToStr(var1+value1*10,2));
tx20 = Text_New(NextBarSdate,NextBarStime,var1-value1*1," -1:"+NumToStr(var1-value1*1,2));
tx21 = Text_New(NextBarSdate,NextBarStime,var1-value1*2," -2:"+NumToStr(var1-value1*2,2));
tx22 = Text_New(NextBarSdate,NextBarStime,var1-value1*3," -3:"+NumToStr(var1-value1*3,2));
tx23 = Text_New(NextBarSdate,NextBarStime,var1-value1*4," -4:"+NumToStr(var1-value1*4,2));
tx24 = Text_New(NextBarSdate,NextBarStime,var1-value1*5," -5:"+NumToStr(var1-value1*5,2));
tx25 = Text_New(NextBarSdate,NextBarStime,var1-value1*6," -6:"+NumToStr(var1-value1*6,2));
tx26 = Text_New(NextBarSdate,NextBarStime,var1-value1*7," -7:"+NumToStr(var1-value1*7,2));
tx27 = Text_New(NextBarSdate,NextBarStime,var1-value1*8," -8:"+NumToStr(var1-value1*8,2));
tx28 = Text_New(NextBarSdate,NextBarStime,var1-value1*9," -9:"+NumToStr(var1-value1*9,2));
tx29 = Text_New(NextBarSdate,NextBarStime,var1-value1*10," -10:"+NumToStr(var1-value1*10,2));
Text_SetStyle(tx1,0,2);
Text_SetStyle(tx10,0,2);
Text_SetStyle(tx11,0,2);
Text_SetStyle(tx12,0,2);
Text_SetStyle(tx13,0,2);
Text_SetStyle(tx14,0,2);
Text_SetStyle(tx15,0,2);
Text_SetStyle(tx16,0,2);
Text_SetStyle(tx17,0,2);
Text_SetStyle(tx18,0,2);
Text_SetStyle(tx19,0,2);
Text_SetStyle(tx20,0,2);
Text_SetStyle(tx21,0,2);
Text_SetStyle(tx22,0,2);
Text_SetStyle(tx23,0,2);
Text_SetStyle(tx24,0,2);
Text_SetStyle(tx25,0,2);
Text_SetStyle(tx26,0,2);
Text_SetStyle(tx27,0,2);
Text_SetStyle(tx28,0,2);
Text_SetStyle(tx29,0,2);
2023-01-04
880
글번호 165104
지표
답변완료
수식이 작동이 잘 안됩니다.
답변 감사합니다
그런데 제 의도와는 다르게 실행이 되어서 문의 드립니다.
제 의도는 손절이 되든 익절이 되든 거래 가능 시간 동안 계속 포지션을 갖고 가고 싶습니다.
익절이나 손절 후 진입 조건이 되는데도 바로 진입이 안됩니다.
1. 시작시간 : 09시
2. 종료시간 : 05시 30분
3. 매수를 했다가 익절이 되면 30분봉 5 이평선이 계속 상승이면 추가 진입을 3분봉에서 익절
이 된 봉 이후에 발생하는 최초의 3분봉 5 이평값 이하에서 무조건 재 매수 진입한다.
4. 매수를 했다가 손절이 되면 30분봉 5 이평선이 계속 상승이면 추가 진입을 3분봉에서 손절
이 된 봉 바로 다음 3분봉 시초가에 무조건 재 매수 진입한다.
5 매도를 했다가 익절이 되면 30분봉 5 이평선이 계속 하락이면 추가 진입을 3분봉에서 익절
이 된 봉 이후에 발생하는 최초의 3분봉5 이평값 이상에서 무조건 재 매도 진입한다.
6. 매도를 했다가 손절이 되면 30분봉 5 이평선이 계속 하락이면 추가 진입을 3분봉에서 손절
이 된 봉 바로 다음 3분봉 시초가에 무조건 재 매도 진입한다.
7.손절이나 익절이 안되고 30분봉 5 이평의 방향이 바뀌면 무조건 바로 다음 3분봉 시초가에
스위칭 한다.
부탁 드립니다.
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 시스템 수식 부탁 드립니다.
> 안녕하세요
예스스탁입니다.
input : 타주기분(30),P(5);
input : 익절틱수(40),손절틱수(20);
var : S1(0),D1(0),TM(0),TF(0),cnt(0),entry(0);
var : sum1(0),mav1(0),sum2(0),mav2(0),sum3(0),mav3(0);
Array : CC[100](0);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
entry = 0;
}
if D1 > 0 then
{
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%타주기분;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 타주기분 > 1 and TF < TF[1]) or
(Bdate == Bdate[1] and 타주기분 > 1 and TM >= TM[1]+타주기분) or
(Bdate == Bdate[1] and 타주기분 == 1 and TM > TM[1]) Then
{
for cnt = 1 to 99
{
CC[cnt] = CC[cnt-1][1];
}
}
CC[0] = C;
if CC[P+2] > 0 then
{
sum1 = 0;
sum2 = 0;
sum3 = 0;
for cnt = 0 to P-1
{
sum1 = sum1 + CC[cnt];
sum2 = sum2 + CC[cnt+1];
sum3 = sum3 + CC[cnt+2];
}
mav1 = sum1/P;
mav2 = sum2/P;
mav3 = sum3/P;
if MarketPosition >= 0 and mav1 < mav2 and mav2 > mav3 Then
Sell("s",AtMarket,Def,1);
if MarketPosition <= 0 and mav1 > mav2 and mav2 < mav3 Then
Buy("b",AtMarket,Def,1);
if entry >= 1 and MarketPosition == 0 and IsExitName("StopProfitTarget",1) == true Then
{
if MarketPosition(1) == 1 and
mav1 > mav2 and
CrossDown(C,mav1) Then
Buy("rb",AtMarket);
if MarketPosition(1) == -1 and
mav1 < mav2 and
CrossUp(c,mav1) Then
Sell("rs",AtMarket);
}
}
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
즐거운 하루되세요
2023-01-05
853
글번호 165093
시스템