예스스탁
예스스탁 답변
2021-04-12 10:49:19
안녕하세요
예스스탁입니다.
Input : 투자금액(10000000),RSIP(14), P1(5), P2(25), P3(100), 시작일(20210407),시작시간(073000);
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 var1 > var2 and Rsiv < 60 and C > var4 Then
buy("b1",OnClose,DEF,Floor((투자금액*0.1)/min(NextBarOpen,LatestEntryPrice(0)*0.98)));
if MarketPosition == 0 and MaxEntries == 1 Then
buy("b2",atlimit,LatestEntryPrice(0)*0.98,Floor((투자금액*0.1)/min(NextBarOpen,LatestEntryPrice(0)*0.98)));
if MarketPosition == 0 and MaxEntries == 2 Then
buy("b3",atlimit,LatestEntryPrice(0)*0.98,Floor((투자금액*0.2)/min(NextBarOpen,LatestEntryPrice(0)*0.98)));
if MarketPosition == 0 and MaxEntries == 3 Then
buy("b4",atlimit,LatestEntryPrice(0)*0.98,Floor((투자금액*0.2)/min(NextBarOpen,LatestEntryPrice(0)*0.98)));
if MarketPosition == 0 and MaxEntries == 4 Then
buy("b5",atlimit,LatestEntryPrice(0)*0.98,Floor((투자금액*0.4)/min(NextBarOpen,LatestEntryPrice(0)*0.98)));
if MarketPosition == 1 and Rsiv > 55 and var1 > var2 and var2 > var3 and C < var4 Then
exitlong("s");
}
즐거운 하루되세요
> 바나 님이 쓴 글입니다.
> 제목 : 수식수정요청
> 총 투자금에서 투자금액 비율을 0.1, 0.1, 0.2, 0.2, 0.4 로 총 5번으로 하고 싶은데
지금식과 같이 범위별로 지정하지 않고
하나씩 나눠서 각각 지정하고 싶습니다.
또한 buy도 각각 나눠서 지정하고 첫번째 매수는 그대로 진행하고
이전가격보다 떨어진 가격에 사는 식
두번째 매수는 LatestEntryPrice(0)*0.98,
세번째 매수는 LatestEntryPrice(0)*0.98,
네번째 매수는 LatestEntryPrice(0)*0.99
다섯번째 매수는 LatestEntryPrice(0)*0.99 로 각각 지정하고 싶습니다.
원래대로 청산신호가 나오면 이전에 두번이나 세번 매수만 나왓어도 다시 첫번째 매수로
돌아가도록 했으면 좋겠구요.
마지막으로 매수 파라볼릭sar이 생기면 매도 파라볼릭sar이 생기기 전까지 딱 한번만 매수 되도록 하고 싶습니다. Bentry로 하는거 같아서 수식에 적용해 보긴 했는데 제대로 안되는거 같기도 하고..
Input : 투자금액(10000000),RSIP(14), P1(5), P2(25), P3(100), 시작일(20210407),시작시간(073000);
var : value(0),e(0),x(0),count(0),Vma(0), Tcond(false);
var : Rsiv(0),vv(0), BEntry(false), 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
BEntry = true;
if MarketPosition >= 0 and BEntry == true and var1 > var2 and Rsiv < 60 and C > var4 Then
{ if MarketPosition == 1 Then
Bentry = false;
if MarketPosition == 0 or (MarketPosition == 1 and MaxEntries < 3) Then
vv = Floor((투자금액*0.1)/C);
if MarketPosition == 1 and MaxEntries >= 3 and MaxEntries <= 4 Then
vv = Floor((투자금액*0.15)/C);
if MarketPosition == 1 and MaxEntries >= 5 and MaxEntries <= 6 Then
vv = Floor((투자금액*0.20)/C);
buy("b",atlimit,LatestEntryPrice(0)*0.98,VV);
}
if MarketPosition == 1 and Rsiv > 55 and var1 > var2 and var2 > var3 and C < var4 Then
exitlong("s");
}