커뮤니티
문의드립니다.
2018-02-26 11:56:25
242
글번호 116906
매번 감사합니다.
1. 기타
코딩 변환부탁드립니다.
inputs:
Price( MedianPrice ),
Threshold( 1.4 ),
N( 30 ) ; { N must be an even number }
variables:
HalfN( 0 ),
NMinus1( 0 ),
HalfNMinus1( 0 ),
Log2( 0 ),
Smooth( 0 ),
N3( 0 ),
HH( 0 ),
LL( 0 ),
Count( 0 ),
N1( 0 ),
N2( 0 ),
Ratio( 0 ),
Dimen( 0 ) ;
Once
begin
if Mod( N, 2 ) <> 0 or N = 0 then
RaiseRuntimeError( "The input N must be an" +
" even number." ) ;
HalfN = 0.5 * N ;
NMinus1 = N - 1 ;
HalfNMinus1 = HalfN - 1 ;
Log2 = Log( 2 ) ;
end ;
Smooth = ( Price + 2 * Price[1] + 2 * Price[2] +
Price[3] ) / 6 ;
N3 = ( Highest( Smooth, N ) - Lowest( Smooth, N ) ) /
N ;
HH = Smooth ;
LL = Smooth ;
for Count = 0 to HalfNMinus1
begin
if Smooth[Count] > HH then
HH = Smooth[Count] ;
if Smooth[Count] < LL then
LL = Smooth[Count] ;
end ;
N1 = ( HH - LL ) / HalfN ;
HH = Smooth[HalfN] ;
LL = Smooth[HalfN] ;
for Count = HalfN to NMinus1
begin
if Smooth[Count] > HH then
HH = Smooth[Count] ;
if Smooth[Count] < LL then
LL = Smooth[Count] ;
end ;
N2 = ( HH - LL ) / HalfN ;
if N1 > 0 and N2 > 0 and N3 > 0 then
Ratio = 0.5 * ( ( Log( N1 + N2 ) - Log( N3 ) ) /
Log2 + Dimen[1] ) ;
Dimen = Average( Ratio, 20 ) ;
Plot1( Dimen, "Dimen" ) ;
Plot2( 1.6, "1.6", Blue ) ;
Plot3( Threshold, "Trigger", Blue ) ;
inputs:
Price( MedianPrice ),
Threshold( 1.4 ),
N( 30 ), { N must be an even number }
TrendLength( 10 ),
StopLossPct( 5 ) ;
variables:
HalfN( 0 ),
NMinus1( 0 ),
HalfNMinus1( 0 ),
Log2( 0 ),
Smooth( 0 ),
N3( 0 ),
HH( 0 ),
LL( 0 ),
Count( 0 ),
N1( 0 ),
N2( 0 ),
Ratio( 0 ),
Dimen( 0 ) ;
Once
begin
if Mod( N, 2 ) <> 0 or N = 0 then
RaiseRuntimeError( "The input N must be an" +
" even number." ) ;
HalfN = 0.5 * N ;
NMinus1 = N - 1 ;
HalfNMinus1 = HalfN - 1 ;
Log2 = Log( 2 ) ;
end ;
Smooth = ( Price + 2 * Price[1] + 2 * Price[2] +
Price[3] ) / 6 ;
N3 = ( Highest( Smooth, N ) - Lowest( Smooth, N ) ) /
N ;
HH = Smooth ;
LL = Smooth ;
for Count = 0 to HalfNMinus1
begin
if Smooth[Count] > HH then
HH = Smooth[Count] ;
if Smooth[Count] < LL then
LL = Smooth[Count] ;
end ;
N1 = ( HH - LL ) / HalfN ;
HH = Smooth[HalfN] ;
LL = Smooth[HalfN] ;
for Count = HalfN to NMinus1
begin
if Smooth[Count] > HH then
HH = Smooth[Count] ;
if Smooth[Count] < LL then
LL = Smooth[Count] ;
end ;
N2 = ( HH - LL ) / HalfN ;
if N1 > 0 and N2 > 0 and N3 > 0 then
Ratio = 0.5 * ( ( Log( N1 + N2 ) - Log( N3 ) ) /
Log2 + Dimen[1] ) ;
Dimen = Average( Ratio, 20 ) ;
if Dimen crosses under Threshold then
begin
if Close > Average( Close, TrendLength ) then
Buy next bar market
else
Sell short next bar at market ;
end ;
SetStopShare ;
SetDollarTrailing( iff( EntryPrice > 0, EntryPrice,
Close ) * 0.01 * StopLossPct ) ;
답변 1
예스스탁 예스스탁 답변
2018-02-26 16:33:51
안녕하세요
예스스탁입니다.
수식을 예스문법에 맞춰 변경만 해드립니다.
내용판단이 안되 지표값 및 신호표시는 확인해 드릴수 없습니다.
1
inputs: Threshold( 1.4 ),N( 30 ) ;# { N must be an even number }
variables: Price(0), HalfN( 0 ), NMinus1( 0 ),HalfNMinus1( 0 ),Log2( 0 ),Smooth( 0 ),N3( 0 ),
HH( 0 ),LL( 0 ),Count( 0 ),N1( 0 ),N2( 0 ),Ratio( 0 ),Dimen( 0 ) ;
Price = MedianPrice;
if index == 0 then{
if Mod(N,2) <> 0 or N == 0 then
HalfN = 0.5 * N ;
NMinus1 = N - 1 ;
HalfNMinus1 = HalfN - 1 ;
Log2 = Log( 2 ) ;
}
Smooth = ( Price + 2 * Price[1] + 2 * Price[2] +Price[3] ) / 6 ;
N3 = ( Highest( Smooth, N ) - Lowest( Smooth, N ) ) /N ;
HH = Smooth ;
LL = Smooth ;
for Count = 0 to HalfNMinus1
begin
if Smooth[Count] > HH then
HH = Smooth[Count] ;
if Smooth[Count] < LL then
LL = Smooth[Count] ;
end ;
N1 = (HH-LL)/HalfN ;
HH = Smooth[HalfN] ;
LL = Smooth[HalfN] ;
for Count = HalfN to NMinus1
begin
if Smooth[Count] > HH then
HH = Smooth[Count] ;
if Smooth[Count] < LL then
LL = Smooth[Count] ;
end ;
N2 = ( HH - LL ) / HalfN ;
if N1 > 0 and N2 > 0 and N3 > 0 then
Ratio = 0.5 * ( ( Log( N1 + N2 ) - Log( N3 ) ) /Log2 + Dimen ) ;
Dimen = ma( Ratio, 20 ) ;
Plot1(Dimen,"Dimen" ) ;
Plot2(1.6, "1.6", Blue ) ;
Plot3(Threshold, "Trigger", Blue ) ;
2
inputs: Threshold( 1.4 ),N( 30 ), #{ N must be an even number }
TrendLength( 10 ),StopLossPct( 5 ) ;
variables: Price(0), HalfN( 0 ),NMinus1( 0 ),HalfNMinus1( 0 ),Log2( 0 ),Smooth( 0 ),N3( 0 ),
HH( 0 ),LL( 0 ),Count( 0 ),N1( 0 ),N2( 0 ),Ratio( 0 ),Dimen( 0 ) ;
Price = MedianPrice;
if index == 0 then{
if Mod( N, 2 ) <> 0 or N == 0 then
HalfN = 0.5 * N ;
NMinus1 = N - 1 ;
HalfNMinus1 = HalfN - 1 ;
Log2 = Log( 2 ) ;
}
Smooth = ( Price + 2 * Price[1] + 2 * Price[2] +
Price[3] ) / 6 ;
N3 = ( Highest( Smooth, N ) - Lowest( Smooth, N ) ) /
N ;
HH = Smooth ;
LL = Smooth ;
for Count = 0 to HalfNMinus1
begin
if Smooth[Count] > HH then
HH = Smooth[Count] ;
if Smooth[Count] < LL then
LL = Smooth[Count] ;
end ;
N1 = ( HH - LL ) / HalfN ;
HH = Smooth[HalfN] ;
LL = Smooth[HalfN] ;
for Count = HalfN to NMinus1
begin
if Smooth[Count] > HH then
HH = Smooth[Count] ;
if Smooth[Count] < LL then
LL = Smooth[Count] ;
end ;
N2 = ( HH - LL ) / HalfN ;
if N1 > 0 and N2 > 0 and N3 > 0 then
Ratio = 0.5 * ( ( Log( N1 + N2 ) - Log( N3 ) ) /
Log2 + Dimen[1] ) ;
Dimen = ma( Ratio, 20 ) ;
if CrossDown(Dimen, Threshold) then begin
if Close > ma( Close, TrendLength ) then
Buy("b",AtMarket);
else
Sell("s",AtMarket);
end ;
if MarketPosition == 1 Then
exitlong("bx",AtStop,C*0.95);
if MarketPosition == -1 Then
ExitShort("sx",AtStop,C*1.05);
즐거운 하루되세요
> 잡다백수 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 매번 감사합니다.
1. 기타
코딩 변환부탁드립니다.
inputs:
Price( MedianPrice ),
Threshold( 1.4 ),
N( 30 ) ; { N must be an even number }
variables:
HalfN( 0 ),
NMinus1( 0 ),
HalfNMinus1( 0 ),
Log2( 0 ),
Smooth( 0 ),
N3( 0 ),
HH( 0 ),
LL( 0 ),
Count( 0 ),
N1( 0 ),
N2( 0 ),
Ratio( 0 ),
Dimen( 0 ) ;
Once
begin
if Mod( N, 2 ) <> 0 or N = 0 then
RaiseRuntimeError( "The input N must be an" +
" even number." ) ;
HalfN = 0.5 * N ;
NMinus1 = N - 1 ;
HalfNMinus1 = HalfN - 1 ;
Log2 = Log( 2 ) ;
end ;
Smooth = ( Price + 2 * Price[1] + 2 * Price[2] +
Price[3] ) / 6 ;
N3 = ( Highest( Smooth, N ) - Lowest( Smooth, N ) ) /
N ;
HH = Smooth ;
LL = Smooth ;
for Count = 0 to HalfNMinus1
begin
if Smooth[Count] > HH then
HH = Smooth[Count] ;
if Smooth[Count] < LL then
LL = Smooth[Count] ;
end ;
N1 = ( HH - LL ) / HalfN ;
HH = Smooth[HalfN] ;
LL = Smooth[HalfN] ;
for Count = HalfN to NMinus1
begin
if Smooth[Count] > HH then
HH = Smooth[Count] ;
if Smooth[Count] < LL then
LL = Smooth[Count] ;
end ;
N2 = ( HH - LL ) / HalfN ;
if N1 > 0 and N2 > 0 and N3 > 0 then
Ratio = 0.5 * ( ( Log( N1 + N2 ) - Log( N3 ) ) /
Log2 + Dimen[1] ) ;
Dimen = Average( Ratio, 20 ) ;
Plot1( Dimen, "Dimen" ) ;
Plot2( 1.6, "1.6", Blue ) ;
Plot3( Threshold, "Trigger", Blue ) ;
inputs:
Price( MedianPrice ),
Threshold( 1.4 ),
N( 30 ), { N must be an even number }
TrendLength( 10 ),
StopLossPct( 5 ) ;
variables:
HalfN( 0 ),
NMinus1( 0 ),
HalfNMinus1( 0 ),
Log2( 0 ),
Smooth( 0 ),
N3( 0 ),
HH( 0 ),
LL( 0 ),
Count( 0 ),
N1( 0 ),
N2( 0 ),
Ratio( 0 ),
Dimen( 0 ) ;
Once
begin
if Mod( N, 2 ) <> 0 or N = 0 then
RaiseRuntimeError( "The input N must be an" +
" even number." ) ;
HalfN = 0.5 * N ;
NMinus1 = N - 1 ;
HalfNMinus1 = HalfN - 1 ;
Log2 = Log( 2 ) ;
end ;
Smooth = ( Price + 2 * Price[1] + 2 * Price[2] +
Price[3] ) / 6 ;
N3 = ( Highest( Smooth, N ) - Lowest( Smooth, N ) ) /
N ;
HH = Smooth ;
LL = Smooth ;
for Count = 0 to HalfNMinus1
begin
if Smooth[Count] > HH then
HH = Smooth[Count] ;
if Smooth[Count] < LL then
LL = Smooth[Count] ;
end ;
N1 = ( HH - LL ) / HalfN ;
HH = Smooth[HalfN] ;
LL = Smooth[HalfN] ;
for Count = HalfN to NMinus1
begin
if Smooth[Count] > HH then
HH = Smooth[Count] ;
if Smooth[Count] < LL then
LL = Smooth[Count] ;
end ;
N2 = ( HH - LL ) / HalfN ;
if N1 > 0 and N2 > 0 and N3 > 0 then
Ratio = 0.5 * ( ( Log( N1 + N2 ) - Log( N3 ) ) /
Log2 + Dimen[1] ) ;
Dimen = Average( Ratio, 20 ) ;
if Dimen crosses under Threshold then
begin
if Close > Average( Close, TrendLength ) then
Buy next bar market
else
Sell short next bar at market ;
end ;
SetStopShare ;
SetDollarTrailing( iff( EntryPrice > 0, EntryPrice,
Close ) * 0.01 * StopLossPct ) ;