예스스탁
예스스탁 답변
2020-04-10 15:01:23
안녕하세요
예스스탁입니다.
input: BB(0), AA(-40);
Input : 손절(3),익절(3),익절하락(1);
input : P1(30), P2(120), p3(240);
input : StartTime(090300),EndTime(151500);
var : tx(0),X(false),Tcond(false),tt(0),vol(1);
var1 = ma(C, P1);
var2 = ma(C, P2);
var3 = ma(C, P3);
if vol == 1 and tt <= -30 and tt != tt[1] Then
vol = 2;
if vol == 2 then
{
if tt <= -60 and tt != tt[1] Then
vol = 3;
if tt >= 0 and tt != tt[1] Then
vol = 1;
}
if vol == 3 then
{
if tt >= -30 and tt != tt[1] Then
vol = 2;
}
######## 진입제한
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",OnClose,def,vol);
}
if Tcond == true and marketposition == 0
and crossdown(var1,var2) Then
{
sell("S1",OnClose,def,vol);
}
if Tcond == true and marketposition == 0
and crossup(var2,var3) and var3[1] < var3 Then
{
buy("B2",OnClose,def,vol);
}
if Tcond == true and marketposition == 0
and crossdown(var3,var4) and var3[1] > var3 Then
{
sell("S2",OnClose,def,vol);
}
#### Target 청산
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
{
tt = tt - 10;
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);
Text_Setstyle(tx,2,20);
}
else
{
Condition1 = true;
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(tt,0)+"★");
Text_SetSize(tx,20);
Text_Setstyle(tx,2,20);
}
}
if IsExitName("StopTrailing",1) == true then
{
tt = tt + 10;
if tt >= 0 Then
{
tt = 0;
X = true;
Condition1 = false;
}
if Condition1 == true and tt >= BB then ###
Condition1 = false; ###
if tt > AA then ###
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(tt,0));
Text_SetSize(tx,20);
Text_Setstyle(tx,2,2);
}
else
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(tt,0)+"★");
Text_SetSize(tx,20);
Text_Setstyle(tx,2,2);
}
}
}
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");
}
즐거운 하루되세요
> 라떼처럼 님이 쓴 글입니다.
> 제목 : 부탁드립니다.
> 항상 감사드립니다.
아래식을 수정하여 진입 계약 수를 조절하고 싶습니다.
그럼 부탁드립니다.
tt가
1) -30 < tt <= 0 인 경우 1계약
2) -30 도달 되면 tt가 0이 될때까지 2계약
==> -30<=tt 가 되면, -60 < tt <= 0 까지 2계약,
0 까지 도달 시 계약수 1로 변경 ==> 1)수행
3) -60 도달 되면 tt가 -30이 될때까지 3계약
==> -60<=tt 가 되면, tt <=-60 or -60 <= tt <-30 까지 3계약,
-30 이상 도달 시 계약수 2로 변경 ==> 2)수행
input: BB(0), AA(-40);
Input : 손절(3),익절(3),익절하락(1);
input : P1(30), P2(120), p3(240);
input : StartTime(090300),EndTime(151500);
var : tx(0),X(false),Tcond(false),tt(0);
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;
}
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");
}
#### Target 청산
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
{
tt = tt - 10;
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);
Text_Setstyle(tx,2,20);
}
else
{
Condition1 = true;
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(tt,0)+"★");
Text_SetSize(tx,20);
Text_Setstyle(tx,2,20);
}
}
if IsExitName("StopTrailing",1) == true then
{
tt = tt + 10;
if tt >= 0 Then
{
tt = 0;
X = true;
Condition1 = false;
}
if Condition1 == true and tt >= BB then ###
Condition1 = false; ###
if tt > AA then ###
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(tt,0));
Text_SetSize(tx,20);
Text_Setstyle(tx,2,2);
}
else
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(tt,0)+"★");
Text_SetSize(tx,20);
Text_Setstyle(tx,2,2);
}
}
}
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");
}