커뮤니티
문의드립니다.
2014-10-14 18:57:51
176
글번호 79401
지난 번에 알려주신 수식으로 조금 응용을 해보다 막혀서 문의드립니다 ^^
수고많으십니다.
1시간봉에서 받아온 5,20 이평선 크로스 발생싱
200틱에서 다시 5,20이평 크로스에서 매수,매도를 하려고 합니다
1시간봉 data2 셋팅 5,20이평 골드크로스 상태에서
200틱 data1 셋팅 5,20이평 골드크로스 매수 이후 데드시 청산
1시간봉 data2 셋팅 5,20이평 데드크로스 상태에서
200틱 data1 셋팅 5,20이평 데드크로스 매도이후 골드시 청산
아래와 같이 작성했는데 신호가 발생하지 않아서 문의드립니다.
Inputs: Period1(5), Period2(20),position(1);
var : Sma1(0,data2),Sma2(0,data2);
var : Sma3(0),Sma4(0);
var : Bcond(false,data1),Scond(false,data1),T(0,data1);
Sma1 = data2(ma(C,Period1));
Sma2 = data2(ma(C,Period2));
Sma3 = ma(C,Period1);
Sma4= ma(c,Period2);
#data2 매수조건 매도조건을 data1기준으로 저장
Bcond = crossUp(sma1,sma2);
Scond = crossDown(sma1,sma2);
if !(MarketPosition == 0 and MarketPosition(1) == 1 ) and Bcond == true then
{
If crossup(sma3,sma4) then
{
buy("b",def,position);
}
}
if !(MarketPosition == 0 and MarketPosition(1) == -1 ) and Scond == true then
{
if crossdown(sma3,sma4) then
{
sell("s",def,position);
}
}
감사합니다 ^^ 부탁드리겠습니다
답변 1
예스스탁 예스스탁 답변
2014-10-15 10:25:04
안녕하세요
예스스탁입니다.
기존에 작성하신 식은 동시에 발생해야 합니다.
Inputs: Period1(5), Period2(20),position(1);
var : Sma1(0,data2),Sma2(0,data2);
var : Sma3(0),Sma4(0);
var : Bcond(false,data1),Scond(false,data1),T(0,data1);
Sma1 = data2(ma(C,Period1));
Sma2 = data2(ma(C,Period2));
Sma3 = data1(ma(C,Period1));
Sma4 = data1(ma(c,Period2));
if T <= 0 and crossup(sma1,sma2) Then
T = 1;
if T >= 0 and CrossDown(sma1,sma2) Then
T = -1;
if T == 1 and crossup(sma3,sma4) Then
Bcond = true;
Else
Bcond = false;
if T == -1 and CrossDown(sma3,sma4) and Scond == false Then
Scond = true;
Else
Scond = false;
if !(MarketPosition == 0 and MarketPosition(1) == 1 ) and Bcond == true then
{
buy("b",def,position);
}
if MarketPosition == 1 and CrossDown(sma3,sma4) Then
ExitLong("bx");
if !(MarketPosition == 0 and MarketPosition(1) == -1 ) and Scond == true then
{
sell("s",def,position);
}
if MarketPosition == -1 and CrossUp(sma3,sma4) Then
ExitShort("sx");
즐거운 하루되세요
> forexar 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 지난 번에 알려주신 수식으로 조금 응용을 해보다 막혀서 문의드립니다 ^^
수고많으십니다.
1시간봉에서 받아온 5,20 이평선 크로스 발생싱
200틱에서 다시 5,20이평 크로스에서 매수,매도를 하려고 합니다
1시간봉 data2 셋팅 5,20이평 골드크로스 상태에서
200틱 data1 셋팅 5,20이평 골드크로스 매수 이후 데드시 청산
1시간봉 data2 셋팅 5,20이평 데드크로스 상태에서
200틱 data1 셋팅 5,20이평 데드크로스 매도이후 골드시 청산
아래와 같이 작성했는데 신호가 발생하지 않아서 문의드립니다.
Inputs: Period1(5), Period2(20),position(1);
var : Sma1(0,data2),Sma2(0,data2);
var : Sma3(0),Sma4(0);
var : Bcond(false,data1),Scond(false,data1),T(0,data1);
Sma1 = data2(ma(C,Period1));
Sma2 = data2(ma(C,Period2));
Sma3 = ma(C,Period1);
Sma4= ma(c,Period2);
#data2 매수조건 매도조건을 data1기준으로 저장
Bcond = crossUp(sma1,sma2);
Scond = crossDown(sma1,sma2);
if !(MarketPosition == 0 and MarketPosition(1) == 1 ) and Bcond == true then
{
If crossup(sma3,sma4) then
{
buy("b",def,position);
}
}
if !(MarketPosition == 0 and MarketPosition(1) == -1 ) and Scond == true then
{
if crossdown(sma3,sma4) then
{
sell("s",def,position);
}
}
감사합니다 ^^ 부탁드리겠습니다
다음글
이전글