답변완료
안녕하세요. 수식 문의 드립니다.
안녕하세요. 아래의 신호 4개를 사용하는데요...
1봉전 기준 5봉이내 4개의 신호 중 3개의 신호가 발생되면 뜨는 신호를 만들고 싶습니다.
/// 1.신호
input : 기간(10), p(6), 기준(0), B기간(20), D1(2);
var : LL(0), HH(0), NL(0), NH(0), 저상(0),저하(0), 고상(0), 고하(0), Cnt1(0), Cnt2(0),이격률1(0),이격(0);
var : M60(0), M120(0), M240(0), 주가범위(False), 근접(False),M20(0), Bu(0), BB조건(False);
M20 = WMa(C, 20);
Bu = BollBandUp(B기간, D1);
주가범위 = C >= 1000 && C <= 100000;
LL = Lowest(L[1], 기간);
HH = Highest(H[1], 기간);
if L<LL[1] Then Cnt1 = index;
if (Index-cnt1)==(기간-p) Then 저상 = HH;
if (Index-cnt1)==(기간-p) Then 저하 = NL;
if H>HH[1] Then NH = H;
if H>HH[1] Then Cnt2 = index;
if (Index-cnt2)==(기간-p) Then 고상 = NH;
if (Index-cnt2)==(기간-p) Then 고하 = LL;
if 이격 = C/저상*100-100 Then 이격률1 = 이격;
BB조건 = BU > O && BU < C;
if 주가범위 && BB조건 && M20[2] < M20[1] && M20[1] < M20 && CrossUp(이격률1, 기준) Then plot1(L*0.99, "Dar저상 기준선 Bu 돌파");
/// 2. 신호
input : 이평기간(60),이전기간(20),signal(20);
var : Ha(0),Ca(0),La(0),MM(0),Mnt_20(0),Mnt_20S(0), 주가범위(False), M20(0);
주가범위 = C >= 1000 && C <= 100000;
M20 = WMa(C, 20);
Ha = wma(H, 이평기간);
Ca = wma(C, 이평기간);
La = wma(L, 이평기간);
MM=(Ha[1]+La[1]+Ca[1])/3*2-La[1];
Mnt_20=MM/wma(MM[1],이전기간)*100;
Mnt_20S=Ema(Mnt_20,signal);
if 주가범위 && M20[2] < M20[1] && M20[1] < M20 && CrossUp(Mnt_20,Mnt_20S) Then Plot1(L*0.97, "피봇 n개 이전값");
/// 3.신호
input : 종류(3),기간1(60),기준기간(20),기준선2(50);
var : 주가범위(false), M20(0);
M20 = wma(C,20);
주가범위 = C >= 1000 && C <= 100000;
if 종류 == 1 Then
var1 = ma(c, 기간1);
if 종류 == 2 Then
var1 = ema(c, 기간1);
if 종류 == 3 Then
var1 = wma(c, 기간1);
Var2 = iff(var1 > var1[1],1,0);
Var3 = wma(Var2,기준기간)*210;
if 주가범위 && CrossUp(Var3, 기준선2) && M20[2] < M20[1] && M20[1] < M20 Then Plot1(L*0.97,"이평강도추세");
/// 4.신호
Inputs: R기간(20),TurnLen(9), StdLen(26), PrdLen(52);
Variables: 기준선(0), 전환선(0), 후행스팬(0), 선행스팬1(0), 선행스팬2(0),MM(0), 주가범위(False),M5(0),M20(0), AA(0);
input : 기간1(20);
var : HH(0), Hc(0), LL(0), Lc(0), Cc(0),HH2(0), Hc2(0), LL2(0), Lc2(0), Cc2(0) ;
M5 = WMa(C,5);
M20 = WMa(C,20);
주가범위 = C >= 1000 && C <= 100000;
MM = Rsi(R기간);
전환선 = (Highest(MM, TurnLen) + Lowest(MM, TurnLen)) / 2;
기준선 = (Highest(MM, StdLen) + Lowest(MM, StdLen)) / 2;
후행스팬 = Close ;
선행스팬1 = (전환선 + 기준선) / 2 ;
선행스팬2 = (Highest(MM, PrdLen) + Lowest(MM, PrdLen)) / 2;
if Index%기간1 == 1 Then
{ HH = H;
LL = L; }
if HH < H Then HH = H;
if LL > L Then LL = L;
if Index%기간1 == 1 Then {
Hc = HH[1];
Lc = LL[1];
Cc = C[1] ; }
AA = (Hc+Lc+Cc)/3;
if 주가범위 && CrossUp(선행스팬1, 선행스팬2) && C > AA Then Plot1(L*0.96, "Rsi구름대 돌파");
항상 감사합니다.
2023-10-24
1003
글번호 173374
지표
답변완료
문의 드립니다.
// create base on http://www.dailyfx.com/forex_forum/coding-strategy-advisors-indicators-functions/237563-ttm-squeeze-indicator.html
study("TTM Squeeze")
length = input(title="Length", type=integer, defval=20, minval=0)
bband(length, mult) =>
sma(close, length) + mult * stdev(close, length)
keltner(length, mult) =>
ema(close, length) + mult * ema(tr, length)
e1 = (highest(high, length) + lowest(low, length)) / 2 + sma(close, length)
osc = linreg(close - e1 / 2, length, 0)
diff = bband(length, 2) - keltner(length, 1)
osc_color = osc[1] < osc[0] ? osc[0] >= 0 ? #00ffff : #cc00cc : osc[0] >= 0 ? #009b9b : #ff9bff
mid_color = diff >= 0 ? green : red
plot(osc, color=osc_color, style=histogram, linewidth=2)
plot(0, color=mid_color, style=circles, linewidth=3)
트레이딩뷰 지표인데 예스로 좀 변환해주세요.
2023-10-24
959
글번호 173372
지표
답변완료
문의 드립니다
input : StartTime(150000),EndTime(50000),midtime(210000);
input : 익절틱수1(800),손절틱수1(0);
input : 익절틱수2(160),손절틱수2(0);
var : Tcond(False),entry(0),T(0);
Variables: Mom(0);
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;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
T = 1;
}
if (sdate != sdate[1] and stime >= midtime) or
(sdate == sdate[1] and stime >= midtime and stime[1] < midtime) Then
{
Tcond = False;
T = 2;
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
{
Tcond = False;
T = 0;
}
if Tcond == true Then
{
if L ==lowest(L,2) and highest(H,2) >= lowest(L,2)+PriceScale*1 Then
{
Buy("b",AtStop,(highest(H,2)+lowest(L,2))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 4 Then
ExitShort();
}
if H == highest(H,2) and lowest(L,2) <= highest(H,2)+PriceScale*1 Then
{
Sell("s",AtStop,(lowest(L,2)+highest(H,2))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 4 Then
ExitLong();
if L ==lowest(L,1) and highest(H,3) >= lowest(L,2)+PriceScale*10 Then
{
Buy("b1",AtStop,(highest(H,3)+lowest(L,1))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 4 Then
ExitShort();
if H == highest(H,1) and lowest(L,3) <= highest(H,2)+PriceScale*10 Then
{
Sell("s1",AtStop,(lowest(L,3)+highest(H,1))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 4 Then
ExitLong();
if L ==lowest(L,1) and highest(H,3) >= lowest(L,2)+PriceScale*10 Then
{
Buy("b2",AtStop,(highest(H,3)+lowest(L,1))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 4 Then
ExitShort();
if H == highest(H,1) and lowest(L,3) <= highest(H,2)+PriceScale*10 Then
{
Sell("s2",AtStop,(lowest(L,3)+highest(H,1))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 4 Then
ExitLong();
if T == 1 Then
{
SetStopProfittarget(PriceScale*익절틱수2,PointStop);
SetStopLoss(PriceScale*손절틱수2,PointStop);
}
Else
{
SetStopProfittarget(PriceScale*익절틱수1,PointStop);
SetStopLoss(PriceScale*손절틱수1,PointStop);
}
익절시 해당 캔들의 다음신호 진입금지의
수식어가 가능한지 문의 드립니다.
2023-10-25
768
글번호 173371
시스템
답변완료
전환추세 거래량
Input : 전환(0.5);
Var:j(0),jj(0),HH(0),LL(0),hiBar(0),loBar(0),최종꼭지점(""),처리구분(""), TL(0),TX(0),TX2(0),T(0);
Array:고[10,4](0),저[10,4](0);
HH = H;
LL = L;
If Index == 0 Then
{
고[1,1] = HH;
고[1,2] = 0;
고[1,3] = sDate;
고[1,4] = sTime;
저[1,1] = LL;
저[1,2] = 0;
저[1,3] = sDate;
저[1,4] = sTime;
}
If Index > 0 Then
{
hiBar = hiBar + 1;
loBar = loBar + 1;
}
If HH[hiBar] < HH Then hiBar = 0;
If LL[loBar] > LL Then loBar = 0;
Condition1 = 저[1,1]+전환 <= HH and hiBar == 0;
Condition2 = 고[1,1]-전환 >= LL and loBar == 0;
처리구분 = "";
If Condition1 and Condition2 Then
{
If 최종꼭지점 == "저점" Then
{
If 저[1,1] > LL Then 처리구분 = "저점처리";
Else 처리구분 = "고점처리";
}
Else If 최종꼭지점 == "고점" Then
{
If 고[1,1] < HH Then 처리구분 = "고점처리";
Else 처리구분 = "저점처리";
}
}
Else If Condition1 Then 처리구분 = "고점처리";
Else If Condition2 Then 처리구분 = "저점처리";
If 처리구분 == "고점처리" Then
{
If 최종꼭지점 == "저점" Then
{
For j = 10 DownTo 2
{
For jj = 1 To 4
{
고[j,jj] = 고[j-1,jj];
}
}
고[1,1] = HH[hiBar];
고[1,2] = Index - hiBar;
고[1,3] = sDate[hiBar];
고[1,4] = sTime[hiBar];
hiBar = -1;
loBar = -1;
TL = TL_New(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]);
TL_SetSize(TL,2);
TL_SetColor(TL,RED);
T = 1;
}
Else If 고[1,1] < HH[hiBar] Then
{
고[1,1] = HH[hiBar];
고[1,2] = Index - hiBar;
고[1,3] = sDate[hiBar];
고[1,4] = sTime[hiBar];
hiBar = -1;
loBar = -1;
TL_SetEnd(TL,고[1,3],고[1,4],고[1,1]);
Text_SetString(TX,NumToStr(고[1,1]-저[1,1],2));
Text_SetLocation(TX,고[1,3],고[1,4],고[1,1]);
}
최종꼭지점 = "고점";
if MarketPosition >= 0 and T == 1 and 고[1,1] >= 저[1,1]+1 and V > 500 and V >= V[1]*2.5 Then
{
T = 2;
Sell();
}
}
If 처리구분 == "저점처리" Then
{
If 최종꼭지점 == "고점" Then
{
For j = 10 DownTo 2
{
For jj = 1 To 4
{
저[j,jj] = 저[j-1,jj];
}
}
저[1,1] = LL[loBar];
저[1,2] = Index - loBar;
저[1,3] = sDate[loBar];
저[1,4] = sTime[loBar];
hiBar = -1;
loBar = -1;
TL = TL_New(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]);
TL_SetSize(TL,2);
TL_SetColor(TL,BLUE);
T = -1;
}
Else If 저[1,1] > LL[loBar] Then
{
저[1,1] = LL[loBar];
저[1,2] = Index - loBar;
저[1,3] = sDate[loBar];
저[1,4] = sTime[loBar];
hiBar = -1;
loBar = -1;
TL_SetEnd(TL,저[1,3],저[1,4],저[1,1]);
Text_SetString(TX,NumToStr(고[1,1]-저[1,1],2));
Text_SetLocation(TX,저[1,3],저[1,4],저[1,1]);
}
최종꼭지점 = "저점";
if MarketPosition <= 0 and T == -1 and 저[1,1] <= 고[1,1]-1 and V > 500 and V >= V[1]*2.5 Then
{
T = -2;
Buy();
}
}
if MarketPosition == 1 and BarsSinceEntry == 1 Then
ExitLong();
if MarketPosition == -1 and BarsSinceEntry == 1 Then
ExitShort();
84235 재문의
한 추세선에 한번만 나오는 매매 신호를 조건이 맞으면 모두 나오게 부탁드립니다.
2023-10-24
961
글번호 173369
시스템