예스스탁
예스스탁 답변
2020-04-27 15:18:13
안녕하세요
예스스탁입니다.
input : 시작(30), 종료(50),N(10);
input : 손절(20),익절(15),익절하락(3);
input : P1(30), P2(120), p3(240);
input : StartTime(090000),EndTime(050000);
var : tt(0),tx(0),X(false),tx1(0),cnt(0),sum(0);
var: Tcond(false),ht(0),lcnt(0),trcnt(0),R(-1);
Array : XX[200](-1);
var : tx3(0),cnt3(0),sum3(0),lcnt3(0),trcnt3(0),R3(-1), TR3(0), GR3(0);
Array : XX3[200](-1);
var1 = ma(C, P1);
var2 = ma(C, P2);
var3 = ma(C, P3);
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
tt = 0;
X = false;
}
if Tcond == true then
{
if marketposition == 0 and crossup(var1,var2) Then {
if Condition3 == true then ####
buy("B1■");
Else
buy("B1");
}
if marketposition == 0 and crossdown(var1,var2) Then {
if Condition3 == true then ####
sell("S1■");
Else
sell("S1");
}
if marketposition == 0 and crossup(var2,var3) and var3[1] < var3 Then {
if Condition3 == true then ####
buy("B2■");
Else
buy("B2");
}
if marketposition == 0 and crossdown(var3,var4) and var3[1] > var3 Then {
if Condition3 == true then ####
sell("S2■");
Else
sell("S2");
}
if MarketPosition == 1 then
{
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
if MarketPosition == -1 Then
{
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
}
### 수정 요청 (삭제해도 무방합니다.)
if TotalTrades > TotalTrades[1] then
{
if IsExitName("StopLoss",1) == true then
{
lcnt3 = lcnt3+1;
XX3[0] = 0;
for cnt3 = 1 to 199
{
XX3[cnt3] = XX3[cnt3-1][1];
}
if (trcnt3+lcnt3) >= N then
{
sum3 = 0;
for cnt3 = 0 to N-1
{
if XX3[cnt3] == 1 Then
sum3 = sum3 + 1;
}
R3 = sum3/N*100;
if Condition3 == false and R3 <= 30 and R3[1] > 30 Then
{
Condition3 = true;
value1 = sum3;
value2 = 1;
}
else
{
if Condition3 == true Then
{
value1 = value1 + 0;
value2 = value2 + 1;
if value1/value2*100 >= 50 Then
Condition3 = true;
}
}
}
}
if IsExitName("StopTrailing",1) == true then
{
trcnt3 = trcnt3+1;
XX3[0] = 1;
for cnt3 = 1 to 199
{
XX3[cnt3] = XX3[cnt3-1][1];
}
if (trcnt3+lcnt3) >= N then
{
sum3 = 0;
for cnt3 = 0 to N-1
{
if XX3[cnt3] == 1 Then
sum3 = sum3+1;
}
R3 = sum3/N*100;
if Condition3 == false and R3 <= 30 and R3[1] > 30 Then
{
Condition3 = true;
value1 = sum3;
value2 = 1;
}
else
{
if Condition3 == true Then
{
value1 = value1 + 1;
value2 = value2 + 1;
if value1/value2*100 >= 50 Then
Condition3 = true;
}
}
}
}
TR3 = trcnt3/(trcnt3+lcnt3)*100 ;
}
Text_Delete(tx3);
tx3 = Text_New(NextBarSdate,NextBarStime,H,NumToStr(TR3,1)+NewLine+NumToStr(R3,1));
Text_SetSize(tx3,15);
Text_Setstyle(tx3,2,20);
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
{
Tcond = false;
if MarketPosition == 1 Then
{
ExitLong("BE6");
}
if MarketPosition == -1 Then
{
ExitShort("SE6");
}
}
즐거운 하루되세요
> 라떼처럼 님이 쓴 글입니다.
> 제목 : 부탁드립니다
> 항상 감사드립니다
아래의 식을 다음의 조건으로 수정을 하고 싶습니다.
그럼 부탁 좀 드리겠습니다.
1. 수정: 최근 10 개(변수), (아래수식: 최근 5%의 개수)
2. 최근 10개의 R3의 값이 30 이하가 되면
"10개를 포함하여 누적으로 T3가 50 까지 도달"할때까지
■가 포함된 신호 (B■,S■)로 표현하고 싶습니다. (그림 및 3,4,5번에 설명)
"T3"값이 50까지 도달 되면 다시 B,S 으로 표시
3. "T3" : "10개를 포함"하여 누적 된 값
T3 = [(누적STrailing개수)/(누적SLoss+누적STrailing)개수] x100
R3의 값이 30 이하가 되면 R3의 값을 30으로 만들어준 10개를 포함하여
이후 청산되는 stoploss, stoptrailing 수를 누적시켜(10+1, 10+2, 10+3 ...)
T3 값을 만들고 싶습니다.
*R3 30 이하가 되고 T3가 50이 될때 까지는 R3 값은 무시
(T3가 50이 될때 까지 R3값에 의한 조건발생 없음)
(T3가 50 도달 이후에 최근 10개에 대한 R3값에 의해 조건 발생)
5. R3값 표시(검정): 아래수식 동일 (최근 10개에 대한 R3값 마지막 봉 표시)
T3값 표시(빨강): ■가 포함된 신호발생 후 청산(stoploss, stoptrailing) 다음 봉에
T3가 50이 될때 까지 만 표시
그럼 부탁드립니다.
input : 시작(30), 종료(50);
input : 손절(20),익절(15),익절하락(3);
input : P1(30), P2(120), p3(240);
input : StartTime(090000),EndTime(050000);
var : tt(0),tx(0),X(false),tx1(0),cnt(0),sum(0);
var: Tcond(false),ht(0),lcnt(0),trcnt(0),R(-1);
Array : XX[200](-1);
var : tx3(0),cnt3(0),sum3(0),lcnt3(0),trcnt3(0),R3(-1), TR3(0), GR3(0);
Array : XX3[200](-1);
var1 = ma(C, P1);
var2 = ma(C, P2);
var3 = ma(C, P3);
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
tt = 0;
X = false;
}
if Tcond == true then
{
if marketposition == 0 and crossup(var1,var2) Then {
if Condition3 == true then ####
buy("B1■");
Else
buy("B1");
}
if marketposition == 0 and crossdown(var1,var2) Then {
if Condition3 == true then ####
sell("S1■");
Else
sell("S1");
}
if marketposition == 0 and crossup(var2,var3) and var3[1] < var3 Then {
if Condition3 == true then ####
buy("B2■");
Else
buy("B2");
}
if marketposition == 0 and crossdown(var3,var4) and var3[1] > var3 Then {
if Condition3 == true then ####
sell("S2■");
Else
sell("S2");
}
if MarketPosition == 1 then
{
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
if MarketPosition == -1 Then
{
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
}
### 수정 요청 (삭제해도 무방합니다.)
if TotalTrades > TotalTrades[1] then
{
if IsExitName("StopLoss",1) == true then
{
lcnt3 = lcnt3+1;
XX3[0] = 0;
for cnt3 = 1 to 199
{
XX3[cnt3] = XX3[cnt3-1][1];
}
if Floor((trcnt3+lcnt3)*(0.05)) > 1 then
{
sum3 = 0;
for cnt3 = 0 to Floor((trcnt3+lcnt3)*(0.05))-1
{
if XX3[cnt3] == 1 Then
sum3 = sum3 + 1;
}
R3 = sum3/Floor((trcnt3+lcnt3)*(0.05))*100;
}
}
if IsExitName("StopTrailing",1) == true then
{
trcnt3 = trcnt3+1;
XX3[0] = 1;
for cnt3 = 1 to 199
{
XX3[cnt3] = XX3[cnt3-1][1];
}
if Floor((trcnt3+lcnt3)*(0.05)) > 1 then
{
sum3 = 0;
for cnt3 = 0 to Floor((trcnt3+lcnt3)*(0.05))-1
{
if XX3[cnt3] == 1 Then
sum3 = sum3+1;
}
R3 = sum3/Floor((trcnt3+lcnt3)*(0.05))*100;
}
}
TR3 = trcnt3/(trcnt3+lcnt3)*100 ;
}
if R3 <= 시작 and R3[1] > 시작 Then
Condition3 = true;
if Condition3 == true
and R3 >= 종료 and R3[1] < 종료 Then
Condition3 = false;
Text_Delete(tx3);
tx3 = Text_New(NextBarSdate,NextBarStime,H,NumToStr(TR3,1)+NewLine+NumToStr(R3,1));
Text_SetSize(tx3,15);
Text_Setstyle(tx3,2,20);
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
{
Tcond = false;
if MarketPosition == 1 Then
{
ExitLong("BE6");
}
if MarketPosition == -1 Then
{
ExitShort("SE6");
}
}