WL -> mql4 EA Translation ? anyone interested ?

 

Hi all mql4 guru's on the board...

I wonder if translating code from wealth lab is easy or not ?

I know it's mostly for stock but there is a public chartscript that's seem's

like doing really well

Also it's called a 17 liner -> seventeen lines of code to translate...

RankingChartScript Net Profit % APR Exposure Max DD % WL Score

1 A seventeen-liner 626.07% 42.90% 82.53% -35.68% 33.44

Top ranked scripts :

Wealth-Lab Top 25 ChartScripts by Net Profit

17 liner code :

var Bar, i, n: integer;

for Bar := FirstActualBar + 31 to BarCount - 1 do

if Lowest(Bar, ROCSeries(#Close, 1), 2) > 0 then SellAtMarket(Bar + 1, #All, '')

else if (52 * Highest(Bar, ROCSeries(#Close, 1), 3) < 15 + 12 * StdDev(Bar, ROCSeries(#Close, 1), 31))

and (3 * LinearRegSlope(Bar, ROCSeries(#Close, 1), 3) < 19)

and (Highest(Bar - 1, RSISeries(#Close, 31), 31) > 60)

and (46 * StdError(Bar, #Close, 31) > PriceClose(Bar))

and (53 * SMA(Bar, #Volume, 31) > 24 * Volume(Bar))

and (PriceOpen(Bar) > PriceLow(Bar))

and (3 * ATRP(Bar, 31) > 7) then

begin

var Priority: float = TurnUp(Bar, #Close) + TurnDown(Bar, #Close) - ROC(Bar, #Close, 4);

n := 1 + ActivePositionCount; if n > 16 then n := 1;

if n < Priority then n := trunc(Priority);

for i := 1 to n do

if BuyAtMarket(Bar + 1, FloatToStr(Priority - i)) then SetPositionPriority(LastPosition, Priority - i);

end;

Best regards

 

Extended version with comments added

Just found a more explicit version with comments :

for Bar := FirstActualBar + 31 to BarCount - 1 do

// if the lowest ROCSeries bar is above zero looking back 2 bars then sell

if Lowest(Bar, ROCSeries(#Close, 1), 2) > 0 then SellAtMarket(Bar + 1, #All, '')

//52 * Highest ROCSeries 3 bars back must be greater than 15 + 12 * 31 period StdDev ROCSeries)

else if (52 * Highest(Bar, ROCSeries(#Close, 1), 3) < 15 + 12 * StdDev(Bar, ROCSeries(#Close, 1), 31))

//dont enter if price is recovering 'too fast' (computing short-term slope of ROC)

and (3 * LinearRegSlope(Bar, ROCSeries(#Close, 1), 3) < 19)

//dont enter if last several bars were 'too weak' (looking at highest RSI value)

and (Highest(Bar - 1, RSISeries(#Close, 31), 31) > 60)

//46 * the 31 period StdError of the close Close must be greater than the PriceClose

and (46 * StdError(Bar, #Close, 31) > PriceClose(Bar))

//dont enter if today's Volume is 'too high' (compared to its SMA)

and (53 * SMA(Bar, #Volume, 31) > 24 * Volume(Bar))

//dont enter if today's candlestick is 'too bullish' (whiteline, without lower shadow)

and (PriceOpen(Bar) > PriceLow(Bar))

//dont enter if volatility is 'too low' (measured by ATRP - see note below)

and (3 * ATRP(Bar, 31) > 7) then

begin

var Priority: float;

Priority := TurnUp(Bar, #Close) + TurnDown(Bar, #Close) - ROC(Bar, #Close, 4);

n := 1 + ActivePositionCount; if n > 16 then n := 1;

if n < Priority then n := trunc(Priority);

for i := 1 to n do

if BuyAtMarket(Bar + 1, FloatToStr(Priority - i)) then SetPositionPriority(LastPosition, Priority - i);

end;

 

Some charts about this system :

Stocks : EMC, INTC, ORCL,RIMM, YHOO :

We can see how rules apply to indicators :

Files:
emc.gif  45 kb
intc.gif  39 kb
orcl.gif  39 kb
yhoo.gif  44 kb
 

I too am a wealthlab refugee

I think this is their best performing system.

Would love to see it translated !

RIP Weathlab .. you were good while you were broker independent !