예스스탁
예스스탁 답변
2020-03-13 14:25:46
안녕하세요
예스스탁입니다.
if Condition2 == true and MarketPosition == 0 and BuySetup == true and C < O Then
buy("매수",OnClose);
수식에 당일 진입횟수를 카운트 하는 내용은 있는데
진입식에 해당 카운트를 이용해 진입을 제한하는 내용이 없었습니다.
if Condition2 == true and MarketPosition == 0 and BuySetup == true and C < O and entry == 0 Then
buy("매수",OnClose);
entry가 0일때만 진입하게 수정해 드립니다.
Input : RSIPeriod(7),RSI매수값(32),SimPeriod(7),심리도값(16);
Input : N1(1),초기화(7);
Input : CCI기간(20),CCI값(400),CCI값1(120);
Input : 즉시익절1(340),즉시손절1(160);
Input : 분할매수횟수(1),분할매수틱수(50);
Input : RSIPeriod1(8),A(74),B(20);
Input : N2(0.6),N3(0.02);
Input : 저점손절틱수(35);
Input : 거래량1(1000),거래량2(20000);
Input : tr수익(220),tr하락(150);
Input : N4(0.6),N5(0.5);
Input : 본전생각틱(35);
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 and v > 거래량1 and v < 거래량2 ;
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 BuySetup == true and C < O and entry == 0 Then
buy("매수",OnClose);
#추가진입
if MarketPosition == 1 and MaxEntries < 분할매수횟수 Then
buy("추가매수",atlimit,LatestEntryPrice(0)-PriceScale*분할매수틱수,1);
if MarketPosition == 1 then
{
BuySetup = false;
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
{
if L <= EntryPrice-PriceScale*즉시손절1 Then
ExitLong("즉시손절1",AtStop,L-PriceScale*저점손절틱수);
}
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);
}
즐거운 하루되세요
> 이형지 님이 쓴 글입니다.
> 제목 : 수식좀 봐주실래요? 하루에 1회만 진입하는 수식으로 알고 있는데
>
수식좀 봐주실래요? 하루에 1회만 진입하는 수식으로 알고 있는데
지금 이시간에 하루에 3회까지 진입이되네요...
혹시나해서 아래 전략으로 이전 거래 사항을 보면 이렇게까지 하루에 몇번씩 진입된적이 없었
는데 혹시 어떤 원인인지 알수 있을까요??
그리고 제가 원하는 아래 수식에 1일 / 1회진입만 하는 수식 반영 부탁드릴께요~~
혹시 확인 가능할까요?
Input : RSIPeriod(7),RSI매수값(32),SimPeriod(7),심리도값(16);
Input : N1(1),초기화(7);
Input : CCI기간(20),CCI값(400),CCI값1(120);
Input : 즉시익절1(340),즉시손절1(160);
Input : 분할매수횟수(1),분할매수틱수(50);
Input : RSIPeriod1(8),A(74),B(20);
Input : N2(0.6),N3(0.02);
Input : 저점손절틱수(35);
Input : 거래량1(1000),거래량2(20000);
Input : tr수익(220),tr하락(150);
Input : N4(0.6),N5(0.5);
Input : 본전생각틱(35);
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 and v > 거래량1 and v < 거래량2 ;
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 BuySetup == true and C < O Then
buy("매수",OnClose);
#추가진입
if MarketPosition == 1 and MaxEntries < 분할매수횟수 Then
buy("추가매수",atlimit,LatestEntryPrice(0)-PriceScale*분할매수틱수,1);
if MarketPosition == 1 then
{
BuySetup = false;
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
{
if L <= EntryPrice-PriceScale*즉시손절1 Then
ExitLong("즉시손절1",AtStop,L-PriceScale*저점손절틱수);
}
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);
}