예스스탁
예스스탁 답변
2019-10-25 13:46:29
안녕하세요
예스스탁입니다.
Input : 손절(20),익절(15),익절하락(3);
input : P1(30), P2(120), p3(240);
input : 시작날짜(20191001), 시작시간(170000);
input : StartTime(090000),EndTime(050000);
var : tx(0),X(false);
var: Tcond1(false),Tcond2(false);
### 목표수익
var1 = ma(C, P1);
var2 = ma(C, P2);
var3 = ma(C, P3);
if sdate >= 시작날짜 and stime >= 시작시간 Then
Tcond1 = true;
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond2 = false;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond2 = true;
x = false;
}
if Tcond1 == true and Tcond2 == true and X == false then
{
## 진입
if marketposition == 0 and crossup(var1,var2) Then {
buy("B1");
}
if marketposition == 0 and crossdown(var1,var2) Then {
sell("S1");
}
if marketposition == 0 and crossup(var2,var3) and var3[1] < var3 Then {
buy("B2");
}
if marketposition == 0 and crossdown(var3,var4) and var3[1] > var3 Then {
sell("S2");
}
## 청산
if MarketPosition == 1 then {
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
if MarketPosition == -1 Then {
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
if ((sdate != sdate[1] and stime >= Endtime) or
(sdate == sdate[1] and stime >= Endtime and stime[1] < Endtime)) Then {
if MarketPosition == 1 Then {
ExitLong("BE6");
}
if MarketPosition == -1 Then {
ExitShort("SE6");
}
}
if TotalTrades > TotalTrades[1] then
{
if IsExitName("StopLoss",1) == true then
{
var1 = var1 - 40;
if var1 >= 0 Then
var1 = 0;
if var1 > -120 then
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(var1,0));
Text_SetSize(tx,9);
}
else
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],"★"+NumToStr(var1,0));
Text_SetSize(tx,12);
}
}
if IsExitName("StopTrailing",1) == true then
{
var1 = var1 + 30;
if var1 >= 0 Then
{
var1 = 0;
X = true;
}
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(var1,0));
Text_SetSize(tx,9);
}
}
}
즐거운 하루되세요
> 라떼처럼 님이 쓴 글입니다.
> 제목 : 부탁드립니다.
>
지정한 시작날짜와 시작시간 이후 매매가 시작되며
지정한 시작날짜와 시작시간 이후의 매매는 StartTime(090000),EndTime(050000) 에 매매가
되도록 부탁드립니다.
예)
시작날짜(20191001), 시작시간(170000); 매매시작
tt "0" 가 될때 까지 StartTime(090000),EndTime(050000) 동안 매매
Input : 손절(20),익절(15),익절하락(3);
input : P1(30), P2(120), p3(240);
input : 시작날짜(20191001), 시작시간(170000);
input : StartTime(090000),EndTime(050000);
var : tx(0),X(false);
### 목표수익
var1 = ma(C, P1);
var2 = ma(C, P2);
var3 = ma(C, P3);
var: Tcond(false);
if sdate >= 시작시간 and X == false then
{
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime)Then {
Tcond = true; }
if (sdate != sdate[1] and stime >= Endtime) or
(sdate == sdate[1] and stime >= Endtime and stime[1] < Endtime)Then {
Tcond = false; }
## 진입
if Tcond == true and marketposition == 0 and crossup(var1,var2) Then {
buy("B1");
}
if Tcond == true and marketposition == 0 and crossdown(var1,var2) Then {
sell("S1");
}
if Tcond == true and marketposition == 0 and crossup(var2,var3) and var3[1] < var3 Then {
buy("B2");
}
if Tcond == true and marketposition == 0 and crossdown(var3,var4) and var3[1] > var3 Then {
sell("S2");
}
## 청산
if MarketPosition == 1 then {
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
if MarketPosition == -1 Then {
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
if ((sdate != sdate[1] and stime >= Endtime) or
(sdate == sdate[1] and stime >= Endtime and stime[1] < Endtime)) Then {
if MarketPosition == 1 Then {
ExitLong("BE6");
}
if MarketPosition == -1 Then {
ExitShort("SE6");
}
}
if TotalTrades > TotalTrades[1] then
{
if IsExitName("StopLoss",1) == true then
{
var1 = var1 - 40;
if var1 >= 0 Then
var1 = 0;
if var1 > -120 then
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(var1,0));
Text_SetSize(tx,9);
}
else
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],"★"+NumToStr(var1,0));
Text_SetSize(tx,12);
}
}
if IsExitName("StopTrailing",1) == true then
{
var1 = var1 + 30;
if var1 >= 0 Then
{
var1 = 0;
X = true;
}
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(var1,0));
Text_SetSize(tx,9);
}
}
}
tt 0가 되어도 매매가 지속됩니다 0가되면 매매 종료 부탁드립니다
Input : 손절(20),익절(15),익절하락(3);
input : P1(30), P2(120), p3(240);
input : 시작날짜(20191001), 시작시간(170000);
input : StartTime(090000),EndTime(050000);
var : tt(0),tx(0),X(false);
var: Tcond1(false),Tcond2(false);
### 목표수익
var1 = ma(C, P1);
var2 = ma(C, P2);
var3 = ma(C, P3);
if sdate >= 시작날짜 and stime >= 시작시간 Then
Tcond1 = true;
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond2 = false;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond2 = true;
x = false;
}
if Tcond1 == true and Tcond2 == true and X == false then
{
## 진입
if marketposition == 0 and crossup(var1,var2) Then {
buy("B1");
}
if marketposition == 0 and crossdown(var1,var2) Then {
sell("S1");
}
if marketposition == 0 and crossup(var2,var3) and var3[1] < var3 Then {
buy("B2");
}
if marketposition == 0 and crossdown(var3,var4) and var3[1] > var3 Then {
sell("S2");
}
## 청산
if MarketPosition == 1 then {
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
if MarketPosition == -1 Then {
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
if ((sdate != sdate[1] and stime >= Endtime) or
(sdate == sdate[1] and stime >= Endtime and stime[1] < Endtime)) Then {
if MarketPosition == 1 Then {
ExitLong("BE6");
}
if MarketPosition == -1 Then {
ExitShort("SE6");
}
}
if TotalTrades > TotalTrades[1] then
{
if IsExitName("StopLoss",1) == true then
{
tt = tt - 40;
if tt >= 0 Then
tt = 0;
if tt > -120 then
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(tt,0));
Text_SetSize(tx,9);
}
else
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],"★"+NumToStr(tt,0));
Text_SetSize(tx,12);
}
}
if IsExitName("StopTrailing",1) == true then
{
tt = tt + 30;
if tt >= 0 Then
{
tt = 0;
X = true;
}
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(tt,0));
Text_SetSize(tx,9);
}
}
}
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 부탁드립니다.
> 안녕하세요
예스스탁입니다.
Input : 손절(20),익절(15),익절하락(3);
input : P1(30), P2(120), p3(240);
input : 시작날짜(20191001), 시작시간(170000);
input : StartTime(090000),EndTime(050000);
var : tx(0),X(false);
var: Tcond1(false),Tcond2(false);
### 목표수익
var1 = ma(C, P1);
var2 = ma(C, P2);
var3 = ma(C, P3);
if sdate >= 시작날짜 and stime >= 시작시간 Then
Tcond1 = true;
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond2 = false;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond2 = true;
x = false;
}
if Tcond1 == true and Tcond2 == true and X == false then
{
## 진입
if marketposition == 0 and crossup(var1,var2) Then {
buy("B1");
}
if marketposition == 0 and crossdown(var1,var2) Then {
sell("S1");
}
if marketposition == 0 and crossup(var2,var3) and var3[1] < var3 Then {
buy("B2");
}
if marketposition == 0 and crossdown(var3,var4) and var3[1] > var3 Then {
sell("S2");
}
## 청산
if MarketPosition == 1 then {
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
if MarketPosition == -1 Then {
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
if ((sdate != sdate[1] and stime >= Endtime) or
(sdate == sdate[1] and stime >= Endtime and stime[1] < Endtime)) Then {
if MarketPosition == 1 Then {
ExitLong("BE6");
}
if MarketPosition == -1 Then {
ExitShort("SE6");
}
}
if TotalTrades > TotalTrades[1] then
{
if IsExitName("StopLoss",1) == true then
{
var1 = var1 - 40;
if var1 >= 0 Then
var1 = 0;
if var1 > -120 then
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(var1,0));
Text_SetSize(tx,9);
}
else
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],"★"+NumToStr(var1,0));
Text_SetSize(tx,12);
}
}
if IsExitName("StopTrailing",1) == true then
{
var1 = var1 + 30;
if var1 >= 0 Then
{
var1 = 0;
X = true;
}
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(var1,0));
Text_SetSize(tx,9);
}
}
}
즐거운 하루되세요
> 라떼처럼 님이 쓴 글입니다.
> 제목 : 부탁드립니다.
>
지정한 시작날짜와 시작시간 이후 매매가 시작되며
지정한 시작날짜와 시작시간 이후의 매매는 StartTime(090000),EndTime(050000) 에 매매가
되도록 부탁드립니다.
예)
시작날짜(20191001), 시작시간(170000); 매매시작
tt "0" 가 될때 까지 StartTime(090000),EndTime(050000) 동안 매매
Input : 손절(20),익절(15),익절하락(3);
input : P1(30), P2(120), p3(240);
input : 시작날짜(20191001), 시작시간(170000);
input : StartTime(090000),EndTime(050000);
var : tx(0),X(false);
### 목표수익
var1 = ma(C, P1);
var2 = ma(C, P2);
var3 = ma(C, P3);
var: Tcond(false);
if sdate >= 시작시간 and X == false then
{
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime)Then {
Tcond = true; }
if (sdate != sdate[1] and stime >= Endtime) or
(sdate == sdate[1] and stime >= Endtime and stime[1] < Endtime)Then {
Tcond = false; }
## 진입
if Tcond == true and marketposition == 0 and crossup(var1,var2) Then {
buy("B1");
}
if Tcond == true and marketposition == 0 and crossdown(var1,var2) Then {
sell("S1");
}
if Tcond == true and marketposition == 0 and crossup(var2,var3) and var3[1] < var3 Then {
buy("B2");
}
if Tcond == true and marketposition == 0 and crossdown(var3,var4) and var3[1] > var3 Then {
sell("S2");
}
## 청산
if MarketPosition == 1 then {
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
if MarketPosition == -1 Then {
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
if ((sdate != sdate[1] and stime >= Endtime) or
(sdate == sdate[1] and stime >= Endtime and stime[1] < Endtime)) Then {
if MarketPosition == 1 Then {
ExitLong("BE6");
}
if MarketPosition == -1 Then {
ExitShort("SE6");
}
}
if TotalTrades > TotalTrades[1] then
{
if IsExitName("StopLoss",1) == true then
{
var1 = var1 - 40;
if var1 >= 0 Then
var1 = 0;
if var1 > -120 then
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(var1,0));
Text_SetSize(tx,9);
}
else
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],"★"+NumToStr(var1,0));
Text_SetSize(tx,12);
}
}
if IsExitName("StopTrailing",1) == true then
{
var1 = var1 + 30;
if var1 >= 0 Then
{
var1 = 0;
X = true;
}
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(var1,0));
Text_SetSize(tx,9);
}
}
}
예스스탁
예스스탁 답변
2019-10-25 17:26:34
안녕하세요
예스스탁입니다.
답변드린 수식이 0이되면 당일 진입을 제한하다가 다음날 StartTime이 되면 초기화되게 작성되어 있습니다.
한번발생하면 이후에는 진입이 없게 수정해 드립니다.
Input : 손절(20),익절(15),익절하락(3);
input : P1(30), P2(120), p3(240);
input : 시작날짜(20191001), 시작시간(170000);
input : StartTime(090000),EndTime(050000);
var : tt(0),tx(0),X(false);
var: Tcond1(false),Tcond2(false);
### 목표수익
var1 = ma(C, P1);
var2 = ma(C, P2);
var3 = ma(C, P3);
if sdate >= 시작날짜 and stime >= 시작시간 Then
Tcond1 = true;
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond2 = false;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond2 = true;
}
if Tcond1 == true and Tcond2 == true and X == false then
{
## 진입
if marketposition == 0 and crossup(var1,var2) Then {
buy("B1");
}
if marketposition == 0 and crossdown(var1,var2) Then {
sell("S1");
}
if marketposition == 0 and crossup(var2,var3) and var3[1] < var3 Then {
buy("B2");
}
if marketposition == 0 and crossdown(var3,var4) and var3[1] > var3 Then {
sell("S2");
}
## 청산
if MarketPosition == 1 then {
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
if MarketPosition == -1 Then {
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
if ((sdate != sdate[1] and stime >= Endtime) or
(sdate == sdate[1] and stime >= Endtime and stime[1] < Endtime)) Then {
if MarketPosition == 1 Then {
ExitLong("BE6");
}
if MarketPosition == -1 Then {
ExitShort("SE6");
}
}
if TotalTrades > TotalTrades[1] then
{
if IsExitName("StopLoss",1) == true then
{
tt = tt - 40;
if tt >= 0 Then
tt = 0;
if tt > -120 then
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(tt,0));
Text_SetSize(tx,9);
}
else
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],"★"+NumToStr(tt,0));
Text_SetSize(tx,12);
}
}
if IsExitName("StopTrailing",1) == true then
{
tt = tt + 30;
if tt >= 0 Then
{
tt = 0;
X = true;
}
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(tt,0));
Text_SetSize(tx,9);
}
}
}
즐거운 하루되세요
> 라떼처럼 님이 쓴 글입니다.
> 제목 : Re : Re : 부탁드립니다.
> tt 0가 되어도 매매가 지속됩니다 0가되면 매매 종료 부탁드립니다
Input : 손절(20),익절(15),익절하락(3);
input : P1(30), P2(120), p3(240);
input : 시작날짜(20191001), 시작시간(170000);
input : StartTime(090000),EndTime(050000);
var : tt(0),tx(0),X(false);
var: Tcond1(false),Tcond2(false);
### 목표수익
var1 = ma(C, P1);
var2 = ma(C, P2);
var3 = ma(C, P3);
if sdate >= 시작날짜 and stime >= 시작시간 Then
Tcond1 = true;
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond2 = false;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond2 = true;
x = false;
}
if Tcond1 == true and Tcond2 == true and X == false then
{
## 진입
if marketposition == 0 and crossup(var1,var2) Then {
buy("B1");
}
if marketposition == 0 and crossdown(var1,var2) Then {
sell("S1");
}
if marketposition == 0 and crossup(var2,var3) and var3[1] < var3 Then {
buy("B2");
}
if marketposition == 0 and crossdown(var3,var4) and var3[1] > var3 Then {
sell("S2");
}
## 청산
if MarketPosition == 1 then {
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
if MarketPosition == -1 Then {
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
if ((sdate != sdate[1] and stime >= Endtime) or
(sdate == sdate[1] and stime >= Endtime and stime[1] < Endtime)) Then {
if MarketPosition == 1 Then {
ExitLong("BE6");
}
if MarketPosition == -1 Then {
ExitShort("SE6");
}
}
if TotalTrades > TotalTrades[1] then
{
if IsExitName("StopLoss",1) == true then
{
tt = tt - 40;
if tt >= 0 Then
tt = 0;
if tt > -120 then
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(tt,0));
Text_SetSize(tx,9);
}
else
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],"★"+NumToStr(tt,0));
Text_SetSize(tx,12);
}
}
if IsExitName("StopTrailing",1) == true then
{
tt = tt + 30;
if tt >= 0 Then
{
tt = 0;
X = true;
}
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(tt,0));
Text_SetSize(tx,9);
}
}
}
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 부탁드립니다.
> 안녕하세요
예스스탁입니다.
Input : 손절(20),익절(15),익절하락(3);
input : P1(30), P2(120), p3(240);
input : 시작날짜(20191001), 시작시간(170000);
input : StartTime(090000),EndTime(050000);
var : tx(0),X(false);
var: Tcond1(false),Tcond2(false);
### 목표수익
var1 = ma(C, P1);
var2 = ma(C, P2);
var3 = ma(C, P3);
if sdate >= 시작날짜 and stime >= 시작시간 Then
Tcond1 = true;
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond2 = false;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond2 = true;
x = false;
}
if Tcond1 == true and Tcond2 == true and X == false then
{
## 진입
if marketposition == 0 and crossup(var1,var2) Then {
buy("B1");
}
if marketposition == 0 and crossdown(var1,var2) Then {
sell("S1");
}
if marketposition == 0 and crossup(var2,var3) and var3[1] < var3 Then {
buy("B2");
}
if marketposition == 0 and crossdown(var3,var4) and var3[1] > var3 Then {
sell("S2");
}
## 청산
if MarketPosition == 1 then {
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
if MarketPosition == -1 Then {
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
if ((sdate != sdate[1] and stime >= Endtime) or
(sdate == sdate[1] and stime >= Endtime and stime[1] < Endtime)) Then {
if MarketPosition == 1 Then {
ExitLong("BE6");
}
if MarketPosition == -1 Then {
ExitShort("SE6");
}
}
if TotalTrades > TotalTrades[1] then
{
if IsExitName("StopLoss",1) == true then
{
var1 = var1 - 40;
if var1 >= 0 Then
var1 = 0;
if var1 > -120 then
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(var1,0));
Text_SetSize(tx,9);
}
else
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],"★"+NumToStr(var1,0));
Text_SetSize(tx,12);
}
}
if IsExitName("StopTrailing",1) == true then
{
var1 = var1 + 30;
if var1 >= 0 Then
{
var1 = 0;
X = true;
}
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(var1,0));
Text_SetSize(tx,9);
}
}
}
즐거운 하루되세요
> 라떼처럼 님이 쓴 글입니다.
> 제목 : 부탁드립니다.
>
지정한 시작날짜와 시작시간 이후 매매가 시작되며
지정한 시작날짜와 시작시간 이후의 매매는 StartTime(090000),EndTime(050000) 에 매매가
되도록 부탁드립니다.
예)
시작날짜(20191001), 시작시간(170000); 매매시작
tt "0" 가 될때 까지 StartTime(090000),EndTime(050000) 동안 매매
Input : 손절(20),익절(15),익절하락(3);
input : P1(30), P2(120), p3(240);
input : 시작날짜(20191001), 시작시간(170000);
input : StartTime(090000),EndTime(050000);
var : tx(0),X(false);
### 목표수익
var1 = ma(C, P1);
var2 = ma(C, P2);
var3 = ma(C, P3);
var: Tcond(false);
if sdate >= 시작시간 and X == false then
{
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime)Then {
Tcond = true; }
if (sdate != sdate[1] and stime >= Endtime) or
(sdate == sdate[1] and stime >= Endtime and stime[1] < Endtime)Then {
Tcond = false; }
## 진입
if Tcond == true and marketposition == 0 and crossup(var1,var2) Then {
buy("B1");
}
if Tcond == true and marketposition == 0 and crossdown(var1,var2) Then {
sell("S1");
}
if Tcond == true and marketposition == 0 and crossup(var2,var3) and var3[1] < var3 Then {
buy("B2");
}
if Tcond == true and marketposition == 0 and crossdown(var3,var4) and var3[1] > var3 Then {
sell("S2");
}
## 청산
if MarketPosition == 1 then {
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
if MarketPosition == -1 Then {
SetStopTrailing(익절하락,익절,PointStop);
SetStopLoss(손절,PointStop);
}
if ((sdate != sdate[1] and stime >= Endtime) or
(sdate == sdate[1] and stime >= Endtime and stime[1] < Endtime)) Then {
if MarketPosition == 1 Then {
ExitLong("BE6");
}
if MarketPosition == -1 Then {
ExitShort("SE6");
}
}
if TotalTrades > TotalTrades[1] then
{
if IsExitName("StopLoss",1) == true then
{
var1 = var1 - 40;
if var1 >= 0 Then
var1 = 0;
if var1 > -120 then
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(var1,0));
Text_SetSize(tx,9);
}
else
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],"★"+NumToStr(var1,0));
Text_SetSize(tx,12);
}
}
if IsExitName("StopTrailing",1) == true then
{
var1 = var1 + 30;
if var1 >= 0 Then
{
var1 = 0;
X = true;
}
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(var1,0));
Text_SetSize(tx,9);
}
}
}