The Greed ea

 

this is a stripped down version of my greed ea...... the name is misleading….. rather than make it all, it is trying to evalulate it all….. and evalulate it all in a truly level playing field manner….. many times fellow traders will present us with rules , take oilxpro’s recent hma rules for example….. the rules may be excellent but how do they stack up to other rules we might know of…… better, worse, equal,….. how do drawdowns, payout, number of trades and such compare…… how do we compare the results all of the hundreds of rules with a wide varity of differeing filters applied to eacgreed ea can do it.........

the reason for the reduced version is that the full version is truely huge and needs computer resources not available to us all…. what would be the point in me presenting an ea that only few could get to load….. even this reduced version will be slow on most computers….. you can of course remove lines of code of no use to you to speed things u

rather than use my money management, position size, and trailing stop codes, I’ve used the code version’s we commonly see in other ea’s on the net….. again , this is to lower the computer resource l

when we toss oilxpro’s rules into greed and run a full test we can see just how things add up and in a test that’s truly fair to all …… numbers 201 to 280 represent oilxpro’s hma rule or at least my version of them….. what I did was to take the rule s

//--------------------------------------------------------------

hma4_1 > hma4_2 &&

hma6_1 > hma6_2 &&

hma8_1 > hma8_2 &&

hma10_1 > hma10_2 &&

hma20_1 > hma20_2 &&

hma40_1 > hma40_2 &&

hma80_1 > hma80_2 &&

hma200_1 > hma200_2 &&

hma420_1 > hma420_2 &&

long

//-------------------------------------------------------------

and reduce them 1 line at a time which turned that 1 rule into 9 …..

so now as an example, we run an optimized test where buy ranges from 1 to 280….. run that on the eurusd for the entire 2007 , long trades only….. the test should reveal many of oilxpro’s hma rules at the top of the profit list….. which to me implies further study of those rules should be considered….. below is my backtest repor

of course we can just run a backtest on a single number and vary the stoploss, profit and such…. but if you try to run a full test on all numbers and vary profit, stop, trailing stop and such, be prepared to have a good machine or plenty of time….

the periods and/or levels for the indicators for the chart under test are set in the chart settings section….. the settings for the day filters are set under the day filter settings…… and the week settings are under week filter setti

i’ve removed two thirds of the rules and filters but enough is left to give you a feel of what’s going on ….

 

i’ve remove 2/3 of the buy/sell rules and filters to make it useable but the ea can be rewritten to include improved filter rules…. and hopefully fellow traders will suggest some additional filters for us all…

this version contains many of the commonly seen buy/sell rules….. you can see the pure rule is 1, 11, 21 31 and so on…. then the following numbers such as 2 thru 10 contain the pure rule with a corresponding filter…. the periods of the filter and any level it might use are adjustabl

keep in mind, the filters are as important as the rules...... remember the overall purpose here is to evaluate….. so if we run a full test and notice numbers ending in 2 are often the best , we might conclude using the dayrsi is a good filter…. the dayrsi is always used in a rule ending in a

or if we see a lot of numbers ending in 5, we might conclude the daymacd is a good filter….. the daymacd filter is always used the rules ending in 5….. look closely at the mq4 code and you’ll see the patt

here is the first set 1 thru 10 so you can see the outline…..

if(buy == 1 && validtime ) buy at preset time

if(buy == 2 && validtime && dayrsibuy) with dayrsi above preset level

if(buy == 3 && validtime && dayadxbuy) with day +adx above -adx

if(buy == 4 && validtime && weekstochbuy) with day stoch above it’s signal

if(buy == 5 && validtime && daymacdbuy) with daymacd above its signal

if(buy == 6 && validtime && daysatlbuy) with day close above satl

if(buy == 7 && validtime && weekrsibuy) with week rsi above preset level

if(buy == 8 && validtime && weekmacdbuy) with macd above its signal

if(buy == 9 && validtime && weekrvibuy) with week rvi above its signal

if(buy == 10 && validtime && weekccibuy) with week cci above preset level

and here are the following pure rules ….. each will have the exact filter as above in the same order as above…. Look at the mq4 code if it’s not cle

if(buy == 11 && buyhigh ) buy when close is higher than prior high

if(buy == 21 && buyhighclose ) buy when close higher than prior high and above moving average

if(buy == 31 && stochcrossbuy ) buy when stoch crosses above its signal

if(buy == 41 && stochcrosslevelbuy ) buy when stoch closes above a preset level

if(buy == 51 && adxcrossbuy ) buy when adxplus crosses above adxminus

if(buy == 61 && rsicrossbuy ) buy when rsi closes above preset level

if(buy == 71 && rvicrossbuy ) buy when rvi crosses above its signal

if(buy == 81 && willrcrossbuy ) buy when fast willrma crosses above slow willma

if(buy == 91 && macrossbuy ) buy when fast ma crosses above slow ma

if(buy == 101 && macdcrossbuy ) buy when macd crosses abve it’s signal line and macd is below 0

look at the mq4 code to see what I did to oilxpro’s hma rules….

all in all it might seem confusing at first but if you print out the buy rules you'll quickly see the pattern......h

 

hey oilxpro.... 15 is

if(buy == 15 && buyhigh && daymacdbuy) {EnterLong = True;}

which only uses the standard daily macd(12,26,9) as a filter.... it buys when the close is higher than the prior high on the timeframe being tested but only when the macd is above its signal line on the daily timeframe....

all settings used throughtout are pretty much the standard ones.... rsi(5), adx(14), macd(12,26,9), rvi(10), cci(14) and so on..... they are adjustable but preset at common settings...

one minute time frames if used for quick scalping type trades seem to benifit from aditional filters..... unfortunately that was much of the code i stripped out.... depending on your profittarget, additional 30 minute and hour filters can help.....

another thing i took out that now wish i hadn't was a master moving average condition.... that 1 condition over rode all others .....

i'll write something up for 1 minute timeframes so we can test..... do you find 1 minute time frames work best.....h

 

let me better explain the test result in post 1....

in that test there was only one variable being optomised, so to speak.... it was the buy rule.... and really we were not optomising, we were just testing all rules in one single test....

those rules were numbered 1 to 280.... the first column in the test is labeled "pass".... ordinarily we would not focus on that column..... but here the pass correlates to a precise rule....

so pass 1 is rule 1, pass 2 is rule 2 and so on.... and there is a pattern to the filters used also..... once you get a grasp on it , it's a simple matter to know exactly what pass 11 is ....

if you look at the result you'll see pass 272 placed first in the table.... and pass 272 is of course rule 272 which is

if(buy == 272 && dayrsibuy && hma4 > hma41) {EnterLong = true;}

......

so we can at a glance see which rule worked best and also which filter worked best......h

 

Wow... great work Hayseed.... Keep it up!

 

Impressive coding. I can't imagine what the original looks like.

 

I dont have williamseav.ex4

EA can't work・・・

 

hey tw...... sorry, meant to take that out..... williamseav is just the williams % with some ma's ..... it's called in the manner you see via the icustom function..... below are some of those indicators....

the full version of greed has dozens of icustoms most of which are used to determine the lot size, that is much of the code i stripped out..... most ea's commonly seen will adjust the lot size by a user settable risk precentage ..... even though i disagree with that thinkin i included it due to it is what most people are familar with.....

it's often far better to vary the lot size by first evaluating the "chance of success" and then adjust the lot size accordingly.....

also keep in mind the true purpose of the greed ea..... it is not like any other ea found on the web and it's true purpose is equally as different ..... as example, on another forum just recently someone presented some trading rules, pip nailer...... in a few minutes i pounded out an ea and companion indicator for it..... and both have been downloaded heavily..... and many backtests have probably been run.....

however, to truely weigh a set of trading rules worth, pip nailer in this case, we need to run it side by side on the exact same data , using same balance and such with other known systems.... then we can quickly see the pipnailers prefomance as compared to the other systems we are more familar with..... h

Reason: