커뮤니티
부탁드립니다.
2015-07-24 08:23:29
98
글번호 88851
아래 두수식에서 매도포지션이나 매수포지션을 선택해서 한쪽 방향으로만 매매하도록하려면 어떻게해야하는지 부탁드립니다.
늘 부족한 설명에도 잘 만들어 주셔서 정말 감사드립니다.
1. var : T(0),tx(0);
var1 = ma(c,1);
var2 = ma(C,900);
if var2[1]>var2[0] and
OPEN[0]>var1 and
OPEN[0]>CLOSE[0] Then
T = -1;
if var2[1]<var2[0] and
OPEN[0]<var1 and
OPEN[0]<CLOSE[0] Then
T = 1;
if MarketPosition == 0 and T == -1 and countif(T == T[1],3) == 3 Then{
sell();
Text_Delete(tx);
tx = Text_New(sdate,stime,H+PriceScale*2,"매도 : "+NumToStr(c,2));
}
if MarketPosition == 0 and T == 1 and countif(T == T[1],3) == 3 Then{
buy();
Text_Delete(tx);
tx = Text_New(sdate,stime,H+PriceScale*2,"매수 : "+NumToStr(c,2));
}
SetStopProfittarget(PriceScale*500,PointStop);
SetStopLoss(PriceScale*396,PointStop);
---------------------------------------------------------------------
2. var : T(0);
var1 = ma(c,60);
var2 = ma(C,18);
if var2[1]>var2[0] and
OPEN[0]>var1 and
OPEN[0]>CLOSE[0] Then
T = -1;
SELL();
if var2[1]<var2[0] and
OPEN[0]<var1 and
OPEN[0]<CLOSE[0] Then
T = 1;
if MarketPosition == 0 and T == -1 and countif(T == T[1],3) == 3 Then
sell();
if MarketPosition == 0 and T == 1 and countif(T == T[1],3) == 3 Then
buy();
SetStopProfittarget(PriceScale*1,PointStop);
SetStopLoss(PriceScale*30,PointStop);
답변 1
예스스탁 예스스탁 답변
2015-07-24 15:07:02
안녕하세요
예스스탁입니다.
외부변수로 매수/매도/양방향모두 거래될수 있게 처리해 드립니다.
외부변수(input) "포지션"의 값을
0으로 하시면 양방향 모두 거래
1로 하시며 매수포지션만 거래
-1로 하시면 매도포지션만 거래합니다.
1.
input : 포지션(1);
var : T(0),tx(0);
var1 = ma(c,1);
var2 = ma(C,900);
if var2[1]>var2[0] and
OPEN[0]>var1 and
OPEN[0]>CLOSE[0] Then
T = -1;
if var2[1]<var2[0] and
OPEN[0]<var1 and
OPEN[0]<CLOSE[0] Then
T = 1;
if 포지션 <= 0 and MarketPosition == 0 and T == -1 and countif(T == T[1],3) == 3 Then{
sell();
Text_Delete(tx);
tx = Text_New(sdate,stime,H+PriceScale*2,"매도 : "+NumToStr(c,2));
}
if 포지션 >= 0 and MarketPosition == 0 and T == 1 and countif(T == T[1],3) == 3 Then{
buy();
Text_Delete(tx);
tx = Text_New(sdate,stime,H+PriceScale*2,"매수 : "+NumToStr(c,2));
}
SetStopProfittarget(PriceScale*500,PointStop);
SetStopLoss(PriceScale*396,PointStop);
2.
input : 포지션(1); #매수는 1, 매도는 -1
var : T(0);
var1 = ma(c,60);
var2 = ma(C,18);
if var2[1]>var2[0] and
OPEN[0]>var1 and
OPEN[0]>CLOSE[0] Then
T = -1;
SELL();
if var2[1]<var2[0] and
OPEN[0]<var1 and
OPEN[0]<CLOSE[0] Then
T = 1;
if 포지션 <= 0 and MarketPosition == 0 and T == -1 and countif(T == T[1],3) == 3 Then
sell();
if 포지션 >= 0 and MarketPosition == 0 and T == 1 and countif(T == T[1],3) == 3 Then
buy();
SetStopProfittarget(PriceScale*1,PointStop);
SetStopLoss(PriceScale*30,PointStop);
즐거운 하루되세요
> 매일상승 님이 쓴 글입니다.
> 제목 : 부탁드립니다.
> 아래 두수식에서 매도포지션이나 매수포지션을 선택해서 한쪽 방향으로만 매매하도록하려면 어떻게해야하는지 부탁드립니다.
늘 부족한 설명에도 잘 만들어 주셔서 정말 감사드립니다.
1. var : T(0),tx(0);
var1 = ma(c,1);
var2 = ma(C,900);
if var2[1]>var2[0] and
OPEN[0]>var1 and
OPEN[0]>CLOSE[0] Then
T = -1;
if var2[1]<var2[0] and
OPEN[0]<var1 and
OPEN[0]<CLOSE[0] Then
T = 1;
if MarketPosition == 0 and T == -1 and countif(T == T[1],3) == 3 Then{
sell();
Text_Delete(tx);
tx = Text_New(sdate,stime,H+PriceScale*2,"매도 : "+NumToStr(c,2));
}
if MarketPosition == 0 and T == 1 and countif(T == T[1],3) == 3 Then{
buy();
Text_Delete(tx);
tx = Text_New(sdate,stime,H+PriceScale*2,"매수 : "+NumToStr(c,2));
}
SetStopProfittarget(PriceScale*500,PointStop);
SetStopLoss(PriceScale*396,PointStop);
---------------------------------------------------------------------
2. var : T(0);
var1 = ma(c,60);
var2 = ma(C,18);
if var2[1]>var2[0] and
OPEN[0]>var1 and
OPEN[0]>CLOSE[0] Then
T = -1;
SELL();
if var2[1]<var2[0] and
OPEN[0]<var1 and
OPEN[0]<CLOSE[0] Then
T = 1;
if MarketPosition == 0 and T == -1 and countif(T == T[1],3) == 3 Then
sell();
if MarketPosition == 0 and T == 1 and countif(T == T[1],3) == 3 Then
buy();
SetStopProfittarget(PriceScale*1,PointStop);
SetStopLoss(PriceScale*30,PointStop);