커뮤니티
오류인건지 부탁드립니다.
2019-06-26 13:40:52
275
글번호 129780
모 블로그에서 발췌한 코드인데
별표로 줄 그어놓은 사이에 If MarketPosition <> 1에서
<> 을 = = 로 바꿔야 맞는거 아닌가 문의드립니다.
Input: ADXLen(50), AvgLen(100), Length(40), Ch(8), Mult(6), Div(28);
vars: UpCh(0), DnCh(0), mp(0), stopprice(0);
vars: DeltaADX(0), DeltaAvg(0), LastOrderBar(0);
value1 = ADX(ADXLen);
DeltaADX = value1 - value1[1];
DeltaAvg = ema( DeltaADX , AvgLen );
If CrossUp(DeltaAvg , 0 ) and BarIndex > 1 then Begin
UpCh = Highest( High, Length );
DnCh = Lowest( low , Length) ;
LastOrderBar = BarIndex;
end;
MP = marketposition;
If MP <> 0 then
LastOrderBar = -999;
If index < LastOrderBar + Ch and EntriesToday(date) < 1 then Begin
Buy("B",atstop, UpCh);
Sell("S",atstop, DnCh) ;
*******************************************************************************
If MarketPosition <> 1 then
ExitLong ("lentrystop",atstop, Lowest(Low,30)) ;
If MarketPosition <> -1 then
ExitShort ("sentrystop",atstop,Highest(High,30)) ;
End;
********************************************************************************
//저가 추적청산
if MP == 1 and MP[1] <> 1 then Begin
LastOrderBar = -999;
StopPrice = low - ma(range,40)*Mult;
end;
if MP == -1 and MP[1] <> -1 then begin
StopPrice = High + ma(range,40)*Mult;
LastOrderBar = -999;
end;
If MP == 1 then begin
exitlong ("paralong",atstop,stopprice) ;
stopprice = stopprice + (low-stopprice)/Div;
end;
If MP == -1 then begin
exitshort ("parashort",atstop,stopprice) ;
stopprice = stopprice - (stopprice-high)/Div;
end;
답변 1
예스스탁 예스스탁 답변
2019-06-26 14:54:22
안녕하세요
예스스탁입니다.
예 <>는 다르다라는 표현이므로 해당 수식에서는 ==로 변경하셔야 합니다.
If MarketPosition == 1 then
ExitLong ("lentrystop",atstop, Lowest(Low,30)) ;
If MarketPosition == -1 then
ExitShort ("sentrystop",atstop,Highest(High,30)) ;
즐거운 하루되세요
> 시고르시고르 님이 쓴 글입니다.
> 제목 : 오류인건지 부탁드립니다.
> 모 블로그에서 발췌한 코드인데
별표로 줄 그어놓은 사이에 If MarketPosition <> 1에서
<> 을 = = 로 바꿔야 맞는거 아닌가 문의드립니다.
Input: ADXLen(50), AvgLen(100), Length(40), Ch(8), Mult(6), Div(28);
vars: UpCh(0), DnCh(0), mp(0), stopprice(0);
vars: DeltaADX(0), DeltaAvg(0), LastOrderBar(0);
value1 = ADX(ADXLen);
DeltaADX = value1 - value1[1];
DeltaAvg = ema( DeltaADX , AvgLen );
If CrossUp(DeltaAvg , 0 ) and BarIndex > 1 then Begin
UpCh = Highest( High, Length );
DnCh = Lowest( low , Length) ;
LastOrderBar = BarIndex;
end;
MP = marketposition;
If MP <> 0 then
LastOrderBar = -999;
If index < LastOrderBar + Ch and EntriesToday(date) < 1 then Begin
Buy("B",atstop, UpCh);
Sell("S",atstop, DnCh) ;
*******************************************************************************
If MarketPosition <> 1 then
ExitLong ("lentrystop",atstop, Lowest(Low,30)) ;
If MarketPosition <> -1 then
ExitShort ("sentrystop",atstop,Highest(High,30)) ;
End;
********************************************************************************
//저가 추적청산
if MP == 1 and MP[1] <> 1 then Begin
LastOrderBar = -999;
StopPrice = low - ma(range,40)*Mult;
end;
if MP == -1 and MP[1] <> -1 then begin
StopPrice = High + ma(range,40)*Mult;
LastOrderBar = -999;
end;
If MP == 1 then begin
exitlong ("paralong",atstop,stopprice) ;
stopprice = stopprice + (low-stopprice)/Div;
end;
If MP == -1 then begin
exitshort ("parashort",atstop,stopprice) ;
stopprice = stopprice - (stopprice-high)/Div;
end;
다음글
이전글