I was asked to start my own thread and so I would like to keep this thread about the EA I've developed. I would not like to start mixing different versions of EAs written by several others. Hopefully in doing this we all stay on track and of one mind and I will implement all the ideas I can for the EA as long as they enhance the original system and remain true to where it came from. New EAs can be written for other ideas so let's keep on track for each of the ones I've developed.
Rules:
Revision Notes:
Special Notes:
Rules:
- Week's open price is the starting point
- EA places 3 pending long positions 50 points above
- EA places 3 pending short positions 50 points below
For each of these sets of pending orders...
- 1st order: TP 25 / SL 50
- 2nd order: TP 50 / SL 50
- 3rd order: TP None / SL 50
- Pending long positions are triggered
- Pending short orders are moved up 50 pips to the week's open price
- If the long positions hit 50 (also closing trade 1 & 2) then the 3rd order is set to break even on the stop loss and the short positions are moved up another 50 pips (now 50 above week's open price)
- Short positions will be moved up 50 each time another 50 is gained on the long trades (my defaults but can be changed). The 3rd long trade also moves it's stop loss up by 50 pips at a time (i.e. 100+ then stop loss locks in 50 and so on to the extent of where the Short orders follow).
- If the long trades double back and hit the stop loss then the short trades are triggered and exactly the opposite happens.
Source Code (Very Important):
Poll: Do I have to share my source code?
Want a version that will work on live and demo accounts?Send me an e-mail: [email protected]
Settings:Inserted Code
//+------------------------------------------------------------------+ //| Input variables | //+------------------------------------------------------------------+ extern string TradingParameters = "------------------------------------------------------------"; extern bool BrokerHasSundayBar = true; //Some brokers like FXDD have no Sunday bar and other's like IBFX do. Figure out if yours has one and set to True/False extern int BrokerCloseHour = 19; //Set this to 1 hour before your broker actually closes and the EA will close everything for you on Friday (19 for IBFX, 22 for FXDD, etc.) extern int OrderDistance = 50; //Distance from week's open price then after one is triggered becomes distance between opposite orders extern bool MoveOpposites = true; //If false then shorts and longs stay above or below close of previous week by 50/OrderDistance pips extern string Order01Parameters = "------------------------------------------------------------"; extern double Order01LotSize = 0.01; //Order lot size (Not placed if = 0) extern int Order01TP = 25; //Take profit (Not placed if = 0) extern int Order01BE = 0; //When is the order set to break even? extern int Order01TrailStopTrigger = 0; //When is trailing stop triggered? extern int Order01TrailStopAmount = 0; //Trail by how many pips? extern string Order02Parameters = "------------------------------------------------------------"; extern double Order02LotSize = 0.01; //Order lot size (Not placed if = 0) extern int Order02TP = 50; //Take profit (Not placed if = 0) extern int Order02BE = 0; //When is the order set to break even? extern int Order02TrailStopTrigger = 0; //When is trailing stop triggered? extern int Order02TrailStopAmount = 0; //Trail by how many pips? extern string Order03Parameters = "------------------------------------------------------------"; extern double Order03LotSize = 0.01; //Order lot size (Not placed if = 0) extern int Order03TP = 1000; //Take profit (Not placed if = 0) extern int Order03BE = 50; //When is the order set to break even? extern int Order03TrailStopTrigger = 0; //When is trailing stop triggered? extern int Order03TrailStopAmount = 0; //Trail by how many pips? extern string Order04Parameters = "------------------------------------------------------------"; extern double Order04LotSize = 0.00; //Order lot size (Not placed if = 0) extern int Order04TP = 0; //Take profit (Not placed if = 0) extern int Order04BE = 0; //When is the order set to break even? extern int Order04TrailStopTrigger = 0; //When is trailing stop triggered? extern int Order04TrailStopAmount = 0; //Trail by how many pips? extern string Order05Parameters = "------------------------------------------------------------"; extern double Order05LotSize = 0.00; //Order lot size (Not placed if = 0) extern int Order05TP = 0; //Take profit (Not placed if = 0) extern int Order05BE = 0; //When is the order set to break even? extern int Order05TrailStopTrigger = 0; //When is trailing stop triggered? extern int Order05TrailStopAmount = 0; //Trail by how many pips? extern string EmailParameters = "------------------------------------------------------------"; extern bool EmailNewOrdersPlaced = false; //Send e-mail whenever an order is placed (even limit and stop orders) extern bool EmailProfitLossSummary = false; //Send profit/loss summary anytime order count changes (does not count pending orders) extern string MiscParameters = "------------------------------------------------------------"; extern bool DisplayProfitLoss = true; //Display history of trades? extern int OrderSlippage = 3; //How many pips can the order placement vary? extern int EAMagicNumber = 20080622; //Used to determine orders placed by this EA
Inserted Code
//+------------------------------------------------------------------+ //| Revision notes | //+------------------------------------------------------------------+ /* Version 1.0b: * Merged v1.0a versions together where the EA determines your broker and uses the right bar count. * Fixed a bug related to closing and reopening the EA/MT4 where SL would be set to nothing. * You will want to remove/delete the original EA as it contains bugs and the new EA will not overwrite it because the name is different. Any charts that had the old EA will need to be updated with the new one. From now on this should not be an issue as the name will not change anymore. Version 1.0c: * Fixed a bug where the update to break even was being set even if stop loss was set higher/lower securing profit. Now as it was intended... if pending short trades (entry) is greater than the break even on the long trades, then the long order stop loss is moved up securing more pips and vice versa. * EA now uses the open price for the week rather than the close of the previous week. * MoveInfinite variable added which overrides Move01 - Move04 if set to True. Orders will be adjusted everytime price moves by the OrderDistance. * EA now closes open and pending orders on Sunday as long as the EA is running. Version 1.0d: * Reworked how orders are placed/maintained * Removed MoveInfinite and Move01 through Move04 Version 1.0e: * Fixed bug with order calculation Version 1.0f (68 downloads): * Reworked how orders are placed/maintained (again...) * replaced stop loss setting with order distance * Added BrokerCloseHour Version 1.0g (95 downloads): * DisplayProfitLoss added (Display Profit/Loss on Chart comments?) * Send E-mail when new orders are placed * Send E-mail when order total changes (does not count pending orders) Version 2.0: * Fixed bug with pip calculation on profit display * Fixed problem with E-mail display text * Modified key areas to work with live accounts * Live version made available Pending additions/changes: * E-mail status of EA * Order modified, closed, deleted, etc.? (Not sure how far to go just yet) */ string Version = "WeeklyOpen AutoTrader v2.0";
- This system should start on Sunday when the market opens.
- This should be run on Daily charts.
- I do not guarantee any results especially if you decide to change the default settings or run this in another time frame. The EA looks back by bars so if it's not on a Daily chart you will get the wrong price.
- The EA may work (place trades) if turned on during the week but not what I envisioned and results are not guaranteed. It's really meant to start on Sunday and run through Friday's close.
- It is extremely important that MT4 run all week with the charts open and EA attached. No EA can do its thing unless everything is running. That's why you have an EA to trade for you.
- The EA will only run on demo accounts. I will release a live version if it pans out to be something.
- I will try to post weekly updates at least of the results.
Currently supported brokers:
- All as long as you specify whether your broker has a Sunday bar or not (BrokerHasSundayBar = True/False).
Here are some of my other threads you might find interesting...
"The Pip Nailer" (EA - MTaboneWeb)
AshFX Daily (EA - MTaboneWeb)
DailyHighLow (EA - MTaboneWeb)
GrabMyOrders (EA - MTaboneWeb)
TossUp (EA - MTaboneWeb)
Weekly Open EA
The EA attached to the 2nd post is out of date. Please use the EA on this post (#1).
A special thanks to all who have supported this EA and continue to support it.
Attached Images