답변완료
부탁 드립니다.
항상 도움 주심에 깊이 감사 드립니다.
수식1과 수식2는 어제 질문한 수식과 답변 수식 입니다.
금일 질문 할것은
----------------------------------------
질문1)
----------------------------------------
수식1)에서 5행과 16행이 다음과 같이 바뀔때 타주기 수식 부탁 드립니다.
XMean = ma(c, Length ) ;//5행
바뀐내용)---->XMean = wma(c, Length ) ;//5행
var1=ma(estd,sig);//16행
바뀐내용)--->var1=wma(estd,sig);//16행
----------------------------------------
질문2)
----------------------------------------
수식1)에서 5행과 16행이 다음과 같이 바뀔때 타주기 수식 부탁 드립니다.
XMean = ma(c, Length ) ;//5행
바뀐내용)---->XMean = ema(c, Length ) ;//5행
var1=ma(estd,sig);//16행
바뀐내용)--->var1=ema(estd,sig);//16행
수식1) 질문수식
inputs:Length( 20 ),sig(5) ;//1행
variables://2행
XMean( 0 ), SumSqr( 0 ), Counter( 0 ), XVariance( 0 ) ;//3행
if Length > 0 then//4행
begin//5행
XMean = ma(c, Length ) ;//5행
SumSqr = 0 ;//6행
for Counter = 0 to Length - 1//7행
begin//8행
SumSqr = SumSqr + Square( Price[Counter] - XMean ) ;//9행
end ;//10행
XVariance = SumSqr / Length ;//11행
EStd = SquareRoot( XVariance ) ;//12행
end //13행
else//14행
EStd = -1 ;//15행
var1=ma(estd,sig);//16행
수식2)답변 하신 타주기 수식
input : 타주기분(30),Length(20),sig(5);
var : S1(0),D1(0),TM(0),TF(0);
var : cnt(0),SumSqr(0);
var : sum(0),XMean(0),XVariance(0),BBdn(0);
Array : CC[100](0),EStd[100](0);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%타주기분;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 타주기분 > 1 and TF < TF[1]) or
(Bdate == Bdate[1] and 타주기분 > 1 and TM >= TM[1]+타주기분) or
(Bdate == Bdate[1] and 타주기분 == 1 and TM > TM[1]) Then
{
for cnt = 1 to 99
{
CC[cnt] = CC[cnt-1][1];
ESTD[cnt] = ESTD[cnt-1][1];
}
}
CC[0] = C;
if CC[Length-1] > 0 then
{
sum = 0;
for cnt = 0 to Length-1
{
sum = sum + CC[cnt];
}
XMean = sum/Length;
SumSqr = 0;
For cnt = 0 To Length - 1
{
SumSqr = SumSqr + Square(CC[cnt] - XMean);
}
XVariance = SumSqr / Length ;
EStd[0] = SquareRoot(XVariance);
}
if CC[Length+sig-1] > 0 then
{
sum = 0;
For cnt = 0 to sig-1
{
sum = sum + ESTD[cnt];
}
var1 = sum/sig;
Plot1(var1);
}
}
2021-10-20
596
글번호 153041
지표
답변완료
청산식 수정 좀 요청 드립니다
* 항상 많은 도움에 고맙습니다.
* 아래 수식에서 진입이 안되야 하는데 두번째 진입이 되는데 수정 좀 요청 드립니다.
daypl >= PriceScale*20 이부분이 적용 안되는데 수정좀 요청 드립니다.
그리고 진입되면 매수는 red 매도는 green 청산은 블랙
동그라미좀 표시 부탁 드립니다.
##
Input : 당일수익틱수(70);
Var : N1(0),dayPl(0),당일수익(0),Xcond(false);
당일수익 = PriceScale*당일수익틱수;
if Bdate != Bdate[1] Then { Xcond = false; N1 = NetProfit; } daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] then { if daypl >= PriceScale*20 Then Xcond = true;
if (IsExitName("목표40만원달성1",1) == true or IsExitName("목표40만원달성2",1) == true) then Xcond = true; }
if Xcond == false then {
var1 = ma(c,5) ;
var2 = ma(c,15) ;
var3 = ma(c,30) ;
var4 = ma(c,50) ;
if stime >= 072000 and stime <= 140000 AND var3 > var4 and crossup(var1,var2) Then sell("DD1");
if stime >= 072000 and stime <= 140000 AND var3 < var4 and CrossDown(var1,var2) Then buy("SS1");
}
#가장 위
if MarketPosition == 1 then{ExitLong("목표40만원달성1",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts)); }
if MarketPosition == -1 then{ExitShort("목표40만원달성2",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts)); }
## 기타청산
SetStopProfittarget(PriceScale*72,PointStop);
SetStopLoss(PriceScale*70,PointStop);
if sdate != sdate[1] Then SetStopEndofday(153000);
* 매번 많은 도움에 고맙습니다.
2021-10-21
1154
글번호 153039
시스템
답변완료
74362 다시 문의 드립니다.~~~~
1, 진입조건
예를 들어
- 10시정각(변수처리) 시가에서
10틱이상 하락하지않고 10틱이상 상승시에는
저가(10시 정각 시가부터 형성된)+10틱(변수처리)에
역추세 매도진입
- 10시정각(변수처리) 틱봉 시가에서
10틱 상승하지않고 10틱이상 하락시에는
고가(10시 정각 시가부터 형성된)+10틱에(변수처리)
역추세 매수진입
2, 청산조건
-매수시
익절청산은 10틱(변수처리)
손절청산은 10틱(변수처리)이상 손실(최소손실틱)후
10틱(변수처리) 손실감소(손실감소틱)되는 지점에서
청산되는 트레일링스탑
-매도시
익절청산은 10틱(변수처리)
손절청산은 10틱(변수처리)이상 손실(최소손실틱)후
10틱(변수처리) 손실감소(손실감소틱)되는 지점에서
청산되는 트레일링스탑
3, 재진입 조건
익절 또는 손절청산되는 지점에서 역추세(스위칭) 재진입
4, 강제청산
정해진 시간(변수처리)에 보유포지션 강제청산
도와 주시면 감사 하겠습니다.
<질문> 올려 주신 수식을
시스톔 적용해보니 거래가 제대로 이루어 지지 않는데 왜 그런건가요?
1,첫진입도 의도한 지점에서 이루어 지지 않는 것 같고
2, 수식에 청산과 동시에 재진입(스위칭진입)조건은 혹시 누락되지 않았나요?
3, 트레일링 스탑도 적용이 안되는 것 같습니다.
(참고로 CME 상품에 적용해 보았습니다~~~)
항상 답변 감사합니다~``
올려주신 수식입니다.
안녕하세요
예스스탁입니다.
input : StartTime(100000),EndTime(152000);
input : ntime(100000),n(10),익절틱수(10),최소손실틱(10),손실감소틱(10);
var : Tcond(false);
var : OO(0),HH(0),LL(0);
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
{
OO = O;
HH = H;
LL = L;
}
if HH > 0 and H > HH Then
HH = H;
if LL > 0 and L < LL Then
LL = L;
if Tcond == true Then
{
if TotalTrades > TotalTrades[1] Then
{
OO = O;
HH = H;
LL = L;
}
if MarketPosition == 0 and OO > 0 and LL > OO-PriceScale*n Then
Sell("s",AtLimit,LL+PriceScale*n);
if MarketPosition == 0 and OO > 0 and HH < OO+PriceScale*n Then
Buy("b",AtLimit,HH-PriceScale*n);
if MarketPosition == 1 Then
{
if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*최소손실틱 Then
ExitLong("bx",AtLimit,Lowest(L,BarsSinceEntry)+PriceScale*손실감소틱);
}
if MarketPosition == -1 Then
{
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*최소손실틱 Then
ExitShort("sx",AtLimit,highest(H,BarsSinceEntry)-PriceScale*손실감소틱);
}
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
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
{
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
즐거운 하루되세요
2021-10-21
917
글번호 153038
시스템
답변완료
문의 드립니다.
어제 골드 데모하는 중에 손절 처리가 이상하게 되었습니다.
손절은 15틱인데 55틱 손절이 되었습니다.
거래내용과 수식 올려드리니 어느 부분에 문제가 있는지 확인 부탁드립니다.
input : StartTime(205500),EndTime(221000);
input : Length(20), D1(2);
input : 익절(20),손절(15),익절연속횟수(3),손절연속횟수(2);
var : Tcond(false),profit(0),loss(0);
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;
profit = 0;
loss = 0;
}
if TotalTrades > TotalTrades[1] Then
{
if IsExitName("bp.",1) or IsExitName("bp",1) or IsExitName("sp.",1) or IsExitName("sp",1) Then
profit = profit+1;
Else
profit = 0;
if IsExitName("bl.",1) or IsExitName("bl",1) or IsExitName("sl.",1) or IsExitName("sl",1) Then
loss = loss+1;
Else
loss = 0;
}
var1 = BollBandUp(Length,D1);
var2 = BollBandDown(Length,D1);
if Tcond == true Then
{
If CrossUP(H,var1) and c > o and profit < 익절연속횟수 and loss < 손절연속횟수 then
{
Buy("b",OnClose,DEF,1);
ExitLong("bp.",AtLimit,C+PriceScale*익절,"",1,1);
ExitLong("bl.",AtStop,C-PriceScale*손절,"",1,1);
}
If CrossDown(L,Var2) and C < O and profit < 익절연속횟수 and loss < 손절연속횟수 then
{
Sell("s",OnClose,DEF,1);
ExitShort("sp.",AtLimit,C-PriceScale*익절,"",1,1);
ExitShort("sl.",AtStop,C+PriceScale*손절,"",1,1);
}}
if MarketPosition == 1 Then
{
ExitLong("bp",AtLimit,EntryPrice+PriceScale*익절,"",1,1);
ExitLong("bl",AtStop,EntryPrice-PriceScale*손절,"",1,1);
}
if MarketPosition == -1 Then
{
ExitShort("sp",AtLimit,EntryPrice-PriceScale*익절,"",1,1);
ExitShort("sl",AtStop,EntryPrice+PriceScale*손절,"",1,1);
}
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
{
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}}
2021-10-20
803
글번호 153025
시스템