The Center of gravity MT4 Expert Advisor

Post your new strategies, discoveries or just ideas for development

The Center of gravity MT4 Expert Advisor

Postby hansjlachmann » Fri Oct 09, 2009 7:42 am

EA can be downloaded here:
http://forex-strategies-revealed.com/files/MT4/CenterOfGravity_1.mq4

i will soon implement CoG 2 indicator into Script in order to run it in an Expert advisor

regards
Hans
hansjlachmann
 
Posts: 5
Joined: Mon Oct 05, 2009 4:20 am
Location: Oslo, Norway

Re: The Center of gravity MT4 Expert Advisor

Postby hansjlachmann » Fri Oct 09, 2009 7:57 am

the same indicator in a script file. Just copy the fuction void CenterOfCGravity() into any expert advisor
Attachments
CenterOfGravityScript.mq4
(3.81 KiB) Downloaded 2074 times
hansjlachmann
 
Posts: 5
Joined: Mon Oct 05, 2009 4:20 am
Location: Oslo, Norway

Re: The Center of gravity MT4 Expert Advisor

Postby hansjlachmann » Fri Oct 09, 2009 9:40 am

I have implemented the Center of Gravity 2 indicator into script
function GravityCenter2()

For testing the script generates Alert message with the 7 levels

kind regard Hans
Attachments
Alert.GIF
Alert Screenshot
GravityCenter2Script.mq4
(4.78 KiB) Downloaded 1684 times
hansjlachmann
 
Posts: 5
Joined: Mon Oct 05, 2009 4:20 am
Location: Oslo, Norway

Re: The Center of gravity MT4 Expert Advisor

Postby hansjlachmann » Fri Oct 09, 2009 10:00 am

example Expert Advisor with the COG2 indicator. This one is not profitable, its just an example
Functions CheckIndicatorForOpen (entry strategy) and CheckIndicatorForClose (exit strategy) needs to be modified

kind regards
Hans
Attachments
CenterOfGravity2.mq4
(10.99 KiB) Downloaded 1806 times
hansjlachmann
 
Posts: 5
Joined: Mon Oct 05, 2009 4:20 am
Location: Oslo, Norway

Re: The Center of gravity MT4 Expert Advisor

Postby edlogic » Sat Oct 10, 2009 10:58 am

thanks a lot Hans
i am looking at it now
maybe some time we can talk on skype
i would like that
my name on skype is the same as here
give me a call any time
User avatar
edlogic
 
Posts: 32
Joined: Wed Oct 07, 2009 8:10 am
Location: jacksonville, florida usa

Re: The Center of gravity MT4 Expert Advisor

Postby edlogic » Sun Oct 11, 2009 12:10 am

the very first thing i am going to do is change the buffer variable names to something more meaningful instead of g_ibuf_104 etc .
User avatar
edlogic
 
Posts: 32
Joined: Wed Oct 07, 2009 8:10 am
Location: jacksonville, florida usa

Re: The Center of gravity MT4 Expert Advisor

Postby edlogic » Sun Oct 11, 2009 8:25 pm

ok i have a rough draft of the code that opens trades on the cog lines above and below the middle cog line
it works according to the original rules and right now it is for 5 digit systems - will need adjustments to work for the 4 digits
i have only done a little testing so far but it seems to be opening the trades at the right time

the next problems to tackle :

stop loss needs to be made relative to the outer most cog line rather than a fixed value from the open price
right now i have a fixed lot size set of 0.10 - it needs to have your code plugged back in for optimizing again
since the spread between the cog lines can be more than 20 pips then that means that the stoploss from the inner most cog line to 10 or 20 past the outtermost cog line can be as high as 80 pips or so - that means some form of risk limitation should be set up where a maximum spread for stoploss and the number of open orders etc needs to be made -

here is my first version
CenterOfGravity2test.mq4
rough first version for getting ideas flowing
(13.47 KiB) Downloaded 1506 times
User avatar
edlogic
 
Posts: 32
Joined: Wed Oct 07, 2009 8:10 am
Location: jacksonville, florida usa

Re: The Center of gravity MT4 Expert Advisor

Postby edlogic » Mon Oct 12, 2009 4:40 pm

i thought of a different approach from the standard rules
that would be to not open orders at the time of first passing the cog line
but waiting until the price peaks out and starts reversing and then open the orders as the price passes back across the cog line in the opposite direction
i think that would reduce draw down and margin usage
i just wonder if the trend would often reverse as the price peaked - if that happened then you wouldn't have any orders placed as price moved back through the cog lines
hmmm - it is starting to seem like we might need a trend strength measurement
http://www.fxecnbroker.com
http://www.mt4tradecopier.com
User avatar
edlogic
 
Posts: 32
Joined: Wed Oct 07, 2009 8:10 am
Location: jacksonville, florida usa

Re: The Center of gravity MT4 Expert Advisor

Postby hansjlachmann » Tue Oct 13, 2009 8:18 am

i tried to implement this into my previous EA with the Cog 1, that you only enter a trade when the price reverses back through the cog line. It wasnt any success either.
I think we need to combine this strategy with some other indicator. Edlogic, I will try to call you on Skype soon...

regards Hans
hansjlachmann
 
Posts: 5
Joined: Mon Oct 05, 2009 4:20 am
Location: Oslo, Norway

Re: The Center of gravity MT4 Expert Advisor

Postby edlogic » Sat Oct 17, 2009 10:45 pm

here is the latest modification to the same rule scheme of opening orders as they first pass the COG lines .

from here i will try coding it to wait until after price goes beyond a COG line and then returns - and open the order as it comes back past the COG line in the direction of the order
i am also going to try setting the stop loss and take profit at offsets from the outer COG lines

CenterOfGravity2test11.mq4
cleaned up and consolidated code
(17.43 KiB) Downloaded 1986 times


these ea scripts work on the principle of the Gravity_Center2.mq4 indicator download that is found on this page

http://forex-strategies-revealed.com/sc ... y/cpage-12
User avatar
edlogic
 
Posts: 32
Joined: Wed Oct 07, 2009 8:10 am
Location: jacksonville, florida usa

Next

Return to Forex trading strategies and systems