예스스탁
예스스탁 답변
2020-04-16 10:39:35
안녕하세요
예스스탁입니다.
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);
## 카운트3
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 TotalTrades >= 300 Then
value1 = 0.02;
else if 200 < TotalTrades and TotalTrades < 300 Then
value1 = 0.04;
else
value1 = 0.05;
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)*(value1)) > 1 then
{
sum3 = 0;
for cnt3 = 0 to Floor((trcnt3+lcnt3)*(value1))-1
{
if XX3[cnt3] == 1 Then
sum3 = sum3 + 1;
}
R3 = sum3/Floor((trcnt3+lcnt3)*(value1))*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)*(value1)) > 1 then
{
sum3 = 0;
for cnt3 = 0 to Floor((trcnt3+lcnt3)*(value1))-1
{
if XX3[cnt3] == 1 Then
sum3 = sum3+1;
}
R3 = sum3/Floor((trcnt3+lcnt3)*(value1))*100;
}
}
TR3 = trcnt3/(trcnt3+lcnt3)*100 ;
}
if R3 <= 40 and R3[1] > 40 Then
Condition1 = true;
if Condition1 == true and R3 >= 70 and R3[1] < 70 Then
Condition1 = 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");
}
}
즐거운 하루되세요
> 라떼처럼 님이 쓴 글입니다.
> 제목 : 부탁드립니다.
> 항상 감사드립니다.
1. 아래의 식에서 R3의 값이 40 이하가 되면 70 까지 도달 할때까지
■가 포함된 신호로 표현하고 싶습니다.
단순히 40~70 사이 값에서 ■ 포함 표시가 아니고,
R3의 값이 40 이하가 되면 ■포함(B1■) 되기 시작되어, 70 도달 전까지 ■포함 되고,
다시 40 이하가 되기 전까지는 일반으로(B1) 표시가 될수 있도록 요청을 드립니다.
R3 60 40 20 30 50 70 90 70 50 40 20
표시 B B■ B■ B■ B■ B B B B B■ B■
2. ###카운트3 에서 0.03 의 값을 전략창 전체 진입수 조건에 따라 변경하고 싶습니다.
300개 <= 전체 진입수 일때는 0.02
200개 <= 전체 진입수 < 300개 일때는 0.04
전체 진입수 < 200개 일때는 0.05
### 부분은 작성을 해본 수식입니다. 수정해 주시면 됩니다. 감사합니다.
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);
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 and R3 < 50 then #### <-- 수정요청
buy("B1■");
Else
buy("B1");
}
if marketposition == 0 and crossdown(var1,var2) Then {
if Condition3 == true and R3 < 50 then #### <-- 수정요청
sell("S1■");
Else
sell("S1");
}
if marketposition == 0 and crossup(var2,var3) and var3[1] < var3 Then {
if Condition3 == true and R3 < 50 then #### <-- 수정요청
buy("B2■");
Else
buy("B2");
}
if marketposition == 0 and crossdown(var3,var4) and var3[1] > var3 Then {
if Condition3 == true and R3 < 50 then #### <-- 수정요청
sell("S2■");
Else
sell("S2");
}
## 청산
if MarketPosition == 1 then
{
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
if MarketPosition == -1 Then
{
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
}
## 카운트3
var : tx3(0),cnt3(0),sum3(0),lcnt3(0),trcnt3(0),R3(-1), TR3(0), GR3(0);
Array : XX3[200](-1);
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.03)) > 1 then
{
sum3 = 0;
for cnt3 = 0 to Floor((trcnt3+lcnt3)*(0.03))-1
{
if XX3[cnt3] == 1 Then
sum3 = sum3 + 1;
}
R3 = sum3/Floor((trcnt3+lcnt3)*(0.03))*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.03)) > 1 then
{
sum3 = 0;
for cnt3 = 0 to Floor((trcnt3+lcnt3)*(0.03))-1
{
if XX3[cnt3] == 1 Then
sum3 = sum3+1;
}
R3 = sum3/Floor((trcnt3+lcnt3)*(0.03))*100;
}
}
TR3 = trcnt3/(trcnt3+lcnt3)*100 ;
}
### 수정요청↓
if R3 > 40 Then
{
Condition3 = false;
}
else
{
Condition3 = true;
}
if Condition3 == true and R3 >= 70 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");
}
}