Код:
{ Entry Rules }
begin
if wma(bar,#close,5) > wma(bar,#close,10) then
if wma(bar,#close,10) > wma(bar,#close,15) then
if adx(bar,14) > 20 then
BuyAtMarket( Bar + 1, 'Market' );
if wma(bar,#close,5) < wma(bar,#close,10) then
if wma(bar,#close,10) < wma(bar,#close,15) then
if adx(bar,14) > 20 then
ShortAtMarket( Bar + 1, '' );
end
else
{ Exit Rules }
begin
if positionlong(lastposition) then
if crossunder(bar,wmaseries(#close,5),wmaseries(#clos e,10)) then
SellAtMarket( Bar + 1, LastPosition, 'Market' );
if positionshort(lastposition) then
if crossover(bar,wmaseries(#close,5),wmaseries(#close ,10)) then
CoverAtMarket( Bar + 1, LastPosition, 'Market' );
end;
Итоги тестирования: