예스스탁
예스스탁 답변
2021-09-01 17:58:22
안녕하세요
예스스탁입니다.
5분봉에서 9시1분청산,9시2분 청산은 가능하지 않습니다.
수식에서 봉하나를 분할해 내부시간을 조건으로 사용할수 없습니다.
당일첫봉 완성시에 절반, 두번째봉 완성시에 나머지가 청산되게 작성해 드립니다.
Input : 투자금액(50000000),RSIP(14), P1(5), P2(25), P3(100), 시작일(20210901),시작시간(075000);
var : value(0),e(0),x(0),count(0),Vma(0), Tcond(false);
var : Rsiv(0),vv(0), Entry(0), mav1(0);
var1 = ma(C,p1);
var2 = ma(C,p2);
var3 = ma(C,p3);
var4 = sar(0.02,0.2);
mav1 = ma(C,30);
Rsiv = RSI(RSIP);
if NextBarSdate >= 시작일 and NextBarStime >= 시작시간 Then
Tcond = true;
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
count = count+1;
if sdate >= 시작일 and stime >= 시작시간 Then
Tcond = true;
if Tcond == true then
{
if crossup(c,var4) Then
Entry = 0;
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if MarketPosition == 0 and Entry < 1 and CrossDown(Rsiv, 30)Then
buy("b1",OnClose,DEF,Floor((투자금액*0.04)/c));
if MarketPosition == 1 and Entry < 1 and CrossUp(var1,var2) and Rsiv < 70 and C > var4 and MaxEntries == 1 Then
buy("b2",atlimit,LatestEntryPrice(0)*0.99,Floor((투자금액*0.07)/min(NextBarOpen,LatestEntryPrice(0)*0.98)));
if MarketPosition == 1 and Entry < 1 and CrossUp(var1,var2) and Rsiv < 70 and C > var4 and MaxEntries == 2 Then
buy("b3",atlimit,LatestEntryPrice(0)*0.99,Floor((투자금액*0.13)/min(NextBarOpen,LatestEntryPrice(0)*0.98)));
if MarketPosition == 1 and Entry < 1 and CrossUp(var1,var2) and Rsiv < 70 and C > var4 and MaxEntries == 3 Then
buy("b4",atlimit,LatestEntryPrice(0)*0.99,Floor((투자금액*0.26)/min(NextBarOpen,LatestEntryPrice(0)*0.99)));
if MarketPosition == 1 and Entry < 1 and CrossUp(var1,var2) and Rsiv < 70 and C > var4 and MaxEntries == 4 Then
buy("b5",atlimit,LatestEntryPrice(0)*0.99,Floor((투자금액*0.50)/min(NextBarOpen,LatestEntryPrice(0)*0.99)));
if MarketPosition == 1 and Entry < 1 and CrossUp(var1,var2) and Rsiv < 70 and C > var4 and MaxEntries == 5 Then
if MarketPosition == 1 and
highest(l,BarsSinceEntry) >= EntryPrice*1.07 Then
ExitLong("bx");
if MarketPosition == 1 and
Rsiv > 75 Then
ExitLong("br");
if MarketPosition == 1 and Rsiv > 65 and var1 > var2 and var2 > var3 and C < var4 Then
exitlong("s");
if MarketPosition == 1 and sDate > EntryDate Then
{
if sDate != sDate[1] Then
ExitLong("bx1",OnClose,DEF,"",Floor(CurrentContracts/2),1);
if sDate[1] != sDate[2] Then
ExitLong("bx2");
}
}
즐거운 하루되세요
> 바나 님이 쓴 글입니다.
> 제목 : 시간청산식 추가
> 현재 쓰고 있는 수식입니다. 현재 설정되어있는 매도식으로 매도가 안될경우, 설정일 이후에 매일 아침 9시에 절반 9시 1분에 절반 매도 하는 식을 추가하고 싶습니다.
그런데 궁금한게 있는데 현재 5분봉기준으로 시스템 설정을 하고 있는데 9시 1분으로 설정하면 9시 1분에 정확히 안팔리나요? 봉완성되는 9시5분에 팔리는 건가요..ㅠ
Input : 투자금액(50000000),RSIP(14), P1(5), P2(25), P3(100), 시작일(20210901),시작시간(075000);
var : value(0),e(0),x(0),count(0),Vma(0), Tcond(false);
var : Rsiv(0),vv(0), Entry(0), mav1(0);
var1 = ma(C,p1);
var2 = ma(C,p2);
var3 = ma(C,p3);
var4 = sar(0.02,0.2);
mav1 = ma(C,30);
Rsiv = RSI(RSIP);
if NextBarSdate >= 시작일 and NextBarStime >= 시작시간 Then
Tcond = true;
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
count = count+1;
if sdate >= 시작일 and stime >= 시작시간 Then
Tcond = true;
if Tcond == true then
{
if crossup(c,var4) Then
Entry = 0;
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if MarketPosition == 0 and Entry < 1 and CrossDown(Rsiv, 30)Then
buy("b1",OnClose,DEF,Floor((투자금액*0.04)/c));
if MarketPosition == 1 and Entry < 1 and CrossUp(var1,var2) and Rsiv < 70 and C > var4 and MaxEntries == 1 Then
buy("b2",atlimit,LatestEntryPrice(0)*0.99,Floor((투자금액*0.07)/min(NextBarOpen,LatestEntryPrice(0)*0.98)));
if MarketPosition == 1 and Entry < 1 and CrossUp(var1,var2) and Rsiv < 70 and C > var4 and MaxEntries == 2 Then
buy("b3",atlimit,LatestEntryPrice(0)*0.99,Floor((투자금액*0.13)/min(NextBarOpen,LatestEntryPrice(0)*0.98)));
if MarketPosition == 1 and Entry < 1 and CrossUp(var1,var2) and Rsiv < 70 and C > var4 and MaxEntries == 3 Then
buy("b4",atlimit,LatestEntryPrice(0)*0.99,Floor((투자금액*0.26)/min(NextBarOpen,LatestEntryPrice(0)*0.99)));
if MarketPosition == 1 and Entry < 1 and CrossUp(var1,var2) and Rsiv < 70 and C > var4 and MaxEntries == 4 Then
buy("b5",atlimit,LatestEntryPrice(0)*0.99,Floor((투자금액*0.50)/min(NextBarOpen,LatestEntryPrice(0)*0.99)));
if MarketPosition == 1 and Entry < 1 and CrossUp(var1,var2) and Rsiv < 70 and C > var4 and MaxEntries == 5 Then
if MarketPosition == 1 and
highest(l,BarsSinceEntry) >= EntryPrice*1.07 Then
ExitLong("bx");
if MarketPosition == 1 and
Rsiv > 75 Then
ExitLong("br");
if MarketPosition == 1 and Rsiv > 65 and var1 > var2 and var2 > var3 and C < var4 Then
exitlong("s");
}