예스스탁
예스스탁 답변
2021-05-03 13:21:29
안녕하세요
예스스탁입니다.
1
Input : short(12),long(26),signal(9);
input : P1(5),P2(10);
input : StartTime(100000),EndTime(215500);
input : 익절틱수(60),손절틱수(25);
Input : 당일수익틱수(120);
Var : MACDV(0) , MACDS(0) ;
var : Tcond(false);
Var : N1(0),dayPl(0),당일수익(0),Xcond(false);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
SetStopEndofday(0);
당일수익 = PriceScale*당일수익틱수;
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
Xcond = false;
N1 = NetProfit;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] then
{
if daypl >= 당일수익 Then
Xcond = true;
if (IsExitName("dbp",1) == true or IsExitName("dsp",1) == true) then
Xcond = true;
}
MACDV = MACD(short, long);
MACDS = ema(MACDV,signal);
var1 = ma(v,P1);
Var2 = ma(v,P2);
if Tcond == true and Xcond == False Then
{
if macdv > macds and var1 > Var2 and c > o and CrossUp(v,var1) Then
Buy();
if macdv < macds and var1 < Var2 and c < o and CrossDown(v,var1) Then
Sell();
}
if MarketPosition == 1 then{
ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts));
}
if MarketPosition == -1 then{
ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts));
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
2
input : StartTime(100000),EndTime(215500);
input : 익절틱수(60),손절틱수(25);
Input : 당일수익틱수(120);
Input:chRate(0.2); //전환율 또는 변동률
input : P(10);
Var:j(0),upTr(100),dnTr(-100),upRate(0),dnRate(0),trnd(0);
Array:hiVal[10](0),loVal[10](0),hiBar[10](0),loBar[10](0);
var : Tcond(false);
Var : N1(0),dayPl(0),당일수익(0),Xcond(false);
var : MM(0),T(0);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
SetStopEndofday(0);
당일수익 = PriceScale*당일수익틱수;
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
Xcond = false;
N1 = NetProfit;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] then
{
if daypl >= 당일수익 Then
Xcond = true;
if (IsExitName("dbp",1) == true or IsExitName("dsp",1) == true) then
Xcond = true;
}
upRate = 1 + (chRate/100); //상승률
dnRate = 1 - (chRate/100); //하락률
for j = 1 to 9 { //전고,전저점을 9개까지 보관
loBar[j] = loBar[j] + 1; //전저점의 위치. 현재 봉으로부터 떨어져 있는 거리
hiBar[j] = hiBar[j] + 1; //전고점의 위치
}
if hiVal[0] <= H or hiVal[0] == 0 then { //전고,전저점 이후 현재까지의 고점
hiVal[0] = H; //0을 체크한 이유는 초기에 값이 없는 구간이 생기기 때문
hiBar[0] = 0; //현재 고점의 위치가 0이란 것은 현재봉의 고가가 구간 고점이라는 의미
}
else {
hiBar[0] = hiBar[0] + 1; //현재 고점의 위치
}
if loVal[0] >= L or loVal[0] == 0 then { //전고,전저점 이후 현재까지 저점
loVal[0] = L;
loBar[0] = 0;
}
else {
loBar[0] = loBar[0] + 1; //현재 구간 저점의 위치
}
if trnd != dnTr && hiVal[0] > H && hiVal[0] * dnRate > L then trnd = dnTr;
//저가가 고가 대비 변동률보다 밑으로 떨어지면 하락추세로 설정
//단, 현재봉의 고가가 변곡점 이후 최고가이면 상승 추세가 진행중이라고 본다.
//그래서 현재봉의 고가가 hiVal[0]보다 작다는 조건이 추가되었다.
else if trnd != upTr && loVal[0] < L && loVal[0] * upRate < H then trnd = upTr;
//고가가 저가 대비 변동률보다 높으면 상승추세로 설정
if trnd[1] == upTr and trnd == dnTr then { //상승추세였다가 하락추세로 바뀌었다면
for j = 8 downto 1 { //새로운 전고점이 생기는 것이므로
hiVal[j+1] = hiVal[j]; //전고점을 하나씩 뒤로 보낸다.
hiBar[j+1] = hiBar[j]; //전고점은 전전고점이 되고, 전전고점은 전전전고점이 된다.
}
hiVal[1] = hiVal[0]; //새로운 전고점에 현재 고점을 대입
hiBar[1] = hiBar[0];
hiVal[0] = H; //전고점이 확정되었으므로 전고점 이후 최고가는 현재봉의 고가
hiBar[0] = 0;
loVal[0] = L;
loBar[0] = 0;
}
if trnd[1] == dnTr and trnd == dnTr and //추세는 하락 상태에서 바뀌지 않았는데
hiVal[1] < hiVal[0] and //전고점보다 더 높은 고점이 출현했다면
hiVal[0] * dnRate > L then {
hiVal[1] = hiVal[0]; //전고점을 현재의 고점으로 바꿔준다.
hiBar[1] = hiBar[0];
hiVal[0] = H;
hiBar[0] = 0;
loVal[0] = L;
loBar[0] = 0;
}
if trnd[1] == dnTr and trnd == upTr then { //추세가 하락에서 상승으로 바뀌었을 경우
for j = 8 downto 1 {
//이전저점은 전전저점으로, 전전저점은 전전전저점으로 번호를 부여
loVal[j+1] = loVal[j];
loBar[j+1] = loBar[j];
}
loVal[1] = loVal[0];
loBar[1] = loBar[0];
loVal[0] = L;
loBar[0] = 0;
hiVal[0] = H;
}
if trnd[1] == upTr and trnd == upTr and //추세는 상승을 유지하고 있는데
loVal[1] > loVal[0] and //전저점보다 낮은 저가가 출현했다면
loVal[0] * upRate < H then {
loVal[1] = loVal[0]; //직전의 전저점만 바꿔준다.
loBar[1] = loBar[0];
loVal[0] = L;
loBar[0] = 0;
hiVal[0] = H;
hiBar[0] = 0;
}
if var1 <= 0 and Trnd == uptr and Trnd != Trnd[1] Then
{
var1 = 1;
value1 = loval[1];
}
if var1 >= 0 and Trnd == dntr and Trnd != Trnd[1] then
{
var1 = -1;
}
if T == 0 and C > MM Then
T = 1;
if T == 0 and C < MM Then
T = -1;
if T == 1 and CrossDown(C,lowest(L,P)[1]) Then
T = 0;
if T == -1 and CrossUp(C,highest(H,P)[1]) Then
T = 0;
MM = (highest(H,P)+lowest(L,P))/2;
if Tcond == true and Xcond == False Then
{
if T == 1 and var1 == 1 Then
buy();
if T == -1 and var1 == -1 Then
sell();
}
if MarketPosition == 1 then{
ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts));
}
if MarketPosition == -1 then{
ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts));
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
3
input : StartTime(100000),EndTime(215500);
input : 익절틱수(60),손절틱수(25);
Input : 당일수익틱수(120),진입횟수(3);
Var : N1(0),dayPl(0),당일수익(0),Xcond(false);
var : Tcond(false),entry(0);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
SetStopEndofday(0);
당일수익 = PriceScale*당일수익틱수;
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
Xcond = false;
N1 = NetProfit;
entry = 0;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] then
{
if daypl >= 당일수익 Then
Xcond = true;
if (IsExitName("dbp",1) == true or IsExitName("dsp",1) == true) then
Xcond = true;
}
if Tcond == true and Xcond == False Then
{
if MarketPosition == 0 and C > O and entry < 진입횟수 Then
{
Buy("b");
}
if MarketPosition == 0 and C < O and entry < 진입횟수 Then
{
Sell("s");
}
}
if MarketPosition == 1 then{
ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts));
}
if MarketPosition == -1 then{
ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts));
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
즐거운 하루되세요
> 푸른 님이 쓴 글입니다.
> 제목 : 수식작성
> Input : short(12),long(26),signal(9);
input : P1(5),P2(10);
Var : MACDV(0) , MACDS(0) ;
var : Tcond(false);
MACDV = MACD(short, long);
MACDS = ema(MACDV,signal);
var1 = ma(v,P1);
Var2 = ma(v,P2);
if macdv > macds and var1 > Var2 and c > o and CrossUp(v,var1) Then
Buy();
if macdv < macds and var1 < Var2 and c < o and CrossDown(v,var1) Then
Sell();
------------------------
Input:chRate(0.2); //전환율 또는 변동률
Var:j(0),upTr(100),dnTr(-100),upRate(0),dnRate(0),trnd(0);
Array:hiVal[10](0),loVal[10](0),hiBar[10](0),loBar[10](0);
//hiVal[1]은 전고점, hiVal[2]는 전전고점, hiVal[3]은 전전전고점
//hiVal[0]은 변곡점 이후 현재봉까지의 고점. 현재 고점은 진행중이므로 계속 바뀐다.
//loVal[0]은 반대 개념
upRate = 1 + (chRate/100); //상승률
dnRate = 1 - (chRate/100); //하락률
for j = 1 to 9 { //전고,전저점을 9개까지 보관
loBar[j] = loBar[j] + 1; //전저점의 위치. 현재 봉으로부터 떨어져 있는 거리
hiBar[j] = hiBar[j] + 1; //전고점의 위치
}
if hiVal[0] <= H or hiVal[0] == 0 then { //전고,전저점 이후 현재까지의 고점
hiVal[0] = H; //0을 체크한 이유는 초기에 값이 없는 구간이 생기기 때문
hiBar[0] = 0; //현재 고점의 위치가 0이란 것은 현재봉의 고가가 구간 고점이라는 의미
}
else {
hiBar[0] = hiBar[0] + 1; //현재 고점의 위치
}
if loVal[0] >= L or loVal[0] == 0 then { //전고,전저점 이후 현재까지 저점
loVal[0] = L;
loBar[0] = 0;
}
else {
loBar[0] = loBar[0] + 1; //현재 구간 저점의 위치
}
if trnd != dnTr && hiVal[0] > H && hiVal[0] * dnRate > L then trnd = dnTr;
//저가가 고가 대비 변동률보다 밑으로 떨어지면 하락추세로 설정
//단, 현재봉의 고가가 변곡점 이후 최고가이면 상승 추세가 진행중이라고 본다.
//그래서 현재봉의 고가가 hiVal[0]보다 작다는 조건이 추가되었다.
else if trnd != upTr && loVal[0] < L && loVal[0] * upRate < H then trnd = upTr;
//고가가 저가 대비 변동률보다 높으면 상승추세로 설정
if trnd[1] == upTr and trnd == dnTr then { //상승추세였다가 하락추세로 바뀌었다면
for j = 8 downto 1 { //새로운 전고점이 생기는 것이므로
hiVal[j+1] = hiVal[j]; //전고점을 하나씩 뒤로 보낸다.
hiBar[j+1] = hiBar[j]; //전고점은 전전고점이 되고, 전전고점은 전전전고점이 된다.
}
hiVal[1] = hiVal[0]; //새로운 전고점에 현재 고점을 대입
hiBar[1] = hiBar[0];
hiVal[0] = H; //전고점이 확정되었으므로 전고점 이후 최고가는 현재봉의 고가
hiBar[0] = 0;
loVal[0] = L;
loBar[0] = 0;
}
if trnd[1] == dnTr and trnd == dnTr and //추세는 하락 상태에서 바뀌지 않았는데
hiVal[1] < hiVal[0] and //전고점보다 더 높은 고점이 출현했다면
hiVal[0] * dnRate > L then {
hiVal[1] = hiVal[0]; //전고점을 현재의 고점으로 바꿔준다.
hiBar[1] = hiBar[0];
hiVal[0] = H;
hiBar[0] = 0;
loVal[0] = L;
loBar[0] = 0;
}
if trnd[1] == dnTr and trnd == upTr then { //추세가 하락에서 상승으로 바뀌었을 경우
for j = 8 downto 1 {
//이전저점은 전전저점으로, 전전저점은 전전전저점으로 번호를 부여
loVal[j+1] = loVal[j];
loBar[j+1] = loBar[j];
}
loVal[1] = loVal[0];
loBar[1] = loBar[0];
loVal[0] = L;
loBar[0] = 0;
hiVal[0] = H;
}
if trnd[1] == upTr and trnd == upTr and //추세는 상승을 유지하고 있는데
loVal[1] > loVal[0] and //전저점보다 낮은 저가가 출현했다면
loVal[0] * upRate < H then {
loVal[1] = loVal[0]; //직전의 전저점만 바꿔준다.
loBar[1] = loBar[0];
loVal[0] = L;
loBar[0] = 0;
hiVal[0] = H;
hiBar[0] = 0;
}
if var1 <= 0 and Trnd == uptr and Trnd != Trnd[1] Then
{
var1 = 1;
value1 = loval[1];
}
if var1 >= 0 and Trnd == dntr and Trnd != Trnd[1] then
{
var1 = -1;
}
input : P(10);
var : MM(0),T(0);
MM = (highest(H,P)+lowest(L,P))/2;
if T == 0 and C > MM Then
T = 1;
if T == 0 and C < MM Then
T = -1;
if T == 1 and CrossDown(C,lowest(L,P)[1]) Then
T = 0;
if T == -1 and CrossUp(C,highest(H,P)[1]) Then
T = 0;
if T == 1 and var1 == 1 Then
buy();
if T == -1 and var1 == -1 Then
sell();
----------------------------------------------------------------
input : StartTime(220000),EndTime(055000),진입횟수(5),익절틱수(130),손절틱수(30);
var : Tcond(false),entry(0);
if StartTime < EndTime Then
{
SetStopEndofday(EndTime);
}
Else
{
if sDate != sDate[1] Then
SetStopEndofday(EndTime);
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
if StartTime > EndTime Then
SetStopEndofday(0);
Tcond = true;
entry = 0;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if Tcond == true Then
{
if MarketPosition == 0 and C > O and entry < 진입횟수 Then
{
Buy("b");
}
if MarketPosition == 0 and C < O and entry < 진입횟수 Then
{
Sell("s");
}
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
----------------------------------------------
상기 3가지 수식어에 매매시간을 각각 10시부터 당일 21시55분으로 수정을 부탁 드리고
익절 60틱, 손절 25틱 , 당일 목표수익 120틱도 포함해 주시기 바랍니다.