답변완료
주말에 편하게 쉬려고 합니다. 토요일 5시부터 청산되게 하는 식을 부탁드려요
제가 주말에 편하게 하기 위한 청산 수식을 다음 수식을 적용합니다.
if DayOfWeek(sdate) == 6 and
((NextBarSdate != sdate and NextBarStime >= 060000) or
(NextBarSdate == sdate and NextBarStime >= 060000 and stime < 060000)) Then
{
ExitLong("주말매수청산");
ExitShort("주말매도청산");
}
해당 숫자"060000"6시 이후부터 봉 완료 시점에 청산되는 수식인데요...
섬머타임등을 고려해서 30분~1시간 정도 일찍 청산하려고 합니다.
그러면 060000 을 053000 으로 3개를 바꾸면 되자나요 그런데 문제가 생겼습니다.
토요일 새벽 5시 30분이후에 진입되어 버리는 경우가 있더라고요...ㅠㅠ
그래서 다음 수식을 반영할수 있을까요??
토요일 새벽 5시 30분 이후에는 진입 자체를 금지 하는 수식을 반영부탁드릴께요~~~
전체 수식을 다음과 같습니다..
# 매수 진입 조건 변수
Input : RSIPeriod(7),RSI매수값(34),SimPeriod(7),심리도값(16); # RSI와 심리도 기간 및 값 변수
Input : N1(1),초기화(1); # 위 해당 조건 발생후 진입 유효 기간, 7일경과후 초기화
Input : 하락틱수(4); # 해당 조건 발생후 하락틱수만큼 하락후 진입 변수
Input : RSIPeriod1(6),A(0),B(14),D(38),E(94); # 일봉기준 RSI값이 해당변수안에 속해있을때 진입 변수
Input : 거래량1(100),거래량평균봉수(20),거래량평균봉수비율(3.5); # Input : 거래량1(100),거래량2(7500); # 해당 거래량1,2 사이에 속해 있을때 진입되는 변수
# 청산 조건 변수
Input : CCI기간(20),CCI값(250); # CCI값에 의해 청산 수식 변수
Input : 즉시익절1(65),즉시손절1(105); # 익절값 손절값 변수
Input : N2(0.6),N3(-0.55); # 상승후 본절청산 관련 수식
Input : tr수익(50),tr하락(60); # 트레일링 관련 수식
Input : N4(0.05),본전생각틱(45); # 하락후 본절청산 관련 수식
Input : N5(0.2),CCI값1(220); # 약 손절 관련 수식
Input : 터치익절(100);
var : cnt(0),SigSum(0),count2(0),RSIsig(0);
Var : Counter(0), DownAmt(0), UpAmt(0), UpSum(0), DownSum(0), UpAvg(0), DownAvg(0);
var : idx(0), PreUpAvg(0), preDownAvg(0),RSIVv(0);
Array : C1[100](0);
var : CCIv(0),RSIv(0),Simri(0),BuySetup(false),DD(0),entry(0);
CCIv = CCI(CCI기간);
RSIV = RSI(RSIPeriod);
Simri = Simrido(SimPeriod);
if Bdate != Bdate[1] Then
{
for cnt = 1 to 99
{
C1[cnt] = C1[cnt-1][1];
}
PreUpAvg = UpAvg[1];
preDownAvg = DownAvg[1];
idx = idx + 1;
}
C1[0] = C;
If idx == RSIPeriod1+2 Then
{
UpSum = 0;
DownSum = 0;
For Counter = 0 To RSIPeriod1 - 1
{
UpAmt = C1[Counter] - C1[Counter+1];
If UpAmt >= 0 Then
DownAmt = 0;
Else
{
DownAmt = -UpAmt;
UpAmt = 0;
}
UpSum = UpSum + UpAmt;
DownSum = DownSum + DownAmt;
}
UpAvg = UpSum / RSIPeriod1;
DownAvg = DownSum / RSIPeriod1;
}
If idx > RSIPeriod1+2 Then
{
UpAmt = C1[0] - C1[1];
If UpAmt >= 0 Then
DownAmt = 0;
Else
{
DownAmt = -UpAmt;
UpAmt = 0;
}
UpAvg = (PreUpAvg * (RSIPeriod1 - 1) + UpAmt) / RSIPeriod1;
DownAvg = (preDownAvg * (RSIPeriod1 - 1) + DownAmt) / RSIPeriod1;
}
If UpAvg + DownAvg <> 0 Then
RSIvv = 100 * UpAvg / (UpAvg + DownAvg);
Else
RSIvv = 0;
if bdate != bdate[1] Then
{
Entry = 0;
Condition2 = true;
}
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
entry = entry+1;
if TotalTrades > TotalTrades[1] and
(IsExitName("즉시손절1",1) == true or IsExitName("본전청산1",1)) then
Condition2 = false;
Condition1 = RSIv < RSI매수값 and Simri < 심리도값 and ((RSIVV > A and RSIVV < B) or (RSIVV > D and RSIVV < E)) ;
if bdate != bdate[1] Then
{
DD = DD+1;
if var2 > 0 and DD == var2+초기화 Then
BuySetup = false;
}
if BuySetup == false and Condition1 == true and Condition1[1] == false Then
{
var1 = C;
var2 = DD;
BuySetup = true;
}
if Condition2 == true and MarketPosition == 0 and C < O and C[1] < O and BuySetup == true and entry == 0
and v < ma(v,거래량평균봉수)*거래량평균봉수비율 and v > 거래량1 Then # and C < O
buy("매수",AtLimit,var1-PriceScale*하락틱수);
if MarketPosition == 1 then
{
BuySetup = false;
SetStopProfittarget(PriceScale*터치익절,PointStop);
if countif(CrossDown(CCIv,CCI값),BarsSinceEntry) >= 1 and
CCIv < CCI값 and C < O Then
ExitLong("매수cci청산",OnClose);
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*즉시익절1 and C < O Then
ExitLong("즉시익절1",OnClose);
if highest(H,BarsSinceEntry) >= (EntryPrice+PriceScale*즉시익절1*N2) Then
ExitLong("본전청산1",AtStop,EntryPrice+PriceScale*즉시익절1*N3);
Else
{
ExitLong("즉시손절1",AtStop,EntryPrice-PriceScale*즉시손절1);
}
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*tr수익 Then
ExitLong("tr",AtStop, highest(H,BarsSinceEntry)-PriceScale*tr하락);
if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*즉시손절1*N4 and C < O Then
ExitLong("저점에서 올라와서 본전 청산",atlimit,EntryPrice+PriceScale*본전생각틱);
if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*즉시손절1 *N5 and CCIv >= CCI값1 and C < O Then
ExitLong("저점에서 올라와서 약손절",OnClose);
}
if DayOfWeek(sdate) == 6 and
((NextBarSdate != sdate and NextBarStime >= 060000) or
(NextBarSdate == sdate and NextBarStime >= 060000 and stime < 060000)) Then
{
ExitLong("주말매수청산");
ExitShort("주말매도청산");
}
2020-04-20
372
글번호 138131
시스템