예스스탁
예스스탁 답변
2020-03-10 16:13:36
안녕하세요
예스스탁입니다.
1
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),ht(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;
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 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 > ht Then
{
ht = tt;
}
if ht >= DAA Then
{
X = True;
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(ht,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 > ht Then
{
ht = tt;
}
if ht >= DAA Then
{
X = True;
tx = Text_New(ExitDate(1),ExitTime(1),h[BarsSinceExit(1)],NumToStr(ht,0)+"◆");
Text_SetSize(tx,20);
Text_Setstyle(tx,2,20);
Text_SetColor(tx,GREEN);
}
}
}
;
2
텍스트는 날자와 시간, 가격을 지정해 출력하는데
차트의 하단등은 위치를 잡을수가 없습니다.
3
아래 내용 참고하셔서 응용하시면 됩니다.
Input : 당일수익틱수(80),당일손실틱수(80);
Var : N1(0),dayPl(0),당일수익(0),당일손실(0),Xcond(false);
당일수익 = PriceScale*당일수익틱수;
당일손실 = PriceScale*당일손실틱수;
if Bdate != Bdate[1] Then
{
Xcond = false;
N1 = NetProfit;
}
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] then
{
if daypl >= 당일수익 or daypl <= -당일손실 Then
Xcond = true;
if (IsExitName("dbp",1) == true or IsExitName("dbl",1) == true or
IsExitName("dsp",1) == true or IsExitName("dsl",1) == true) then
Xcond = true;
}
if Xcond == false then{
if /*매수진입조건*/ C > O Then{
buy("b");
}
if /*매도진입조건*/ C < O Then{
sell("s");
}
}
if MarketPosition == 1 then{
ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts));
ExitLong("dbl",AtStop,EntryPrice-((당일손실+daypl)/CurrentContracts));
}
if MarketPosition == -1 then{
ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts));
ExitShort("dsl",AtStop,EntryPrice+((당일손실+daypl)/CurrentContracts));
}
즐거운 하루되세요
> 라떼처럼 님이 쓴 글입니다.
> 제목 : 부탁드립니다.
> 항상 감사합니다.
작성된 식에서
1.카운트에서 당일 DAA가 90 이상 도달되면
당일 이후 나오는 tt가 모두 도달된 최대값으로 나오게 요청드립니다.
2.카운트의 숫자와 표시를 전략창 맨 하단에 표시될 수 있도록 부탁드립니다.
3. 당일 목표수익 100틱 도달시 당일 매매가 종료되는 식은 예로 주시면
직접 반영하겠습니다. 예시 하나 요청드립니다.
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 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);
}
}
}