커뮤니티
수식 문의
2017-02-10 00:53:03
120
글번호 106686
안녕하세요
하기수식에 추가하고 싶은 사항이 있어서 문의 드립니다.
input : P(14),BBP(20),dv(2),MAP(60);
input : short(12),long(26),sig(9);
var : ADXV(0),DP(0),DM(0),T(0),BBup(0),BBdn(0),mav(0);
var : MACDV(0),MACDS(0),Bcond(false),Scond(False),bbmd(0),diff(0),cnt(0),count(0);
ADXV = ADX(P);
DP = Diplus(P);
DM = DiMinus(P);
bbmd = ma(c,BBP);
BBup = BollBandUp(BBP,dv);
BBdn = BollBandDown(BBP,dv);
mav = ma(C,MAP);
MACDV = MACD(short,long);
MACDS = ema(MACDV,sig);
diff = C-O;
Bcond = TotalTrades == 0 or (MarketPosition == 0 and BarsSinceExit(1) >= 2) or (MarketPosition == -1 and BarsSinceEntry >= 2);
Scond = TotalTrades == 0 or (MarketPosition == 0 and BarsSinceExit(1) >= 2) or (MarketPosition == 1 and BarsSinceEntry >= 2);
if CrossUp(BBdn,mav) and countif(crossdown(BBdn,mav),5) < 1 and DP < 40 and bcond == true
and (ADXV < 40 or (ADXV > 40 and DP > DM)) then
buy("b1");
if CrossDown(BBup,mav) and countif(CrossUp(BBup,mav),5) < 1 and DM <40 and scond == true
and (ADXV < 40 or (ADXV > 40 and DM > dP)) Then
sell("s1");
if MarketPosition == 0 Then{
if MarketPosition(1) == 1 and IsExitName("StopTrailing",1) == true and H > BBdn and macdv >= macds
and (ADXV < 40 or (ADXV > 40 and DP > DM))
then { buy("bb",AtStop,C-PriceScale);}
if MarketPosition(1) == -1 and IsExitName("StopTrailing",1) == true and L < BBup and macdv <= macds
and (ADXV < 40 or (ADXV > 40 and DM > dP))
then { sell("ss",AtStop,C+PriceScale);}
}
1.
매도 또는 매수 신호에 의해 진입이 되고,
진입한 봉 포함 5개 봉이 지난 다음부터는 손절이나 익절로 청산이 되지 않고,
원래 진입자리로 돌아오면 청산되는 수식을 구현해 주실 수 있으신지요?
매수면 +1틱 매도면 -1틱에서 청산되게 부탁드립니다.
5개봉이 지나고 가격은 원래자리에 없으면, 그냥 시스템 신호의 결정을 기다립니다.
자기 자리로 다시 돌아올때만 청산되게 부탁드립니다.
2.
ADX 라인이 DP/DM위로 올라서면 진입하는 수식 부탁드립니다.
DP가 DM보다 위에 있으면 매수로 진입, DM이 DP보다 위에 있으면 매도로 진입합니다.
ADX 라인이 DP/DM위에 있고, DP/DM change 가 발생해도 거기에따라 재진입 부탁드립니다.
감사합니다.
답변 1
예스스탁 예스스탁 답변
2017-02-10 15:00:27
안녕하세요
예스스탁입니다.
설정창에서 지정하 강제청산은 수식안에서 컨트롤 하지 못합니다.
1번 내용 구현하려면 수식안에서 청산함수로 손절, 익절 구현되어야 합니다.
수식 참고하시기 바랍니다.
input : P(14),BBP(20),dv(2),MAP(60);
input : short(12),long(26),sig(9);
var : ADXV(0),DP(0),DM(0),T(0),BBup(0),BBdn(0),mav(0);
var : MACDV(0),MACDS(0),Bcond(false),Scond(False),bbmd(0),diff(0),cnt(0),count(0);
ADXV = ADX(P);
DP = Diplus(P);
DM = DiMinus(P);
bbmd = ma(c,BBP);
BBup = BollBandUp(BBP,dv);
BBdn = BollBandDown(BBP,dv);
mav = ma(C,MAP);
MACDV = MACD(short,long);
MACDS = ema(MACDV,sig);
diff = C-O;
Bcond = TotalTrades == 0 or (MarketPosition == 0 and BarsSinceExit(1) >= 2) or (MarketPosition == -1 and BarsSinceEntry >= 2);
Scond = TotalTrades == 0 or (MarketPosition == 0 and BarsSinceExit(1) >= 2) or (MarketPosition == 1 and BarsSinceEntry >= 2);
if CrossUp(BBdn,mav) and countif(crossdown(BBdn,mav),5) < 1 and DP < 40 and bcond == true
and (ADXV < 40 or (ADXV > 40 and DP > DM)) then
buy("b1");
if CrossDown(BBup,mav) and countif(CrossUp(BBup,mav),5) < 1 and DM <40 and scond == true
and (ADXV < 40 or (ADXV > 40 and DM > dP)) Then
sell("s1");
if MarketPosition == 0 Then{
if MarketPosition(1) == 1 and IsExitName("StopTrailing",1) == true and H > BBdn and macdv >= macds
and (ADXV < 40 or (ADXV > 40 and DP > DM))
then { buy("bb",AtStop,C-PriceScale);}
if MarketPosition(1) == -1 and IsExitName("StopTrailing",1) == true and L < BBup and macdv <= macds
and (ADXV < 40 or (ADXV > 40 and DM > dP))
then { sell("ss",AtStop,C+PriceScale);}
}
Condition1 = adxv > dp and dp > dm;
Condition2 = adxv > dm and dm > dp;
if Condition1 == true and Condition1[1] == false Then
buy();
if Condition2 == true and Condition2[1] == false Then
sell();
if MarketPosition == 1 Then{
if BarsSinceEntry < 5 Then{
exitlong("매수손절",AtStop,EntryPrice-PriceScale*10);
exitlong("매수익절",Atlimit,EntryPrice+PriceScale*10);
}
if BarsSinceEntry >= 5 then{
ExitLong("매수본절",AtStop,EntryPrice+PriceScale*1);
}
}
if MarketPosition == -1 Then{
if BarsSinceEntry < 5 Then{
ExitShort("매도손절",AtStop,EntryPrice+PriceScale*10);
ExitShort("매도익절",Atlimit,EntryPrice-PriceScale*10);
}
if BarsSinceEntry >= 5 then{
ExitShort("매도본절",AtStop,EntryPrice-PriceScale*1);
}
}
즐거운 하루되세요
> softtoug 님이 쓴 글입니다.
> 제목 : 수식 문의
> 안녕하세요
하기수식에 추가하고 싶은 사항이 있어서 문의 드립니다.
input : P(14),BBP(20),dv(2),MAP(60);
input : short(12),long(26),sig(9);
var : ADXV(0),DP(0),DM(0),T(0),BBup(0),BBdn(0),mav(0);
var : MACDV(0),MACDS(0),Bcond(false),Scond(False),bbmd(0),diff(0),cnt(0),count(0);
ADXV = ADX(P);
DP = Diplus(P);
DM = DiMinus(P);
bbmd = ma(c,BBP);
BBup = BollBandUp(BBP,dv);
BBdn = BollBandDown(BBP,dv);
mav = ma(C,MAP);
MACDV = MACD(short,long);
MACDS = ema(MACDV,sig);
diff = C-O;
Bcond = TotalTrades == 0 or (MarketPosition == 0 and BarsSinceExit(1) >= 2) or (MarketPosition == -1 and BarsSinceEntry >= 2);
Scond = TotalTrades == 0 or (MarketPosition == 0 and BarsSinceExit(1) >= 2) or (MarketPosition == 1 and BarsSinceEntry >= 2);
if CrossUp(BBdn,mav) and countif(crossdown(BBdn,mav),5) < 1 and DP < 40 and bcond == true
and (ADXV < 40 or (ADXV > 40 and DP > DM)) then
buy("b1");
if CrossDown(BBup,mav) and countif(CrossUp(BBup,mav),5) < 1 and DM <40 and scond == true
and (ADXV < 40 or (ADXV > 40 and DM > dP)) Then
sell("s1");
if MarketPosition == 0 Then{
if MarketPosition(1) == 1 and IsExitName("StopTrailing",1) == true and H > BBdn and macdv >= macds
and (ADXV < 40 or (ADXV > 40 and DP > DM))
then { buy("bb",AtStop,C-PriceScale);}
if MarketPosition(1) == -1 and IsExitName("StopTrailing",1) == true and L < BBup and macdv <= macds
and (ADXV < 40 or (ADXV > 40 and DM > dP))
then { sell("ss",AtStop,C+PriceScale);}
}
1.
매도 또는 매수 신호에 의해 진입이 되고,
진입한 봉 포함 5개 봉이 지난 다음부터는 손절이나 익절로 청산이 되지 않고,
원래 진입자리로 돌아오면 청산되는 수식을 구현해 주실 수 있으신지요?
매수면 +1틱 매도면 -1틱에서 청산되게 부탁드립니다.
5개봉이 지나고 가격은 원래자리에 없으면, 그냥 시스템 신호의 결정을 기다립니다.
자기 자리로 다시 돌아올때만 청산되게 부탁드립니다.
2.
ADX 라인이 DP/DM위로 올라서면 진입하는 수식 부탁드립니다.
DP가 DM보다 위에 있으면 매수로 진입, DM이 DP보다 위에 있으면 매도로 진입합니다.
ADX 라인이 DP/DM위에 있고, DP/DM change 가 발생해도 거기에따라 재진입 부탁드립니다.
감사합니다.