input : P1(10),P2(20),Period(20),배수(1),배수2(2);
var : FK1(0),FK2(0),ATRV(0),Bcond(false);
FK1 = FastK(P1);
FK2 = FastK(P2);
ATRV = ATR(Period);
Bcond = MarketPosition == 0 and MarketPosition(1) == 1 and PositionProfit(1) > 0;
if crossup(FK2,80) and bcond == false Then
buy("b");
if MarketPosition == 1 then
{
if CrossDown(FK1,20) Then
{
exitlong("bx");
}
if !CrossDown(FK1,20) and MaxEntries < 4 Then
{
buy("bb",AtStop,LatestEntryPrice(0)+ATRV,배수);
}
ExitLong("bl",AtStop,LatestEntryPrice(0)-ATRV*배수2);
}
위 식에서 한번 롱포지션을 청산하고 거래가 끝나 버리네요.
해결 부탁드립니다.
답변 1
예스스탁
예스스탁 답변
2019-11-26 10:54:48
안녕하세요
예스스탁입니다.
해당 수식은 매수진입과 청산뿐이 없는데
직전 매수거래가 손실일때만 진입하게 되어 있습니다.
한번진입후에 수익이 발생하면 이후 진입이 없습니다.
반복적으로 신호를 발생하시려면 Bcond조건이 없어야 합니다.
input : P1(10),P2(20),Period(20),배수(1),배수2(2);
var : FK1(0),FK2(0),ATRV(0);
FK1 = FastK(P1);
FK2 = FastK(P2);
ATRV = ATR(Period);
if crossup(FK2,80) Then
buy("b");
if MarketPosition == 1 then
{
if CrossDown(FK1,20) Then
{
exitlong("bx");
}
if !CrossDown(FK1,20) and MaxEntries < 4 Then
{
buy("bb",AtStop,LatestEntryPrice(0)+ATRV,배수);
}
ExitLong("bl",AtStop,LatestEntryPrice(0)-ATRV*배수2);
}
즐거운 하루되세요
> 마틸다 님이 쓴 글입니다.
> 제목 : Entry가 한번밖에 안 됩니다.
> input : P1(10),P2(20),Period(20),배수(1),배수2(2);
var : FK1(0),FK2(0),ATRV(0),Bcond(false);
FK1 = FastK(P1);
FK2 = FastK(P2);
ATRV = ATR(Period);
Bcond = MarketPosition == 0 and MarketPosition(1) == 1 and PositionProfit(1) > 0;
if crossup(FK2,80) and bcond == false Then
buy("b");
if MarketPosition == 1 then
{
if CrossDown(FK1,20) Then
{
exitlong("bx");
}
if !CrossDown(FK1,20) and MaxEntries < 4 Then
{
buy("bb",AtStop,LatestEntryPrice(0)+ATRV,배수);
}
ExitLong("bl",AtStop,LatestEntryPrice(0)-ATRV*배수2);
}
위 식에서 한번 롱포지션을 청산하고 거래가 끝나 버리네요.
해결 부탁드립니다.