커뮤니티
수정 부탁합니다
2007-07-20 14:51:05
885
글번호 13124
안녕하세요 아래식 수정 부탁 해요 보고서 확인해 보니까 매도만 되고 매수는 안나오네요 저희가 원하는 수식 양방향 입니다 감사합니다
답변은 yang 12133 @ empal. com 으로 부탁합니다
input:전환가격(0.9);
var:j(0),꺾은선(0),기준고(0),기준저(0),방향(0),상승(100),하락(-100),구분(0),매도(-1),매수(1);
array:고[10](0),저[10](0);
if 기준고 <= c or 기준고 == 0 then 기준고 = c;
if 기준저 >= c or 기준저 == 0 then 기준저 = c;
if 기준저[1] + 전환가격 >= c[1] and 기준저[1] + 전환가격 < c then
방향 = 상승;
else if 기준고[1] - 전환가격 <= c[1] and 기준고[1] - 전환가격 > c then
방향 = 하락;
if 방향[1] == 하락 and 방향 == 상승 then
{
for j = 8 downto 0 {
저[j+1] = 저[j];
}
저[0] = 기준저;
꺾은선 = 기준저;
기준저 = c;
기준고 = c;
if 저[1] > 저[0] then 구분 = 매도;
}
if 방향[1] == 상승 and 방향 == 하락 then
{
for j = 8 downto 0 {
고[j+1] = 고[j];
}
고[0] = 기준고;
꺾은선 = 기준고;
기준고 = c;
기준저 = c;
if 고[1] < 고[0] then 구분 = 매수;
}
if 꺾은선[1] != 꺾은선 then
{
if marketposition() == 0 /* and marketposition() == 1*/ then {
if 기준저[1] <= 0 and 방향== 상승 then{
buy();
}
if 기준고[1] >= 0 then{
sell();
}
}
if marketposition(1) == -1 and marketposition() == 0 then{
if 기준고[1] > 0 then{
buy();
}
}
if marketposition(1) == 1 and marketposition() == 0 then{
if 기준저[1] < 0 then{
sell();
}
}
if marketposition() == 1 then{
if 기준고[1] <= 0 then{
exitlong();
}
}
if marketposition() == -1 then{
if 기준저[1] >= 0 then{
exitshort();
}
}
}
답변 1
예스스탁 예스스탁 답변
2007-07-23 10:46:51
> CJ_yang1130 님이 쓴 글입니다.
> 제목 : 수정 부탁합니다
>
안녕하세요 아래식 수정 부탁 해요 보고서 확인해 보니까 매도만 되고 매수는 안나오네요 저희가 원하는 수식 양방향 입니다 감사합니다
답변은 yang 12133 @ empal. com 으로 부탁합니다
input:전환가격(0.9);
var:j(0),꺾은선(0),기준고(0),기준저(0),방향(0),상승(100),하락(-100),구분(0),매도(-1),매수(1);
array:고[10](0),저[10](0);
if 기준고 <= c or 기준고 == 0 then 기준고 = c;
if 기준저 >= c or 기준저 == 0 then 기준저 = c;
if 기준저[1] + 전환가격 >= c[1] and 기준저[1] + 전환가격 < c then
방향 = 상승;
else if 기준고[1] - 전환가격 <= c[1] and 기준고[1] - 전환가격 > c then
방향 = 하락;
if 방향[1] == 하락 and 방향 == 상승 then
{
for j = 8 downto 0 {
저[j+1] = 저[j];
}
저[0] = 기준저;
꺾은선 = 기준저;
기준저 = c;
기준고 = c;
if 저[1] > 저[0] then 구분 = 매도;
}
if 방향[1] == 상승 and 방향 == 하락 then
{
for j = 8 downto 0 {
고[j+1] = 고[j];
}
고[0] = 기준고;
꺾은선 = 기준고;
기준고 = c;
기준저 = c;
if 고[1] < 고[0] then 구분 = 매수;
}
if 꺾은선[1] != 꺾은선 then
{
if marketposition() == 0 /* and marketposition() == 1*/ then {
if 기준저[1] <= 0 and 방향== 상승 then{
buy();
}
if 기준고[1] >= 0 then{
sell();
}
}
if marketposition(1) == -1 and marketposition() == 0 then{
if 기준고[1] > 0 then{
buy();
}
}
if marketposition(1) == 1 and marketposition() == 0 then{
if 기준저[1] < 0 then{
sell();
}
}
if marketposition() == 1 then{
if 기준고[1] <= 0 then{
exitlong();
}
}
if marketposition() == -1 then{
if 기준저[1] >= 0 then{
exitshort();
}
}
}