예스스탁
예스스탁 답변
2020-03-09 17:20:30
안녕하세요
예스스탁입니다.
input : DAA(90);
input : 손절(20),익절(15),익절하락(3);
input : P1(30), P2(120), p3(240);
input : StartTime(090000),EndTime(050000);
var : tt(0),tx(0),X(false);
var: Tcond(false);
### 목표수익
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 (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");
}
}
if Tcond == 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 TotalTrades > TotalTrades[1] then
{
if IsExitName("StopLoss",1) == true then
{
tt = tt - 40;
if tt >= DAA Then
{
X = True;
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(tt,0)+"◆");
Text_SetSize(tx,20);
Text_Setstyle(tx,2,20);
Text_SetColor(tx,GREEN);
}
}
if IsExitName("StopTrailing",1) == true then
{
tt = tt + 30;
if tt >= DAA Then
{
X = True;
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(tt,0)+"◆");
Text_SetSize(tx,20);
Text_Setstyle(tx,2,20);
Text_SetColor(tx,GREEN);
}
}
}
즐거운 하루되세요
> 라떼처럼 님이 쓴 글입니다.
> 제목 : 부탁드립니다.
> 항상 감사드립니다.
아래식에서
당일 StartTime 에 tt = 0 을 시작으로
EndTime전에 DAA(90) 도달히먄(◆발생이면) 더이상 신호발생 없이
당일 매매를 종료하고 싶습니다.
아래식은
StartTime에 0 부터 시작되지 않습니다.
StartTime 부터 tt 가 0 부터 시작되게 해주세요
DAA가 90 도달시 매매가 종료되지 않습니다. 신호가 계속발생됩니다
90이상이면 매매가 당일 매매가 종료되게 해주세요.
그럼 부탁드립니다.
input : DAA(90);
input : 손절(20),익절(15),익절하락(3);
input : P1(30), P2(120), p3(240);
input : StartTime(090000),EndTime(050000);
var : tt(0),tx(0),X(false);
var: Tcond(false);
### 목표수익
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 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 sTime == startTime then
{
tt = 0;
}
if IsExitName("StopLoss",1) == true then
{
tt = tt - 40;
if tt >= DAA Then
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(tt,0)+"◆");
Text_SetSize(tx,20);
Text_Setstyle(tx,2,20);
Text_SetColor(tx,GREEN);
}
}
if IsExitName("StopTrailing",1) == true then
{
tt = tt + 30;
if tt >= DAA Then
{
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(tt,0)+"◆");
Text_SetSize(tx,20);
Text_Setstyle(tx,2,20);
Text_SetColor(tx,GREEN);
}
}
if tt >= DAA Then
{
X = false;
}
else
{
X = True;
}
}
}