안녕하세요?
아래식 2가지모두 포지션보유시 익/손절 이후 다음신호발생시 진입하게 하고싶습니다.
감사합니다.
[1]
input : 양봉(3),음봉(3);
input : 익절틱수(20),손절틱수(20);
input : 매매횟수(10);
var : entry(0);
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 MarketPosition == 0 and C == O+양봉*PriceScale and entry < 매매횟수 Then
Buy();
if MarketPosition == 0 and C == O-음봉*PriceScale and entry < 매매횟수 Then
Sell();
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
[2]
input : 양봉(3),음봉(3);
input : 익절틱수(20),손절틱수(20);
input : p1(5),p2(20),매매횟수(3);
var : entry(0);
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;
var1 = ma(c,P1);
Var2 = ma(c,P2);
if MarketPosition <= 0 and var1 > Var2 and C == O+양봉*PriceScale and entry < 매매횟수 Then
Buy();
if MarketPosition >= 0 and var1 < Var2 and C == O-음봉*PriceScale and entry < 매매횟수 Then
Sell();
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
답변 1
예스스탁
예스스탁 답변
2021-07-20 15:40:02
안녕하세요
예스스탁입니다.
1번식은 진입식에 MarketPosition == 0 조건이 있어
무포지션에만 신호가 발생하게 되어 있습니다.
2번식만 수정해 드립니다.
input : 양봉(3),음봉(3);
input : 익절틱수(20),손절틱수(20);
input : p1(5),p2(20),매매횟수(3);
var : entry(0);
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;
var1 = ma(c,P1);
Var2 = ma(c,P2);
if MarketPosition == 0 and var1 > Var2 and C == O+양봉*PriceScale and entry < 매매횟수 Then
Buy();
if MarketPosition == 0 and var1 < Var2 and C == O-음봉*PriceScale and entry < 매매횟수 Then
Sell();
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
즐거운 하루되세요
> 대구어린울프 님이 쓴 글입니다.
> 제목 : 수정 부탁드립니다.
> 안녕하세요?
아래식 2가지모두 포지션보유시 익/손절 이후 다음신호발생시 진입하게 하고싶습니다.
감사합니다.
[1]
input : 양봉(3),음봉(3);
input : 익절틱수(20),손절틱수(20);
input : 매매횟수(10);
var : entry(0);
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 MarketPosition == 0 and C == O+양봉*PriceScale and entry < 매매횟수 Then
Buy();
if MarketPosition == 0 and C == O-음봉*PriceScale and entry < 매매횟수 Then
Sell();
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
[2]
input : 양봉(3),음봉(3);
input : 익절틱수(20),손절틱수(20);
input : p1(5),p2(20),매매횟수(3);
var : entry(0);
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;
var1 = ma(c,P1);
Var2 = ma(c,P2);
if MarketPosition <= 0 and var1 > Var2 and C == O+양봉*PriceScale and entry < 매매횟수 Then
Buy();
if MarketPosition >= 0 and var1 < Var2 and C == O-음봉*PriceScale and entry < 매매횟수 Then
Sell();
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);