커뮤니티
함수식
2019-01-17 13:08:12
143
글번호 125361
안녕하세요 미리 감사인사올립니다
아래식에서 두가지조건을 추가하고십습니다
Input : short(12), long(26), signal(9);
Input : Period(20), LPercent(98), SPercent(106);
Var : MACDV(0) , MACDS(0),T(0),value(0);
var : Hi1(0),Hi2(0),Hc1(0),Hc2(0),Li1(0),Li2(0),Lc1(0),Lc2(0);
MACDV = MACD(short, long);
MACDS = ema(MACDV,signal);
value = Disparity(Period) ;
if crossup(MACDV,MACDS) Then
{
T = 1;
Hi1 = MACDV;
Hi2 = Hi1[1];
Hc1 = C;
Hc2 = Hc1[1];
if value >= LPercent and Li1 > Li2 and Lc1 < Lc2 and Lc2 > 0 Then
buy();
}
if CrossDown(MACDV,MACDS) Then
{
T = -1;
Li1 = MACDV;
Li2 = Li1[1];
Lc1 = C;
Lc2 = Lc1[1];
if value >= SPercent and Hi1 < Hi2 and Hc1 > Hc2 and Hc2 > 0 Then
sell();
}
if T == 1 and MACDV > Hi1 Then
{
Hi1 = MACDV;
HC1 = C;
}
if T == -1 and MACDV < Li1 Then
Li1 = MACDV;
LC1 = C;
// 조건1 (매수/매도 신호발생시 신호봉의 종가에서 +/- 20틱 위나 아래에서 진입대기)
var : S(0);
if S <= 0 and 매수진입조건 Then
{
S = 1;
var1 = C;
}
if S >= 0 and 매도진입조건 Then
{
S = -1;
var1 = C;
}
if S == 1 Then
buy("b",atlimit,var1-PriceScale*20);
if S == -1 Then
sell("s",atlimit,var1+PriceScale*20);
// 조건 2
Condition1 = MarketPosition == 0 and MarketPosition(1) == 1 and IsExitName("StopLoss",1) == true;
Condition2 = MarketPosition == 0 and MarketPosition(1) == -1 and IsExitName("StopLoss",1) == true;
if Condition1 == false and 매수진입조건 Then
buy();
if Condition2 == false and 매도진입조건 Then
sell();
틀린곳이있으면 수정도 부탁드립니다 감사합니다
답변 1
예스스탁 예스스탁 답변
2019-01-18 09:39:52
안녕하세요
예스스탁입니다.
Input : short(12), long(26), signal(9);
Input : Period(20), LPercent(98), SPercent(106);
Var : MACDV(0) , MACDS(0),T(0),value(0);
var : Hi1(0),Hi2(0),Hc1(0),Hc2(0),Li1(0),Li2(0),Lc1(0),Lc2(0);
var : S(0);
MACDV = MACD(short, long);
MACDS = ema(MACDV,signal);
value = Disparity(Period) ;
Condition1 = MarketPosition == 0 and MarketPosition(1) == 1 and IsExitName("StopLoss",1) == true;
Condition2 = MarketPosition == 0 and MarketPosition(1) == -1 and IsExitName("StopLoss",1) == true;
if crossup(MACDV,MACDS) Then
{
T = 1;
Hi1 = MACDV;
Hi2 = Hi1[1];
Hc1 = C;
Hc2 = Hc1[1];
if S <= 0 and value >= LPercent and Li1 > Li2 and Lc1 < Lc2 and Lc2 > 0 Then
{
S = 1;
var1 = C;
}
}
if CrossDown(MACDV,MACDS) Then
{
T = -1;
Li1 = MACDV;
Li2 = Li1[1];
Lc1 = C;
Lc2 = Lc1[1];
if S >= 0 and value >= SPercent and Hi1 < Hi2 and Hc1 > Hc2 and Hc2 > 0 Then
{
S = -1;
var1 = C;
}
}
if T == 1 and MACDV > Hi1 Then
{
Hi1 = MACDV;
HC1 = C;
}
if T == -1 and MACDV < Li1 Then
{
Li1 = MACDV;
LC1 = C;
}
if S == 1 and Condition1 == false Then
buy("b",atlimit,var1-PriceScale*20);
if S == -1 and Condition2 == false Then
sell("s",atlimit,var1+PriceScale*20);
즐거운 하루되세요
> 달마7 님이 쓴 글입니다.
> 제목 : 함수식
> 안녕하세요 미리 감사인사올립니다
아래식에서 두가지조건을 추가하고십습니다
Input : short(12), long(26), signal(9);
Input : Period(20), LPercent(98), SPercent(106);
Var : MACDV(0) , MACDS(0),T(0),value(0);
var : Hi1(0),Hi2(0),Hc1(0),Hc2(0),Li1(0),Li2(0),Lc1(0),Lc2(0);
MACDV = MACD(short, long);
MACDS = ema(MACDV,signal);
value = Disparity(Period) ;
if crossup(MACDV,MACDS) Then
{
T = 1;
Hi1 = MACDV;
Hi2 = Hi1[1];
Hc1 = C;
Hc2 = Hc1[1];
if value >= LPercent and Li1 > Li2 and Lc1 < Lc2 and Lc2 > 0 Then
buy();
}
if CrossDown(MACDV,MACDS) Then
{
T = -1;
Li1 = MACDV;
Li2 = Li1[1];
Lc1 = C;
Lc2 = Lc1[1];
if value >= SPercent and Hi1 < Hi2 and Hc1 > Hc2 and Hc2 > 0 Then
sell();
}
if T == 1 and MACDV > Hi1 Then
{
Hi1 = MACDV;
HC1 = C;
}
if T == -1 and MACDV < Li1 Then
Li1 = MACDV;
LC1 = C;
// 조건1 (매수/매도 신호발생시 신호봉의 종가에서 +/- 20틱 위나 아래에서 진입대기)
var : S(0);
if S <= 0 and 매수진입조건 Then
{
S = 1;
var1 = C;
}
if S >= 0 and 매도진입조건 Then
{
S = -1;
var1 = C;
}
if S == 1 Then
buy("b",atlimit,var1-PriceScale*20);
if S == -1 Then
sell("s",atlimit,var1+PriceScale*20);
// 조건 2
Condition1 = MarketPosition == 0 and MarketPosition(1) == 1 and IsExitName("StopLoss",1) == true;
Condition2 = MarketPosition == 0 and MarketPosition(1) == -1 and IsExitName("StopLoss",1) == true;
if Condition1 == false and 매수진입조건 Then
buy();
if Condition2 == false and 매도진입조건 Then
sell();
틀린곳이있으면 수정도 부탁드립니다 감사합니다
다음글
이전글