예스스탁
예스스탁 답변
2019-11-07 14:40:33
안녕하세요
예스스탁입니다.
input : 시작날짜(20191001), 시작시간(170000);
Input: AA(-120), BB(-40);
Input : 손절(10),익절(10),익절하락(3);
input : P1(30), P2(120), p3(240);
input : StartTime(090000),EndTime(050000);
var : tx(0),X(false),Tcond(false),tt(0);
var : Tcond1(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 >= 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 Tcond1 == true and Tcond == true and X == false then
{
if Tcond == true and marketposition == 0
and crossup(var1,var2) Then
{
if Condition1 == true and tt <= BB then
buy("B1■");
Else
buy("B1");
}
if Tcond == true and marketposition == 0
and crossdown(var1,var2) Then
{
if Condition1 == true and tt <= BB then
sell("S1■");
Else
sell("S1");
}
if Tcond == true and marketposition == 0
and crossup(var2,var3) and var3[1] < var3 Then
{
if Condition1 == true and tt <= BB then
buy("B2■");
Else
buy("B2");
}
if Tcond == true and marketposition == 0
and crossdown(var3,var4) and var3[1] > var3 Then
{
if Condition1 == true and tt <= BB then
sell("S2■");
Else
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;
Condition1 = false;
}
if tt > AA then
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(tt,0));
Text_SetSize(tx,20);
}
else
{
Condition1 = true;
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(tt,0)+"★");
Text_SetSize(tx,20);
}
}
if IsExitName("StopTrailing",1) == true then
{
tt = tt + 30;
if tt >= 0 Then
{
tt = 0;
Condition1 = false;
}
if tt >= BB and
(IsEntryName("B1■",1) == true or
IsEntryName("B2■",1) == true or
IsEntryName("S1■",1) == true or
IsEntryName("S2■",1) == true) Then
X = true;
if Condition1 == true and tt >= BB then
Condition1 = false;
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(tt,0));
Text_SetSize(tx,20);
Text_Setstyle(tx,2,2);
//Text_SetSize 폰트 사이즈
//Text_Setstyle 좌우상하 정렬
}
}
}
즐거운 하루되세요
> 라떼처럼 님이 쓴 글입니다.
> 제목 : 부탁드립니다.
> 매번 감사드립니다.
수식 수정좀 부탁드립니다.
아래식은 지정한 날짜,시간 이후 tt==0 가 되면 매매가 정지되는 수식입니다.
예)
진입(B1■,B1) --> 청산(심볼0) 이면 매매 정지
이 수식을 진입이 B1■, B2■, S1■, S2■인 경우 BB(-40)보다 크면 (청산심볼-40) 이면
매매가 정지하는 식으로 수정하고 싶습니다.
BB(-100): 진입이 B1■, B2■, S1■, S2■인 경우 BB(-100)보다 크면(청산심볼-100) 이면
매매 정지
예)
BB(-40)
진입(B1■) --> 청산(심볼-40) 이면 매매 정지
진입(B1) --> 청산(심볼-40) 이면 매매 지속
BB(-100)
진입(B1■) --> 청산(심볼-100) 이면 매매 정지
진입(B1) --> 청산(심볼-100) 이면 매매 지속
input : 시작날짜(20191001), 시작시간(170000);
Input: AA(-120), BB(-40);
Input : 손절(10),익절(10),익절하락(3);
input : P1(30), P2(120), p3(240);
input : StartTime(090000),EndTime(050000);
var : tx(0),X(false),Tcond(false),tt(0);
var : Tcond1(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 >= 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 Tcond1 == true and Tcond == true and X == false then
{
if Tcond == true and marketposition == 0
and crossup(var1,var2) Then
{
if Condition1 == true and tt <= BB then
buy("B1■");
Else
buy("B1");
}
if Tcond == true and marketposition == 0
and crossdown(var1,var2) Then
{
if Condition1 == true and tt <= BB then
sell("S1■");
Else
sell("S1");
}
if Tcond == true and marketposition == 0
and crossup(var2,var3) and var3[1] < var3 Then
{
if Condition1 == true and tt <= BB then
buy("B2■");
Else
buy("B2");
}
if Tcond == true and marketposition == 0
and crossdown(var3,var4) and var3[1] > var3 Then
{
if Condition1 == true and tt <= BB then
sell("S2■");
Else
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;
Condition1 = false;
}
if tt > AA then
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(tt,0));
Text_SetSize(tx,20);
}
else
{
Condition1 = true;
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(tt,0)+"★");
Text_SetSize(tx,20);
}
}
if IsExitName("StopTrailing",1) == true then
{
tt = tt + 30;
if tt >= 0 Then
{
tt = 0;
X = true;
Condition1 = false;
}
if Condition1 == true and tt >= BB then
Condition1 = false;
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(tt,0));
Text_SetSize(tx,20);
Text_Setstyle(tx,2,2);
//Text_SetSize 폰트 사이즈
//Text_Setstyle 좌우상하 정렬
}
}
}