답변완료
수정부탁드립니다
간단하게 수정부탁드리니다.
메모리부족현상 나타남
Input:af(0.06),maxAF(0.25);
Var:오늘(0),극대(0),극저(0),가속(0),내일(0),추세(0),상승(1),하락(-1);
//---------------------------------------------------------------------------------
Var1 = Ema(C,1);
if Var1 > 0 and
극대 == 0 and 극저 == 0 then {
극대 = Var1; 극저 = Var1;
}
if Var1 > 0 and
오늘[1] == 0 then {
if 추세[1] == 0 then {
if Var1[1] < Var1 then 추세 = 상승;
if Var1[1] > Var1 then 추세 = 하락;
}
if 추세[1] == 상승 and Var1[1] > Var1 then {
추세 = 하락;
오늘 = 극대[1];
가속 = af;
}
if 추세[1] == 하락 and Var1[1] < Var1 then {
추세 = 상승;
오늘 = 극저[1];
가속 = af;
}
극저 = min(Var1,극저);
극대 = max(Var1,극대);
}
if 오늘[1] > 0 then {
if 추세[1] == 상승 then {
if Var1 > 내일[1] then {
오늘 = 내일[1];
극저 = 0;
if Var1 > 극대[1] then {
극대 = Var1;
가속 = min(maxAF,가속+af);
}
}
else {
추세 = 하락;
오늘 = 극대[1];
극대 = 0;
극저 = Var1;
가속 = af;
}
}
if 추세[1] == 하락 then {
if Var1 < 내일[1] then {
오늘 = 내일[1];
극대 = 0;
if Var1 < 극저[1] then {
극저 = Var1;
가속 = min(maxAF,가속+af);
}
}
else {
추세 = 상승;
오늘 = 극저[1];
극저 = 0;
극대 = Var1;
가속 = af;
}
}
}
내일 = (max(극대,극저) - 오늘) * 가속 + 오늘;
//Plot1(오늘);
if var1 >= C Then
Plot1(var1, "오늘",cyan);
if var1 <= C Then
Plot1(var1, "오늘",tomato);
//---------------------------------------------------------------------------------
var2 = Ema(C,2);
if var2 > 0 and
극대 == 0 and 극저 == 0 then {
극대 = var2; 극저 = var2;
}
if var2 > 0 and
오늘[1] == 0 then {
if 추세[1] == 0 then {
if var2[1] < var2 then 추세 = 상승;
if var2[1] > var2 then 추세 = 하락;
}
if 추세[1] == 상승 and var2[1] > var2 then {
추세 = 하락;
오늘 = 극대[1];
가속 = af;
}
if 추세[1] == 하락 and var2[1] < var2 then {
추세 = 상승;
오늘 = 극저[1];
가속 = af;
}
극저 = min(var2,극저);
극대 = max(var2,극대);
}
if 오늘[1] > 0 then {
if 추세[1] == 상승 then {
if var2 > 내일[1] then {
오늘 = 내일[1];
극저 = 0;
if var2 > 극대[1] then {
극대 = var2;
가속 = min(maxAF,가속+af);
}
}
else {
추세 = 하락;
오늘 = 극대[1];
극대 = 0;
극저 = var2;
가속 = af;
}
}
if 추세[1] == 하락 then {
if var2 < 내일[1] then {
오늘 = 내일[1];
극대 = 0;
if var2 < 극저[1] then {
극저 = var2;
가속 = min(maxAF,가속+af);
}
}
else {
추세 = 상승;
오늘 = 극저[1];
극저 = 0;
극대 = var2;
가속 = af;
}
}
}
내일 = (max(극대,극저) - 오늘) * 가속 + 오늘;
//Plot1(오늘);
if var2 >= C Then
Plot2(var2, "오늘",cyan);
if var2 <= C Then
Plot2(var2, "오늘",tomato);
//---------------------------------------------------------------------------------
var3 = Ema(C,4);
if var3 > 0 and
극대 == 0 and 극저 == 0 then {
극대 = var3; 극저 = var3;
}
if var3 > 0 and
오늘[1] == 0 then {
if 추세[1] == 0 then {
if var3[1] < var3 then 추세 = 상승;
if var3[1] > var3 then 추세 = 하락;
}
if 추세[1] == 상승 and var3[1] > var3 then {
추세 = 하락;
오늘 = 극대[1];
가속 = af;
}
if 추세[1] == 하락 and var3[1] < var3 then {
추세 = 상승;
오늘 = 극저[1];
가속 = af;
}
극저 = min(var3,극저);
극대 = max(var3,극대);
}
if 오늘[1] > 0 then {
if 추세[1] == 상승 then {
if var3 > 내일[1] then {
오늘 = 내일[1];
극저 = 0;
if var3 > 극대[1] then {
극대 = var3;
가속 = min(maxAF,가속+af);
}
}
else {
추세 = 하락;
오늘 = 극대[1];
극대 = 0;
극저 = var3;
가속 = af;
}
}
if 추세[1] == 하락 then {
if var3 < 내일[1] then {
오늘 = 내일[1];
극대 = 0;
if var3 < 극저[1] then {
극저 = var3;
가속 = min(maxAF,가속+af);
}
}
else {
추세 = 상승;
오늘 = 극저[1];
극저 = 0;
극대 = var3;
가속 = af;
}
}
}
내일 = (max(극대,극저) - 오늘) * 가속 + 오늘;
//Plot1(오늘);
if var3 >= C Then
Plot3(var3, "오늘",cyan);
if var3 <= C Then
Plot3(var3, "오늘",tomato);
//---------------------------------------------------------------------------------
var4 = Ema(C,6);
if var4 > 0 and
극대 == 0 and 극저 == 0 then {
극대 = var4; 극저 = var4;
}
if var4 > 0 and
오늘[1] == 0 then {
if 추세[1] == 0 then {
if var4[1] < var4 then 추세 = 상승;
if var4[1] > var4 then 추세 = 하락;
}
if 추세[1] == 상승 and var4[1] > var4 then {
추세 = 하락;
오늘 = 극대[1];
가속 = af;
}
if 추세[1] == 하락 and var4[1] < var4 then {
추세 = 상승;
오늘 = 극저[1];
가속 = af;
}
극저 = min(var4,극저);
극대 = max(var4,극대);
}
if 오늘[1] > 0 then {
if 추세[1] == 상승 then {
if var4 > 내일[1] then {
오늘 = 내일[1];
극저 = 0;
if var4 > 극대[1] then {
극대 = var4;
가속 = min(maxAF,가속+af);
}
}
else {
추세 = 하락;
오늘 = 극대[1];
극대 = 0;
극저 = var4;
가속 = af;
}
}
if 추세[1] == 하락 then {
if var4 < 내일[1] then {
오늘 = 내일[1];
극대 = 0;
if var4 < 극저[1] then {
극저 = var4;
가속 = min(maxAF,가속+af);
}
}
else {
추세 = 상승;
오늘 = 극저[1];
극저 = 0;
극대 = var4;
가속 = af;
}
}
}
내일 = (max(극대,극저) - 오늘) * 가속 + 오늘;
//Plot1(오늘);
if var4 >= C Then
Plot4(var4, "오늘",cyan);
if var4 <= C Then
Plot4(var4, "오늘",tomato);
//---------------------------------------------------------------------------------
var5 = Ema(C,8);
if var5 > 0 and
극대 == 0 and 극저 == 0 then {
극대 = var5; 극저 = var5;
}
if var5 > 0 and
오늘[1] == 0 then {
if 추세[1] == 0 then {
if var5[1] < var5 then 추세 = 상승;
if var5[1] > var5 then 추세 = 하락;
}
if 추세[1] == 상승 and var5[1] > var5 then {
추세 = 하락;
오늘 = 극대[1];
가속 = af;
}
if 추세[1] == 하락 and var5[1] < var5 then {
추세 = 상승;
오늘 = 극저[1];
가속 = af;
}
극저 = min(var5,극저);
극대 = max(var5,극대);
}
if 오늘[1] > 0 then {
if 추세[1] == 상승 then {
if var5 > 내일[1] then {
오늘 = 내일[1];
극저 = 0;
if var5 > 극대[1] then {
극대 = var5;
가속 = min(maxAF,가속+af);
}
}
else {
추세 = 하락;
오늘 = 극대[1];
극대 = 0;
극저 = var5;
가속 = af;
}
}
if 추세[1] == 하락 then {
if var5 < 내일[1] then {
오늘 = 내일[1];
극대 = 0;
if var5 < 극저[1] then {
극저 = var5;
가속 = min(maxAF,가속+af);
}
}
else {
추세 = 상승;
오늘 = 극저[1];
극저 = 0;
극대 = var5;
가속 = af;
}
}
}
내일 = (max(극대,극저) - 오늘) * 가속 + 오늘;
//Plot1(오늘);
if var5 >= C Then
Plot5(var5, "오늘",cyan);
if var5 <= C Then
Plot5(var5, "오늘",tomato);
//---------------------------------------------------------------------------------
var6 = Ema(C,10);
if var6 > 0 and
극대 == 0 and 극저 == 0 then {
극대 = var6; 극저 = var6;
}
if var6 > 0 and
오늘[1] == 0 then {
if 추세[1] == 0 then {
if var6[1] < var6 then 추세 = 상승;
if var6[1] > var6 then 추세 = 하락;
}
if 추세[1] == 상승 and var6[1] > var6 then {
추세 = 하락;
오늘 = 극대[1];
가속 = af;
}
if 추세[1] == 하락 and var6[1] < var6 then {
추세 = 상승;
오늘 = 극저[1];
가속 = af;
}
극저 = min(var6,극저);
극대 = max(var6,극대);
}
if 오늘[1] > 0 then {
if 추세[1] == 상승 then {
if var6 > 내일[1] then {
오늘 = 내일[1];
극저 = 0;
if var6 > 극대[1] then {
극대 = var6;
가속 = min(maxAF,가속+af);
}
}
else {
추세 = 하락;
오늘 = 극대[1];
극대 = 0;
극저 = var6;
가속 = af;
}
}
if 추세[1] == 하락 then {
if var6 < 내일[1] then {
오늘 = 내일[1];
극대 = 0;
if var6 < 극저[1] then {
극저 = var6;
가속 = min(maxAF,가속+af);
}
}
else {
추세 = 상승;
오늘 = 극저[1];
극저 = 0;
극대 = var6;
가속 = af;
}
}
}
내일 = (max(극대,극저) - 오늘) * 가속 + 오늘;
//Plot1(오늘);
if var6 >= C Then
Plot6(var6, "오늘",cyan);
if var6 <= C Then
Plot6(var6, "오늘",tomato);
시스템식부탁드립니다.
input :Peod(10),색상두께(50);
Var:하락색a(Red), 상승색a(Blue);
Var:jr(0),gT(0);
Var: 고11(0),고12(0),시간11(0),시간12(0),선TL1(0),선TL(0),
고21(0),고22(0),시간21(0),시간22(0),Vlue11(0),Vlue12(0),
고31(0),고32(0),시간31(0),시간32(0);
Array:고Val[20](0),저val[20](0),고Bar[20](0),저Bar[20](0);
Array:dr[7](0),dfr[7](0);
var : dbox(0),dbox1(0);
dr[0] = 0;
dr[1] = 2;
dr[2] = 3.;
dr[3] = -1;
dr[4] = -2.;
dr[5] = 1;
dr[6] = 0.5;
For jr = 0 To 19
{
고Bar[jr] = 고Bar[jr] + 1;
저Bar[jr] = 저Bar[jr] + 1;
}
if crossup(c,highest(H,Peod)[1]) Then
gT = 1;
if CrossDown(c,Lowest(L,Peod)[1]) Then
gT = -1;
If gT == -1 Then
{
If gT[1] != -1 Then
{
For jr = 18 DownTo 0
{
저val[jr+1] = 저val[jr];
저Bar[jr+1] = 저Bar[jr];
//ZZ[j+1] = ZZ[j];
}
저val[0] = L;
저Bar[0] = 0;
//ZZ[0] = L;
고11 = Date[고Bar[0]];
시간11 = stime[고Bar[0]];
Vlue11 = 고Val[0];
고12 = Date[저Bar[0]];
시간12 = stime[저Bar[0]];
Vlue12 = 저val[0];
고21 = Date[고Bar[0]];
시간21 = stime[고Bar[0]];
고22 = Date[0];
시간22 = stime[0];
for jr = 0 to 6
{
dfr[jr] = 저val[1] + ((고Val[0] - 저val[1]) * dr[jr]);
}
Box_SetEnd(dbox,고11,시간11,Vlue11);
dbox = box_new(고11,시간11,Vlue11,고12,시간12,Vlue12);
Box_SetColor(dbox,상승색a);
Box_SetFill(dbox,true,색상두께);
}
If 저val[0] > L Then
{
저val[0] = L;
저Bar[0] = 0;
//ZZ[0] = L;
고12 = Date[저Bar[0]];
시간12 = stime[저Bar[0]];
Vlue12 = 저val[0];
고22 = Date[0];
시간22 = stime[0];
}
Box_SetEnd(dbox,NextBarSdate,NextBarStime,Vlue12);
}
If gT == 1 Then
{
If gT[1] != 1 Then
{
For jr = 18 DownTo 0
{
고Val[jr+1] = 고Val[jr];
고Bar[jr+1] = 고Bar[jr];
//ZZ[j+1] = ZZ[j];
}
고Val[0] = H;
고Bar[0] = 0;
//ZZ[0] = H;
고11 = Date[저Bar[0]];
시간11 = stime[저Bar[0]];
Vlue11 = 저val[0];
고12 = Date[고Bar[0]];
시간12 = stime[고Bar[0]];
Vlue12 = 고Val[0];
고31 = Date[저Bar[0]];
시간31 = stime[저Bar[0]];
고32 = Date[0];
시간32 = stime[0];
for jr = 0 to 5
{
dfr[jr] = 저val[0] + ((고Val[1] - 저val[0]) * dr[jr]);
}
Box_SetEnd(dbox,고11,시간11,Vlue11);
dbox = box_new(고11,시간11,Vlue11,고12,시간12,Vlue12);
Box_SetColor(dbox,하락색a);
Box_SetFill(dbox,true,색상두께);
}
If 고Val[0] < H Then
{
고Val[0] = H;
고Bar[0] = 0;
//ZZ[0] = H;
고12 = Date[고Bar[0]];
시간12 = stime[고Bar[0]];
Vlue12 = 고Val[0];
고32 = Date[0];
시간32 = stime[0];
}
Box_SetEnd(dbox,NextBarSdate,NextBarStime,Vlue12);
}
2022-12-17
1320
글번호 164665
지표
답변완료
지표수식 변환 요청드립니다
수식변환 요청드립니다.
아래수식은 트레이딩뷰 지표식인데 이미지파일 그림처럼 캔들로 구현하지 못하더라도
HARSI 바디 시가 종가 고가 저가 를 선으로 출력되어도 됩니다
##=======// //@version=5
//@author=JayRogers
indicator('Heikin Ashi RSI Oscillator', 'HARSI •', false, format.price, 2)
string TT_HARSI = 'Period for the RSI calculations used to generate the' + 'candles. This seperate from the RSI plot/histogram length.'
string TT_PBIAS = 'Smoothing feature for the OPEN of the HARSI candles.' + '
Increases bias toward the prior open value which can' + ' help provide better visualisation of trend strength.' + '
** By changing the Open values, High and Low can also' + ' be distorted - however Close will remain unchanged.'
string TT_SMRSI = 'This option smoothes the RSI in a manner similar to HA' + ' open, but uses the realtime rsi rather than the prior' + ' close value.'
///////////////////////////////////////////////////////////////////////
// //
// ====== INPUTS ====== //
// //
////////////////////////////////////////////////////////////////////////////////
// -- Candle config
string GROUP_CAND = 'Config » HARSI Candles'
i_lenHARSI = input.int(14, 'Length', group=GROUP_CAND, minval=1, tooltip=TT_HARSI)
i_smoothing = input.int(7, 'Open Smoothing', group=GROUP_CAND, minval=1, maxval=100, tooltip=TT_PBIAS)
string INLINE_COL = 'Colour Pallette'
i_colUp = input.color(color.red, 'Colour Pallette  ', group=GROUP_CAND, inline=INLINE_COL)
i_colDown = input.color(color.teal, ' ', group=GROUP_CAND, inline=INLINE_COL)
i_colWick = input.color(color.gray, ' ', group=GROUP_CAND, inline=INLINE_COL)
// -- RSI plot config
string GROUP_PLOT = 'Config » RSI Plot'
i_source = input.source(ohlc4, 'Source', group=GROUP_PLOT)
i_lenRSI = input.int(7, 'Length', group=GROUP_PLOT, minval=1)
i_mode = input.bool(true, 'Smoothed Mode RSI?', group=GROUP_PLOT, tooltip=TT_SMRSI)
////////////////////////////////////////////////////////////////////////////////
// //
// ====== FUNCTIONS ====== //
// //
////////////////////////////////////////////////////////////////////////////////
// zero median rsi helper function, just subtracts 50.
f_zrsi(_source, _length) =>
ta.rsi(_source, _length) - 50
// mode 셀렉타블 rsi function for standard, or smoothed output
f_rsi(_source, _length, _mode) =>
// get base rsi
float _zrsi = f_zrsi(_source, _length)
// smoothing in a manner similar to HA open, but rather using the realtime
// rsi in place of the prior close value.
var float _smoothed = na
_smoothed := na(_smoothed[1]) ? _zrsi : (_smoothed[1] + _zrsi) / 2
// return the requested mode
_mode ? _smoothed : _zrsi
// RSI Heikin-Ashi generation function
f_rsiHeikinAshi(_length) =>
// get close rsi
float _closeRSI = f_zrsi(close, _length)
// emulate "open" simply by taking the previous close rsi value
float _openRSI = nz(_closeRSI[1], _closeRSI)
// the high and low are tricky, because unlike "high" and "low" by
// themselves, the RSI results can overlap each other. So first we just go
// ahead and get the raw results for high and low, and then..
float _highRSI_raw = f_zrsi(high, _length)
float _lowRSI_raw = f_zrsi(low, _length)
// ..make sure we use the highest for high, and lowest for low
float _highRSI = math.max(_highRSI_raw, _lowRSI_raw)
float _lowRSI = math.min(_highRSI_raw, _lowRSI_raw)
// ha calculation for close
float _close = (_openRSI + _highRSI + _lowRSI + _closeRSI) / 4
// ha calculation for open, standard, and smoothed/lagged
var float _open = na
_open := na(_open[i_smoothing]) ? (_openRSI + _closeRSI) / 2 : (_open[1] * i_smoothing + _close[1]) / (i_smoothing + 1)
// ha high and low min-max 섹렉션
float _high = math.max(_highRSI, math.max(_open, _close))
float _low = math.min(_lowRSI, math.min(_open, _close))
// return the OHLC values
[_open, _high, _low, _close]
////////////////////////////////////////////////////////////////////////////////
// //
// ====== SERIES, LINES and LABELS ====== //
// //
////////////////////////////////////////////////////////////////////////////////
// standard, or ha smoothed rsi for the line plot and/or histogram
float RSI = f_rsi(i_source, i_lenRSI, i_mode)
// get OHLC values to use in the plotcandle()
[O, H, L, C] = f_rsiHeikinAshi(i_lenHARSI)
// candle body colouring
color bodyColour = C > O ? i_colUp : i_colDown
color wickColour = i_colWick
// make our HA rsi candles
plotcandle(O, H, L, C, 'HARSI', bodyColour, wickColour, bordercolor=bodyColour)
2022-12-18
1619
글번호 164663
지표
답변완료
지표문의에요.
아래 키움수식을 예스수식으로 변환부탁드려요,,
라인 색이랑 두께도 지정 가능하게 부탁드려요,,
미리 감사드립니다. (__)
지표1 선행중심선(상단지표)
수식1
a=Highest(H,period1);
b=LowEst(L,period1);
N=(A+B)/2;
shift(N,26)
수식2
a=Highest(H,period2);
b=LowEst(L,period2);
N=(A+B)/2;
shift(N,26)
수식3
a=Highest(H,period3);
b=LowEst(L,period3);
N=(A+B)/2;
shift(N,26)
수식4
a=Highest(H,period4);
b=LowEst(L,period4);
N=(A+B)/2;
shift(N,26)
수식5
a=Highest(H,period5);
b=LowEst(L,period5);
N=(A+B)/2;
shift(N,26)
지표조건
period1 333
period2 555
period3 777
period4 888
period5 999
지표2 볼벤중심선(하단지표)
수식1
BBandsUp(Period1,D1)
수식2
BBandsUp(Period2,D1)
수식3
BBandsUp(Period3,D1)
수식4
a=Highest(H,period4);
b=LowEst(L,period4);
N=(A+B)/2;
shift(N,26)
수식5
MA(c, 기간6, 이평종류)
지표조건
period1 999
period2 777
period3 555
period4 333
D1 2
기간6 1
이평종류 지수
2022-12-17
1071
글번호 164662
지표