커뮤니티
문의드립니다.
2018-02-22 12:03:26
170
글번호 116823
감사합니다.
1. 코딩 변환 부탁드립니다.
inputs:
MALength( 30 ),
DMILength( 14 ) ;
variables:
vDMIMinus( 0 ),
vDMIPlus( 0 ),
MA( 0 ),
DMILong( false ),
DMIShort( false ),
MALong( false ),
MAShort( false ) ;
vDMIMinus = DMIMinus( DMILength ) ;
vDMIPlus = DMIPlus( DMILength ) ;
MA = Average( Close, MALength ) ;
if CurrentBar > 1 then
begin
if vDMIPlus crosses over vDMIMinus then
begin
DMILong = true ;
DMIShort = false ;
end
else if vDMIPlus crosses under vDMIMinus then
begin
DMILong = false ;
DMIShort = true ;
end ;
if Close crosses over MA then
begin
MALong = true ;
MAShort = false ;
end
else if close crosses under MA then
begin
MALong = false ;
MAShort = true ;
end ;
if DMILong and MALong then
Buy this bar Close ;
if DMIShort and MAShort then
Sell this bar on Close ;
end ;
Indicator: DMI_MA RS
inputs:
MALength( 30 ),
DMILength( 14 ) ;
variables:
vDMIMinus( 0 ),
vDMIPlus( 0 ),
MA( 0 ),
DMILong( false ),
DMIShort( false ),
MALong( false ),
MAShort( false ),
MADiffPct( 0 ),
DMIDiff( 0 ) ;
vDMIMinus = DMIMinus( DMILength ) ;
vDMIPlus = DMIPlus( DMILength ) ;
MA = Average( Close, MALength ) ;
if CurrentBar > 1 then
begin
if vDMIPlus crosses over vDMIMinus then
begin
DMILong = true ;
DMIShort = false ;
end
else if vDMIPlus crosses under vDMIMinus then
begin
DMILong = false ;
DMIShort = true ;
end ;
if Close crosses over MA then
begin
MALong = true ;
MAShort = false ;
end
else if close crosses under MA then
begin
MALong = false ;
MAShort = true ;
end ;
if MA <> 0 then
MADiffPct = ( Close - MA ) / MA ;
DMIDiff = vDMIPlus - vDMIMinus ;
Plot1( MADiffPct, “MADiff%” ) ;
Plot2( DMIDiff, “DMIDiff” ) ;
if MALong then
begin
SetPlotBGColor( 1, Green ) ;
SetPlotColor( 1, Black ) ;
end
else
begin
SetPlotBGColor( 1, Red ) ;
SetPlotColor( 1, White ) ;
end ;
if DMILong then
begin
SetPlotBGColor( 2, Green ) ;
SetPlotColor( 2, Black ) ;
end ;
else
begin
SetPlotBGColor( 2, Red ) ;
SetPlotColor( 2, White ) ;
end ;
if DMILong and MALong then
begin
Plot3( “LongSig”, “Signal” ) ;
SetPlotBGColor( 3, Green ) ;
SetPlotColor( 3, Black ) ;
end ;
if DMIShort and MAShort then
begin
Plot3( “ExitSig” , “Signal” ) ;
SetPlotBGColor( 3, Red ) ;
SetPlotColor( 3, White ) ;
end ;
end ;
답변 1
예스스탁 예스스탁 답변
2018-02-22 16:33:46
안녕하세요
예스스탁입니다.
1.
inputs:MALength( 30 ),DMILength( 14 ) ;
variables:vDMIMinus( 0 ),vDMIPlus( 0 ),
MAv( 0 ),DMILong( false ),DMIShort( false ),MALong( false ),MAShort( false ) ;
vDMIMinus = DIMinus( DMILength ) ;
vDMIPlus = DIPlus( DMILength ) ;
MAv = ma( Close, MALength ) ;
if CurrentBar > 1 then
begin
if crossup(vDMIPlus,vDMIMinus) then
begin
DMILong = true ;
DMIShort = false ;
end
else if crossdown(vDMIPlus,vDMIMinus) then
begin
DMILong = false ;
DMIShort = true ;
end ;
if crossup(Close,MAv) then
begin
MALong = true ;
MAShort = false ;
end
else if CrossDown(close,MAv) then
begin
MALong = false ;
MAShort = true ;
end ;
if DMILong and MALong then
Buy("b1",OnClose);
if DMIShort and MAShort then
Sell("s1",OnClose);
end ;
2
inputs:MALength( 30 ),DMILength( 14 ) ;
variables:vDMIMinus( 0 ),vDMIPlus( 0 ),MAv( 0 ),DMILong( false ),DMIShort( false ),
MALong( false ),MAShort( false ),MADiffPct( 0 ),DMIDiff( 0 ) ;
vDMIMinus = DIMinus( DMILength ) ;
vDMIPlus = DIPlus( DMILength ) ;
MAv = ma( Close, MALength ) ;
if CurrentBar > 1 then
begin
if crossup(vDMIPlus,vDMIMinus) then
begin
DMILong = true ;
DMIShort = false ;
end
else if crossdown(vDMIPlus, vDMIMinus) then
begin
DMILong = false ;
DMIShort = true ;
end ;
if crossup(Close,MAv) then
begin
MALong = true ;
MAShort = false ;
end
else if crossdown(close,MAv) then
begin
MALong = false ;
MAShort = true ;
end ;
if MAv <> 0 then
MADiffPct = ( Close - MAv) / MAv;
DMIDiff = vDMIPlus - vDMIMinus ;
Plot1( MADiffPct,"MADiff%") ;
Plot2( DMIDiff,"DMIDiff") ;
end ;
즐거운 하루되세요
> 잡다백수 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 감사합니다.
1. 코딩 변환 부탁드립니다.
inputs:
MALength( 30 ),
DMILength( 14 ) ;
variables:
vDMIMinus( 0 ),
vDMIPlus( 0 ),
MA( 0 ),
DMILong( false ),
DMIShort( false ),
MALong( false ),
MAShort( false ) ;
vDMIMinus = DMIMinus( DMILength ) ;
vDMIPlus = DMIPlus( DMILength ) ;
MA = Average( Close, MALength ) ;
if CurrentBar > 1 then
begin
if vDMIPlus crosses over vDMIMinus then
begin
DMILong = true ;
DMIShort = false ;
end
else if vDMIPlus crosses under vDMIMinus then
begin
DMILong = false ;
DMIShort = true ;
end ;
if Close crosses over MA then
begin
MALong = true ;
MAShort = false ;
end
else if close crosses under MA then
begin
MALong = false ;
MAShort = true ;
end ;
if DMILong and MALong then
Buy this bar Close ;
if DMIShort and MAShort then
Sell this bar on Close ;
end ;
Indicator: DMI_MA RS
inputs:
MALength( 30 ),
DMILength( 14 ) ;
variables:
vDMIMinus( 0 ),
vDMIPlus( 0 ),
MA( 0 ),
DMILong( false ),
DMIShort( false ),
MALong( false ),
MAShort( false ),
MADiffPct( 0 ),
DMIDiff( 0 ) ;
vDMIMinus = DMIMinus( DMILength ) ;
vDMIPlus = DMIPlus( DMILength ) ;
MA = Average( Close, MALength ) ;
if CurrentBar > 1 then
begin
if vDMIPlus crosses over vDMIMinus then
begin
DMILong = true ;
DMIShort = false ;
end
else if vDMIPlus crosses under vDMIMinus then
begin
DMILong = false ;
DMIShort = true ;
end ;
if Close crosses over MA then
begin
MALong = true ;
MAShort = false ;
end
else if close crosses under MA then
begin
MALong = false ;
MAShort = true ;
end ;
if MA <> 0 then
MADiffPct = ( Close - MA ) / MA ;
DMIDiff = vDMIPlus - vDMIMinus ;
Plot1( MADiffPct, “MADiff%” ) ;
Plot2( DMIDiff, “DMIDiff” ) ;
if MALong then
begin
SetPlotBGColor( 1, Green ) ;
SetPlotColor( 1, Black ) ;
end
else
begin
SetPlotBGColor( 1, Red ) ;
SetPlotColor( 1, White ) ;
end ;
if DMILong then
begin
SetPlotBGColor( 2, Green ) ;
SetPlotColor( 2, Black ) ;
end ;
else
begin
SetPlotBGColor( 2, Red ) ;
SetPlotColor( 2, White ) ;
end ;
if DMILong and MALong then
begin
Plot3( “LongSig”, “Signal” ) ;
SetPlotBGColor( 3, Green ) ;
SetPlotColor( 3, Black ) ;
end ;
if DMIShort and MAShort then
begin
Plot3( “ExitSig” , “Signal” ) ;
SetPlotBGColor( 3, Red ) ;
SetPlotColor( 3, White ) ;
end ;
end ;