För att använda chatten måste du logga in.

Interested Coders Please Take a Look

Jan 21, 2011 at 02:06
1,220 Visa
6 Replies
madmatz
forex_trader_5077
Medlem sedan Dec 30, 2009   23 inlägg
Jan 21, 2011 at 02:06

I have been wanting to add automated trading to my arsenal for some time now. I've been meaning to learn to code but, I just don't have the time right now and I'd like to start putting my EA concepts into action. Besides someone with experience would generate cleaner code than I would probably come up with. Below is my summary and attempt at a logic description to describe this EA. If you are interested please let me know by response here or PM, whichever you feel is appropriate. All in all I would like to develop about 20 EAs to be managed as a portfolio rather than trying to create one 'holy grail' system. Diversify among strategies, spread risk, and optimize the aggregate performance of the portfolio is my philosophy to successful automated trading.

This expert advisor should be designed to set entry points in the market based on a cross of two moving averages and manage positions. It has the ability to determine appropriate position size, place pending orders (or market orders), stop loss orders, take profit orders, move stops to break even, manage trailing stops and SAR (stop and reverse). It bases calculations on completed bars only (i.e. not current bar). It works on any type account (Standard, Mini, Micro) and any style broker (e.g. fractional pip / extra digit). It contains setting to dictate trade times (i.e. from 9:00 to 12:00 as user defined)

Entry IF:
MA1 cross above MA2 THEN place Pending Buy Order 'X' pips above signal candle high
MA1 cross below MA2 THEN place Pending Sell Order 'X' pips below signal candle low

Exit IF:
Take Profit Levels are hit
OR
Stop Loss is Hit
OR
IF Market order and opposite signal is received THEN set SAR (Stop And Reverse) Pending Order based on entry rules
OR
IF previous order is still Pending THEN remove that order and place new Pending Order based on new signal
OR
IF outside trading times remove all pending orders. Any open market orders should be managed according to rules until stop loss, take profit, or opposite entry is signaled to liquidate the position.

STOP Placement
Should be user definable variable
OR
ATR variable with multiplier capability (e.g. 7 period ATR gives value of 30 pips *multiplier of 2, would place stop 60 pips from entry)

Target Placement
Should be user definable variable (up to three separate target levels T1 T2 T3)
OR
ATR value based on same ATR used for Stop Loss with option of using different multiplier (or divider) (e.g. using above example ATR value = 30 /divider of 2, would place T1 @15 pips)
(T2 & T3 in ATR scenario are multiples of previous target at *1.62 e.g. T1=15; T2=24.3; T3=39.4)

Position Sizing
User defined lot setting
OR
Money Management Rules as follows (with user defined variable for Risk%) Position Size = (Account Equity) * (Risk%) / (Stop Distance) / (Pip Value)

Stop Management
- Should be able to move stop to Break even +/- buffer variable when user defined pip variable is reached
- Should be able to trail stop at user defined pip value with option to 'Step' (e.g. If step selected, stop is only moved every 'X' pips in profit)

Target Management / Position Scaling
Based on user settings, position should be liquidated evenly at each target (e.g. IF 3 Targets are defined THEN position should be liquidated in thirds at each level, IF 2 Targets position is halved, etc.)

Additional Variables
- Magic Number (user defined) capable OR Pair specific option
- Use Market Order instead of Pending option
- Signals Only - Disables Trading and only sends alerts at appropriate price levels
- Screen Shot option that takes screenshot on Entry/Exit and saves it to folder
- ECN Broker option in case broker requires stops and targets to be set after order is placed (I don't think it's a problem with pending orders, only market)
- Trade Times option to select when EA should monitor the market and place trades
- Minimum lot option if money management is used (e.g. if risk exceeds tolerance this would override to place minimum lot trade)
- Round Up (or Down) option should allow user to have money management round fractions up (or down) to nearest lot
- Moving average variables for MA1 & MA2 to include: Period, Shift, Method & Price
- Moving Average Buffer to allow user to select pip value to place orders above high for longs (or below low for shorts) of signal bar

Notes
The EA should only set/open positions once per signal (e.g. IF price triggers entry, retraces and bounces back to same entry signal it should not place additional trades) This is to prevent multiple entries being triggered by the same entry signal during price fluctuations

END Logic Description
Medlem sedan Dec 09, 2010   217 inlägg
Jan 22, 2011 at 02:34 (redigerad Jan 22, 2011 at 02:43)
that is a pretty nice text based flowchart.

whoever does that coding for you is going to probably have some fun.

too bad i dont know the first thing about writing software codes.

i do know how to format a floppy, tho, but i will usually require assistance for something like that and i even unplugged my monitor and took it outside and hosed it off and then replugged it up all by myself and i didnt even hurt myself or fall down in the process. isnt that amazing?

anyways, so, twenty systems?

all on the same computer/account?

it could be done.

metatrader has a comment field that can be used to store a unique identifier string.

said identifier string can actually be used to store multiple variables, sortof like url's get encoded.

except i would separate these with commas instead of ampersands like url's do.

x=1,y=2,z=3

that sort of thing.

like this:

BS LOTS SYMBOL ENTRY CURRENT COMMENT
----------------------------------------------------------
buy 0.04 eurusd 1.3610 1.3619 systerm1
sell 0.25 gbpusd 1.5900 1.5997 gbpsys

if you were to do something like this, you could play multiple systems on one account, but this might complicate your money management issues, i dont know for sure.

either way, i think that you should consider the possibility of having a single EA control all of your strategies.

it is also possible to have one metatrader box act as a controller hub for as many other metatrader boxes as you want.

reporting would all be in one central place.

the hub knows what all of the boxes are doing.

the hub controls all of the other boxes.

anyways, think ahead and make plans regarding how you are going to monitor all of these twenty bots.

i dont think that you want to manually scan twenty boxes.

reporting should be centralized and you should be able to monitor each box and a total of all boxes on your cell phone's web browser.

said systems could also be controllable from your cell phone.

ie, you should be able to modify certain operating parameters from your cell phone.

of course, tho, that is probably overkill.

ok, i will shut up now and let the real coders in the crowd come and blow a bunch of buzzwords up your skirt.

in my trading project, i ended up homeless while working on this stuff and it just so happens that i have slept on almost every sidewalk in the vdeo below.

no worries. i am tuff as nails.

zero/.



Medlem sedan Dec 09, 2010   217 inlägg
Jan 22, 2011 at 02:44
i should clarify that i am not available for outside work..

i do hope that you have fun on your project.

good evening.

zero/.
Medlem sedan Dec 09, 2010   217 inlägg
Jan 22, 2011 at 03:37 (redigerad Jan 22, 2011 at 03:42)
said comment field could also be used to store a unique number, sortof like a cartID, which could be used to link to multiple multiple pieces of information that are perhaps stored in a mysql database, perhaps.

it could get quite detailed.

wouldnt it be fun to design a trading system where a linux box links to a windows/metatrader hub that then links into many metatrader systems.

the linux box would control it all.

all account information for all open accounts would always be right there in your mysql database.

and, it is fairly easy to make a web page that would provide a view of said database.

<img src=''>

note that the mt4 boxes could easily be on different brokers, but each would have to be funded.

i personally like the idea of linking the linux based controller to the mt4 hub using a single null modem serial cable.

and then out of the mt4 hub comes a single null modem cable that will plug into a serial splitter.

i would actually prefer to build my own serial splitter, this way i get to maintain control over everything.

<img src=''>

but who has time for all of that? nobody, thats who.

having multiple brokers accessible to a single EA opens up several possibilities.

ask your friendly neighborhood programmer for full details.

oh yes, the controller box, could also be setup to run dos.

but who wants to do that? it would only simpliify things and make it very stable.

do you know what people really want?

they want short and sweet answers.

they want to hear what they want to hear.

they want to sit on their phat azzez and take the easy way out.

see ya.

omg. where am i? i am lost. has anybody seen my puppy?

zero/.
Medlem sedan Dec 08, 2010   36 inlägg
Jan 23, 2011 at 11:02
Could you clarify this exit rule :

IF Market order and opposite signal is received THEN set SAR (Stop And Reverse) Pending Order based on entry rules.

The rest looks straightforward.
madmatz
forex_trader_5077
Medlem sedan Dec 30, 2009   23 inlägg
Jan 31, 2011 at 02:47

finstudio posted:
    Could you clarify this exit rule :

IF Market order and opposite signal is received THEN set SAR (Stop And Reverse) Pending Order based on entry rules.

The rest looks straightforward.

Clarification:

IF there is a trade in the market and an opposite signal occurs, THEN at the time the entry rules are fulfilled the market order would be closed, and new position would be filled at market in the direction.

ex: Currently long E/U 2 lots... Receive a short entry signal... SELL STOP placed for 4 lots based on the entry rules (X pips below signal candle low)... So the example is working with pending orders

I hope my explanation was clear.

Sorry for the delayed response by the way... had a whole bunch of work dump on me at once.
madmatz
forex_trader_5077
Medlem sedan Dec 30, 2009   23 inlägg
Jan 31, 2011 at 03:16 (redigerad Jan 31, 2011 at 03:20)
dodgesparks posted:
    that is a pretty nice text based flowchart.

whoever does that coding for you is going to probably have some fun.


Yeah, I know that the hardest part for most programming work is the communication, so I tried to make it as clear as I could.

dodgesparks posted:
anyways, so, twenty systems?

Yeah, twenty systems. Going for economy of scale... possibly more.


dodgesparks posted:
all on the same computer/account?

Well, if any system trades the same pair it would have to be on a separate account due to the CFTC anti-hedge BS. Otherwise any opposite orders will cause problems with performance of any independent system.

dodgesparks posted:
metatrader has a comment field that can be used to store a unique identifier string.

My approach is to use the unique identifier to segregate performance statistics. Since each system will be unique I will apply money management to each specific system, rather than the sum of all performance. This will keep each system's integrity so that I can accurately identify any performance issues within an individual system.

dodgesparks posted:
either way, i think that you should consider the possibility of having a single EA control all of your strategies.


They will also be categorized into groups.. e.g. Trend / Range / Counter Trend / scalp (where scalp includes any system that takes profit within a larger move. Not necessarily 1-2 pips). Within each group could be diverse time frames.

EX:

----- Trend -------
SysA (5 minute)
SysB (4 hour)
SysC (day)

----Counter Trend -----

SysD (15 min)
SysE (1 hour)
SysF (day)

etc. etc.

I will manage the groups based on performance as measured in expectancy. Basically every 100 trades with a quarterly check as well for longer term systems that may not generate 100 trades per quarter.

So this is by no means a set it and forget it. I'm just leveraging technology to do the busy work, and then managing performance. Also, I would be checking the markets to identify ranging market, trending, etc. and turn off systems that trade in opposite conditions. e.g The market broke out of a range and is in a trend. Then range systems would go off... Off is not likely how I would handle this specific situation, though. Instead I would simple turn of short entries during the bull trend until the market changed.

I would love to do a single ea, but I don't think it's practical due to certain restrictions. A master EA type situation could work where it would manage a portfolio of non-conflicting EAs.


dodgesparks posted:
said systems could also be controllable from your cell phone.

I'm not concerned as much with the quick access since I will be managing performance on expectancy.

Logga in / Registrera dig to comment
You must be connected to Myfxbook in order to leave a comment
*Kommersiell användning och skräppost tolereras inte och kan leda till att kontot avslutas.
Tips: Om du lägger upp en bild/youtube-adress bäddas den automatiskt in i ditt inlägg!
Tips: Skriv @-tecknet för att automatiskt komplettera ett användarnamn som deltar i den här diskussionen.