안녕하세요?
기존수식을 바꾸고싶어서 수정해봤는데, 잘 안되서 수정부탁드립니다.
조금 바꿔보았지만, 의도하는바와 다르게 정배열에서 매도, 역배열에서 매수 그리고 양봉에매도 음봉에 매도가 일어나고있습니다.
의도하는것을 적어보겠습니다.
** 진입
정배열 일때, 음봉(외부변수)다음 양봉(입력값 이상)에 매수
역배열 일때, 양봉(외부변수)다음 음봉(입력값 이상)에 매도
각 봉은 다외부변수이고 진입하는 봉은 외부변수로 정하는것보다 이상일시에만 진입.
부탁드립니다.
감사합니다.
input : 양봉(5),진입음봉(5),음봉(5),진입양봉(5),p1(5),p2(20);
input : entrycnt(3),profit(50),loss(50);
var : entry(0);
var1 = ma(c,p1);
var2 = ma(c,p2);
if bdate != bdate[1] Then
entry = 0;
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) then
entry = entry+1;
if entry < entrycnt and var1 < Var2 and MarketPosition == 0 and C == O-음봉*PriceScale and C[1] == O[1]+진입양봉*PriceScale then
buy();
if entry < entrycnt and var1 > Var2 and MarketPosition == 0 and C == O+양봉*PriceScale and C[1] == O[1]-진입음봉*PriceScale then
sell();
SetStopProfittarget(PriceScale*profit,PointStop);
SetStopLoss(PriceScale*loss,PointStop);
답변 1
예스스탁
예스스탁 답변
2020-11-12 11:08:04
안녕하세요
예스스탁입니다.
매수와 매도에 정배열/역배열의 조건이 반대로 되어 있었습니다.
또한 매수는 음봉 다음봉이 양봉(진입봉),매도는 양봉 다음봉이 음봉(진입봉)이므로
아래와 같이 변경하셔야 합니다.
input : 양봉(5),진입음봉(5),음봉(5),진입양봉(5),p1(5),p2(20);
input : entrycnt(3),profit(50),loss(50);
var : entry(0);
var1 = ma(c,p1);
var2 = ma(c,p2);
if bdate != bdate[1] Then
entry = 0;
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) then
entry = entry+1;
if entry < entrycnt and var1 > Var2 and MarketPosition == 0 and C == O+진입양봉*PriceScale and C[1] == O[1]-음봉*PriceScale then
buy();
if entry < entrycnt and var1 < Var2 and MarketPosition == 0 and C == O-진입양봉*PriceScale and C[1] == O[1]+양봉*PriceScale then
sell();
SetStopProfittarget(PriceScale*profit,PointStop);
SetStopLoss(PriceScale*loss,PointStop);
즐거운 하루되세요
> 대구어린울프 님이 쓴 글입니다.
> 제목 : 수정 부탁드립니다.
> 안녕하세요?
기존수식을 바꾸고싶어서 수정해봤는데, 잘 안되서 수정부탁드립니다.
조금 바꿔보았지만, 의도하는바와 다르게 정배열에서 매도, 역배열에서 매수 그리고 양봉에매도 음봉에 매도가 일어나고있습니다.
의도하는것을 적어보겠습니다.
** 진입
정배열 일때, 음봉(외부변수)다음 양봉(입력값 이상)에 매수
역배열 일때, 양봉(외부변수)다음 음봉(입력값 이상)에 매도
각 봉은 다외부변수이고 진입하는 봉은 외부변수로 정하는것보다 이상일시에만 진입.
부탁드립니다.
감사합니다.
input : 양봉(5),진입음봉(5),음봉(5),진입양봉(5),p1(5),p2(20);
input : entrycnt(3),profit(50),loss(50);
var : entry(0);
var1 = ma(c,p1);
var2 = ma(c,p2);
if bdate != bdate[1] Then
entry = 0;
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) then
entry = entry+1;
if entry < entrycnt and var1 < Var2 and MarketPosition == 0 and C == O-음봉*PriceScale and C[1] == O[1]+진입양봉*PriceScale then
buy();
if entry < entrycnt and var1 > Var2 and MarketPosition == 0 and C == O+양봉*PriceScale and C[1] == O[1]-진입음봉*PriceScale then
sell();
SetStopProfittarget(PriceScale*profit,PointStop);
SetStopLoss(PriceScale*loss,PointStop);