답변완료
부탁드립니다 항상 감사합니다
Input:
len(10), FC(1), SC(150),
TP_Ratio(0.985), SL_Ratio(1.01), 진입수량(1);
Var:
Price(0), Len1(0), w(0),
H1(0), L1(0), N1(0),
H2(0), L2(0), N2(0),
H3(0), L3(0), N3(0),
dimen1(0), dimen(0), alpha1(0), oldalpha(0),
oldN(0), N(0), alpha_(0), alpha(0), out(0),
진입가(0), TP(0), SL(0), posFlag(0), tx(0);
// FRAMA 계산
Price = (H + L) / 2;
len1 = len / 2;
w = log(2 / (SC + 1));
H1 = highest(H, len1);
L1 = lowest(L, len1);
N1 = (H1 - L1) / len1;
H2 = highest(H, len)[len1];
L2 = lowest(L, len)[len1];
N2 = (H2 - L2) / len1;
H3 = highest(H, len);
L3 = lowest(L, len);
N3 = (H3 - L3) / len;
dimen1 = (log(N1 + N2) - log(N3)) / log(2);
dimen = iff(N1 > 0 and N2 > 0 and N3 > 0, dimen1, iff(isnan(dimen1[1]), 0, dimen1[1]));
alpha1 = exp(w * (dimen - 1));
oldalpha = iff(alpha1 > 1, 1, iff(alpha1 < 0.01, 0.01, alpha1));
oldN = (2 - oldalpha) / oldalpha;
N = (((SC - FC) * (oldN - 1)) / (SC - 1)) + FC;
alpha_ = 2 / (N + 1);
alpha = iff(alpha_ < 2 / (SC + 1), 2 / (SC + 1), iff(alpha_ > 1, 1, alpha_));
out = (1 - alpha) * iff(isnan(out[1]), 0, out[1]) + alpha * Price;
// 진입 조건
If Close < out and Close[1] >= out[1] and posFlag = 0 Then
Begin
SellShort("FRAMA Short") next bar at market;
진입가 = Close;
TP = 진입가 * TP_Ratio;
SL = 진입가 * SL_Ratio;
posFlag = -1;
tx = Text_New(Date, Time, High, "진입조건만족");
Text_SetColor(tx, Red);
End;
// 청산 조건
If posFlag = -1 Then
Begin
If Close <= TP or Close >= SL Then
Begin
BuyToCover("청산") next bar at market;
posFlag = 0;
End;
End;
// 시각화
Plot1(out, "FRAMA", Blue);
지표로 적용할수있게 수정부탁드립니다 감사합니다!!
2025-05-22
269
글번호 191101
지표
답변완료
키움
가=(highest(high,midPeriod)+lowest(low,midPeriod))/2;
나=supertrend(period, multiplier);
M50=ma(C, 50);
M200=ma(C, 200);
M5=ma(C, 5);
M1=ma(C, 1);
CrossUp(나, 가)OR
crossUP(C, 가)OR
CrossUp(M1, M5)OR
CrossUp(M1, M200)OR
CrossUp(M1, M50)OR
C>가 AND C>나 AND C>M5 AND C>M200
period 60
multiplier 2
midPeriod 26
항상감사합니다
2025-05-22
264
글번호 191100
종목검색
답변완료
질문 부탁드립니다
답변 감사드립니다
질문 1)
아래식에서
for문을 수행했는데 해당 값이 없을 경우, 그 다음에
if aa[0]*1.05 < aa[cnt] 를 for cnt=1 to 5 로 수행하려고 한다면
어떻게 작성을 해야 할까요?
value1=0;
for cnt=1 to 5
{
if aa[0]*1.2 < aa[cnt] then
{
value1=aa[cnt];
}
}
위의 질문과 별개로
아래와 같이 나눠서 작성한다면 for 문을 순차적으로 수행하게 되는건가요??
첫번째 for 문에서 저장된 value1 값이
두번째 for문으로 의해서 두번째 value1 값으로 변경되는건가요? (기존 value1에 덮어씌움?)
value1=0;
for cnt=1 to 5
{
if aa[0]*1.2 < aa[cnt] then
{
value1=aa[cnt];
}
}
for cnt=1 to 5
{
if aa[0]*1.05 < aa[cnt] then
{
value1=aa[cnt];
}
}
질문2))
if h>l*1.08 then
{
sum1=0; sumi1=0;
For cnt = 49 DownTo 1
{
id[cnt]=id[cnt-1];
}
id[0]= index;
For cnt = 1 to (id[0]-id[1])
{
sum1=sum1+l[cnt];
sumi1=sumi1+1;
}
value1=sum1/sumi1;
For cnt = 49 DownTo 1
{
aa[cnt] = aa[cnt-1];
}
aa[0] = value1;
For cnt = 1 to (id[0]-id[1])
{
if h[cnt]>aa[0] then value2=cnt;
}
}
위에 식에서 aa[0] 보다 큰 고가의 갯수를 value2 에 저장을 했는데요
만약에 cnt = 1 to (id[0]-id[2] )
cnt= 1 to (id[0]-id[3])
,,,
이런식으로 cnt= 1 to (id[0]-id[4]) 까지 고가의 갯수를 각각 구했을때,
value2 보다 처음으로 2배 이상의 값을 가지게 됐을때 id[] 의 번호와 고가값의 갯수를 저장하고자 하는데 통합된 식으로 작성을 도와주셨으면 합니다
예를들어서 기준이 되는 value2 가 5일때, 만약 id[3] 까지 구했을때는 8, id[4] 까지는 12개가 나왔다면 id[4]의 번호 (4번) 과 고가값의 갯수를 저장하고자 합니다
질문3)
질문2와 같이 갯수 비교하는 수식을 만들려고 하는데요
For cnt = 1 to (id[0]-id[1])
{
if h[cnt]>aa[0] and l[cnt]<aa[0] then value2=cnt;
}
위와 같은 식이 있을때,
같은 for 범위 ( cnt = 1 to (id[0]-id[1]) 인데 aa[] 값을 다르게 해서 비교하려고 합니다
if h[cnt]>aa[0] and l[cnt]<aa[0]
h[cnt]>aa[1] and l[cnt]<aa[1]
...
h[cnt]>aa[3] and l[cnt]<aa[3]
이렇게 각각의 cnt 값들을 구했을때 이들중에서 cnt 가 가장 클때 그 값과, 그때의 aa 배열의 의 순번을 저장하고 싶습니다
예를들어 aa[3] 일때 봉갯수가 가장 많다면 봉갯수와 aa[3] 을 저장을 하고 싶습니다
감사합니다
2025-05-23
231
글번호 191099
지표
답변완료
시작시간 문의
늘 감사합니다.
아래 수식이 안되네요 . 검토좀 해주세요.
input : 시작시간(090000),ntime(30);
var : S1(0),D1(0),TM(0),TF(0),TL(0);
if data1((sDate != sDate[1] and sTime >= 시작시간) or
(sDate == sDate and sTime >= 시작시간 and sTime[1] < 시작시간)) Then
{
S1 = data1(TimeToMinutes(시작시간));
D1 = data1(sdate);
}
if D1 > 0 then
{
if data1(sdate) == D1 Then
TM = data1(TimeToMinutes(stime))-S1;
Else
TM = data1(TimeToMinutes(stime))+1440-S1;
TF = TM%ntime;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and ntime > 1 and TF < TF[1]) or
(Bdate == Bdate[1] and ntime > 1 and TM >= TM[1]+ntime) or
(Bdate == Bdate[1] and ntime == 1 and TM > TM[1]) Then
{
TL = TL_New_Self(sDate,sTime,-999999999,sDate,sTime,999999999);
TL_SetColor(TL,Black);
TL_SetSize(TL,0);
}
}
Plot1(data1(HighD(0)), "고가",Red);
Plot2(data1(lowD(0)), "저가",Blue);
Plot3(data1(OpenD(0)), "시가");
Plot4(data1(CloseD(0)), "현재");
감사합니다.
2025-05-22
211
글번호 191097
지표
답변완료
지표 변환 부탁드립니다.
//@version=6
indicator(title="Price Oscillator", shorttitle="PPO", format=format.price, precision=2, timeframe="", timeframe_gaps=true)
shortlen = input.int(12, "Short Length", minval=1)
longlen = input.int(26, "Long Length", minval=1)
signallen = input.int(9, "Signal Length", minval=1)
src = input.source(close, title="Source")
exp = input.bool(true, "Use exponential MA")
esma(source, length)=>
s = ta.sma(source, length)
e = ta.ema(source, length)
exp ? e : s
short = esma(src, shortlen)
long = esma(src, longlen)
po = (short - long) / long * 100
sl = esma(po, signallen)
hist = po - sl
plot(hist, title = "Histogram", style = plot.style_columns, color = (hist >= 0 ? (hist[1] < hist ? #26A69A : #B2DFDB) : (hist[1] < hist ? #FFCDD2 : #FF5252)))
plot(po, color=color.teal, title="PPO")
plot(sl, color=color.orange, title="Signal Line")
hline(0, "Zero Line", color=#787B86)
2025-05-22
237
글번호 191093
지표
답변완료
다시 문의드립니다.
문의드린 이전 수식변환에서 아래와 같이 답을 주셨습니다.
1분봉 차트에, 같은 기간(50)과 승수(5)를 적용해서 트레이딩뷰와 비교했더니
첨부된 그림처럼 다르게 나옵니다.
heikinashi supertrend 라기보다 그냥 supertrend 처럼 구현됩니다.
왜 다르게 나오는지
번거로우시겠지만 다시한번 검토부탁드립니다.
그리고 녹색선과 빨강선의 바뀌는 부분을 연결부탁드립니다.
감사합니다.
=========================
안녕하세요
예스스탁입니다.
input : upertrendAtrPeriod(10);
input : supertrendAtrMultiplier(2.7);
var : haClose(0),haOpen(0),haHigh(0),haLow(0),haTR(0),alpha(0),haTrueRange(0);
var : haSupertrendUp(0),haSupertrendDown(0),trendingUp(Nan),trendingDown(Nan);
var : direction(0),supertrend(0),supertrendUp(False),supertrendDown(False);
if index == 0 then
{
haClose = (O+H+L+C)/4;
haOpen = open;
haHigh = MaxList( high, haOpen, haClose);
haLow = MinList( low, haOpen,haClose);
}
else
{
haClose = (O+H+L+C)/4;
haOpen = (haOpen [1] + haClose [1])/2 ;
haHigh = MaxList(High, haOpen, haClose) ;
haLow = MinList(Low, haOpen, haClose) ;
}
haTR = iff(IsNan(haOpen[1]) == true, haOpen-haLow, max(max(haOpen - haLow, abs(haOpen - haClose[1])), abs(haLow - haClose[1])));
alpha = 1 / upertrendAtrPeriod ;
haTrueRange = IFf(IsNan(haTrueRange[1]) == true, ma(haTR,upertrendAtrPeriod) , alpha * haTR + (1 - alpha) * IFf(isnan(haTrueRange[1])==true,0,haTrueRange[1]));
haSupertrendUp =((haHigh +haLow )/2 )-(supertrendAtrMultiplier *haTrueRange );
haSupertrendDown =((haHigh +haLow )/2 )+(supertrendAtrMultiplier *haTrueRange );
direction = 0;
trendingUp = iff(haClose[1]>trendingUp[1] , max (haSupertrendUp ,trendingUp[1]) , haSupertrendUp);
trendingDown = iff(haClose[1]<trendingDown[1] , min (haSupertrendDown ,trendingDown[1]) , haSupertrendDown);
direction = iff(haClose > trendingDown[1] , 1 , iff(haClose < trendingUp[1], -1 , IFf(IsNan(direction[1]) == true,1,direction[1])));
supertrend = iff(direction == 1 , trendingUp , trendingDown);
if direction == 1 Then
{
plot1(supertrend,"supertrendUp", Green);
NoPlot(2);
}
Else
{
plot2(supertrend,"supertrendDow", Red);
NoPlot(1);
}
=========================
2025-05-22
287
글번호 191084
지표
답변완료
문의드립니다,
수고많으십니다.
아래수식중 증액을할때 진입할때마다라고 했는데 시스템에서 정한기준안에서
예를들면 시스템진입식에 10번진입 실제진입5번일때 실제진입한것만
증액으로 진입식부탁드립니다.
1.
inputs : P1(5),P2(20),RSILength(10), OverSold(30),OverBought(70);
input : 첫진입금액(1000000),A(10);
var : m1(0,Data2),m2(0,Data2), R(0,Data1);
var : TT(0,Data1),T1(0,Data1),entry(0,Data1),mm(0,data1),vol(0,Data1);
m1 = Data2(ma(C,P1));
m2 = Data2(ma(C,P2));
R = data1(RSI(RSILength));
If Data2(m1 > m2) and Crossup(R, OverSold) Then
{
if TotalTrades == 0 Then
mm = 첫진입금액;
Else
mm = mm*(1+A/100);
Buy("B",OnClose,Def,Floor(Floor(mm/C)/10)*10);
}
if Data2(CrossDown(m1,m2)) or Crossup(R, OverBought) Then
Sell("S");
2
inputs : P1(5),P2(20),RSILength(10), OverSold(30),OverBought(70);
input : 첫진입금액(1000000),A(10),B(20);
var : m1(0,Data2),m2(0,Data2), R(0,Data1),LP(0,Data1);
var : TT(0,Data1),T1(0,Data1),entry(0,Data1),mm(0,data1),vol(0,Data1);
m1 = Data2(ma(C,P1));
m2 = Data2(ma(C,P2));
R = data1(RSI(RSILength));
if MarketPosition == 1 Then
LP = LatestEntryPrice(0);
Else
LP = LatestEntryPrice(1);
If Data2(m1 > m2) and Crossup(R, OverSold) Then
{
if TotalTrades == 0 Then
mm = 첫진입금액;
Else
{
if LP > C Then
mm = mm*(1+B/100);
Else
mm = mm*(1+A/100);
}
Buy("B",OnClose,Def,Floor(Floor(mm/C)/10)*10);
}
if Data2(CrossDown(m1,m2)) or Crossup(R, OverBought) Then
Sell("S");
2025-05-22
191
글번호 191081
시스템