답변완료
추세선 시작점
input : Period(180);
Var:j(0),T(0),tl(0),TL1(0),tx(0) ,box(0);
Var: date11(0),date12(0),time11(0),time12(0),
date21(0),date22(0),time21(0),time22(0),
date31(0),date32(0),time31(0),time32(0);
Array: HiVal[20](0),LoVal[20](0),HiBar[20](0),LoBar[20](0);
Plot1(0);
For j = 0 To 19
{
HiBar[j] = HiBar[j] + 1;
LoBar[j] = LoBar[j] + 1;
}
if crossup(c,highest(H,Period)[1]) Then
T = 1;
if CrossDown(c,Lowest(L,Period)[1]) Then
T = -1;
If T == -1 Then
{
If T[1] != -1 Then
{
For j = 18 DownTo 0
{
LoVal[j+1] = LoVal[j];
LoBar[j+1] = LoBar[j];
}
LoVal[0] = L;
LoBar[0] = 0;
date11 = date[HiBar[0]];
time11 = stime[HiBar[0]];
Value11 = HiVal[0];
date12 = date[LoBar[0]];
time12 = stime[LoBar[0]];
Value12 = LoVal[0];
TL_Delete(TL);
TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen);
TL1 = TL_New(date11,time11,Value11,date12,time12,Value12);
TL_SetColor(TL1,Blue);
TL_SetSize(TL1,2);
date21 = date[HiBar[0]];
time21 = stime[HiBar[0]];
date22 = date[0];
time22 = stime[0];
box = Box_New(date11,time11,Value11,date12,time12,Value12);
Text_SetSize(tx,25);
Text_SetColor(Tx,Red);
Text_SetStyle(tx,1,1);
Text_SetBold(tx,1);
if abs(value12[1]-value11[1]) < 0.7 Then
Text_Delete(tx);
tx = Text_New(sDate,stime,value12,NumToStr(value11-value12,2));
Text_SetColor(Tx,Blue);
Text_SetStyle(tx,1,0);
Text_SetSize(tx,25);
Text_SetBold(tx,1);
}
If LoVal[0] >= L Then
{
LoVal[0] = L;
LoBar[0] = 0;
date12 = date[LoBar[0]];
time12 = stime[LoBar[0]];
Value12 = LoVal[0];
TL_SetEnd(TL1, date12,time12,Value12);
date22 = date[0];
time22 = stime[0];
Box_SetEnd(box,date12,time12,Value12);
Text_SetString(tx,NumToStr(value11-value12,2));
Text_SetLocation(tx,sDate,sTime,value12);
}
if value12 > value11-0.7 Then
{
Box_SetColor(box,Cyan);
Box_SetFill(box,true,50);
}
else if value12 <= value11-0.7 and value12 > value11-0.9 Then
{
Box_SetColor(box,Yellow);
Box_SetFill(box,true,90);
}
else if value12 <= value11-0.9 and value12 > value11-1.3 Then
{
Box_SetColor(box,Lime);
Box_SetFill(box,true,80);
}
else if value12 <= value11-1.3 and value12 > value11-1.6 Then
{
Box_SetColor(box,Cyan);
Box_SetFill(box,true,50);
}
else if value12 <= value11-1.6 and value12 > value11-2 Then
{
Box_SetColor(box,Blue);
Box_SetFill(box,true,25);
}
else
{
Box_SetColor(box,Lime);
Box_SetFill(box,true,35);
}
}
If T == 1 Then
{
If T[1] != 1 Then
{
For j = 18 DownTo 0
{
HiVal[j+1] = HiVal[j];
HiBar[j+1] = HiBar[j];
}
HiVal[0] = H;
HiBar[0] = 0;
date11 = date[LoBar[0]];
time11 = stime[LoBar[0]];
Value11 = LoVal[0];
date12 = date[HiBar[0]];
time12 = stime[HiBar[0]];
Value12 = HiVal[0];
TL_Delete(TL);
TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen);
TL1 = TL_New(date11,time11,Value11,date12,time12,Value12);
TL_SetColor(TL1,Red);
TL_SetSize(TL1,2);
date31 = date[LoBar[0]];
time31 = stime[LoBar[0]];
date32 = date[0];
time32 = stime[0];
box = Box_New(date11,time11,Value11,date12,time12,Value12);
Text_SetSize(tx,25);
Text_SetColor(Tx,Blue);
Text_SetStyle(tx,1,0);
Text_SetBold(tx,1);
if abs(value12[1]-value11[1]) < 0.7 Then
Text_Delete(tx);
tx = Text_New(sDate,stime,value12,NumToStr(value12-value11,2));
Text_SetColor(Tx,Red);
Text_SetStyle(tx,1,1);
Text_SetSize(tx,25);
Text_SetBold(tx,1);
}
If HiVal[0] <=H Then
{
HiVal[0] = H;
HiBar[0] = 0;
date12 = date[HiBar[0]];
time12 = stime[HiBar[0]];
Value12 = HiVal[0];
TL_SetEnd(TL1, date12,time12,Value12);
date32 = date[0];
time32 = stime[0];
Box_SetEnd(box,date12,time12,Value12);
Text_SetString(tx,NumToStr(value12-value11,2));
Text_SetLocation(tx,sDate,sTime,value12);
}
if Value12 > value11+1.1 Then
{
Box_SetColor(box,Pink);
Box_SetFill(box,true,90);
}
else if value12 >= value11+0.8 and value12 <= value11+1.1 Then
{
Box_SetColor(box,Magenta);
Box_SetFill(box,true,40);
}
Else
{
Box_SetColor(box,Orange);
Box_SetFill(box,true,60);
}
}
추세선, 박스, 추세선크기, 세가지 시작점 변경.
선물 15틱 차트에서 여러봉의 고점이 같을 때, 마지막 최고가봉이 하락추세선 시작점인것을, 첫 최고가봉이 하락추세선의 시작점으로 변경.
그림1의 아래쪽은 83322와 동일한 수식이고,
그림2는 82425에서 알려주신 상기 수식의 상하대칭 지점인데 모두 첫 최고가봉이 기준점으로 되어 있습니다.
참고해서 첫 최고가봉으로 변경 부탁드립니다.
2023-09-12
1042
글번호 172361
지표
답변완료
문의 드립니다.
1.
input : StartTime(190000),EndTime(30000),진입횟수(0);
input : 익절틱수(850),손절틱수(60);
Input:Length(1),Pval(0.01);
var : Tcond(False),entry(0);
Variables: Mom(0);
Var : N1(0),dayPl(0),당일수익(0),당일손실(0),Xcond(false);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
entry = 0;
Xcond = false;
N1 = NetProfit;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
{
Tcond = False;
}
if TotalTrades > TotalTrades[1] then
{
if daypl >= 당일수익 or daypl <= -당일손실 Then
Xcond = true;
if (IsExitName("dbp",1) == true or IsExitName("dbl",1) == true ) then
Xcond = true;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
Buy("CBI_LE",AtStop,Highest(High,Length)+Pval);
ExitLong("CBI_SE",AtStop,Lowest(High,Length)+Pval);
if MarketPosition < 1 then
{
ExitLong("dbp",atStop,EntryPrice+((당일수익-daypl)/CurrentContracts));
ExitLong("dbl",AtStop,EntryPrice-((당일손실+daypl)/CurrentContracts));
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
2.
input : StartTime(190000),EndTime(30000),진입횟수(0);
input : 익절틱수(850),손절틱수(60);
Input:Length(1),Pval(0.01);
var : Tcond(False),entry(0);
Variables: Mom(0);
Var : N1(0),dayPl(0),당일수익(0),당일손실(0),Xcond(false);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
entry = 0;
Xcond = false;
N1 = NetProfit;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
{
Tcond = False;
}
if TotalTrades > TotalTrades[1] then
{
if daypl >= 당일수익 or daypl <= -당일손실 Then
Xcond = true;
if (IsExitName("dbp",1) == true or IsExitName("dbl",1) == true ) then
Xcond = true;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
ExitShort("CBI_LE",AtStop,Highest(High,Length)-Pval);
Sell("CBI_SE",AtStop,Lowest(Low,Length)-Pval);
if MarketPosition < 1 then
{
ExitShort("dbp",AtStop,EntryPrice-((당일수익-daypl)/CurrentContracts));
ExitShort("dbl",AtStop,EntryPrice-((당일손실+daypl)/CurrentContracts));
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
질의를 드렸던 내용인데요.
매수는 앞 캔들의 고가를 0.01 이상일때 진입신호로 되어있습니다.
매도는 앞 캔들의 저가를 0.01 이상일때 진입신호로 되어있습니다.
아래로 수정을 부탁드립니다.
매수는 앞 캔들의 종가를 0.01 이상일때 진입신호로 수정을 부탁드립니다.
매도는 앞 캔들의 종가를 0.01 이하일때 진입신호로 수정을 부탁드립니다.
미리 감사드립니다.
2023-09-11
1111
글번호 172359
시스템
답변완료
문의 드립니다.
//@version=3
study(title="Money Flow Index")
// Typical price = (high price + low price + closing price) / 3
// Raw money flow = typical price x volume
// Money flow ratio = (14-day Positive Money Flow) / (14-day Negative Money Flow)
// Positive money flow is calculated by summing up all of the money flow on the days in the period
// where the typical price is higher than the previous typical price. This same logic applies for the negative money flow.
// MFI = 100 - 100 / (1 + money flow ratio)
length = input(title="Period Length", type=integer, defval=10, minval=1)
show_value = input(title="Show which value", type=string, options=["Raw Money Flow", "Money Flow Ratio", "Money Flow Index"], defval="Money Flow Index")
show_raw = (show_value == "Raw Money Flow")
show_ratio = (show_value == "Money Flow Ratio")
show_index = (show_value == "Money Flow Index")
show_sma = input(title="Show MFI SMA", type=bool, defval=true)
avg_len = input(title="SMA Length", type=integer, defval=5, minval=1)
mfi_high = 80
mfi_mid = 50
mfi_low = 20
prc = avg(high, low, close)
raw = prc * volume
pos_day = (prc[0] >= prc[1]) ? raw : 0
neg_day = (prc[0] <= prc[1]) ? raw : 0
pos_period = sum(pos_day, length)
neg_period = sum(neg_day, length)
mf_ratio = (pos_period / neg_period)
mf_index = 100 - (100 / (1 + mf_ratio))
mfi_sma = sma(mf_index, avg_len)
plot(show_raw ? pos_period : na, "Positive Flow", green, linewidth=2, transp=0)
plot(show_raw ? neg_period : na, "Negative Flow", red, linewidth=2, transp=0)
plot(show_ratio ? mf_ratio : na, "Money Flow Ratio", black, linewidth=2, transp=0)
plot(show_index ? mf_index : na, "Money Flow Index", blue, linewidth=2, transp=0)
plot(show_index and show_sma ? mfi_sma : na, "Money Flow SMA", gray, linewidth=1, transp=0)
plot(show_index ? mfi_high : na, "High Line", green)
plot(show_index ? mfi_mid : na, "Mid Line", silver)
plot(show_index ? mfi_low : na, "Low Line", red)
트레이딩뷰 수식인데 위 수식에서 Money Flow Index선과 시그널선
그리고 기준선만 예스로 좀 바꿔주세요.
2023-09-11
1451
글번호 172347
지표