I have an idea for an EA template. My thinking on this is to have a generalized EA with various options so that trading ideas can be quickly converted to an EA. It should have identified areas in the code to enter indicators, buy and sell entry, buy and sell close and money management. I am not sure if this has been done before.
BTW, I love this site, I have never seen so many ideas and EA's with testing in one spot that is so easy to navigate.
I listed all my requirements for the EA and I paid to have a programmer code it for me. Unfortunately the coder could not make it work. It generates errors when trying to execute trades.
I have attached the source code. I would be very thankful if someone could help me fix it.
This idea may not be complete, but maybe we can make it better
Template EA Specifications
1) EA start and stop trading time based on MT4 platform time.
2) * Separate start time in MT4 military time based on platform time. This will determine when EA starts to look for new trades.
3) * Separate end time in MT4 military time based on platform time. This will determine when EA stops looking for new trades. Any open trades continue to run based on EA exit rules.
4) Option to have a stepped trailing stop or regular trailing stop.
* Stepped trailing stop means special user defined settings for trail steps.
eg. 10 pips in profit, change stop loss to lock in 3 pips profit.
eg. 20 pips in profit, change stop loss to lock in 8 pips profit.
eg. 30 pips in profit, change stop loss to lock in 14 pips profit.
eg. 35 pips in profit, change stop loss to lock in 20 pips profit.
After that let run till hits take profit or stop loss.
* Regular trailing stop means user defined settings to start trailing stop.
eg. trail in increments (15 pip trailing stop only moves the stop after the price has moved 15 pips in a given direction. it moves again after another 15 pips)
5) Option of regular stop loss or stop loss on close of a candle.
* Regular stop loss is set, if price is equal to stoploss then trade is closed for a loss.
* Close of candle stop loss means price can be equal to stop loss setting but trade will not close unless a completed candle close is equal to or greater than (if we were selling) to stop loss.
6) Option to close all open orders on Friday before market close (user set time).
* Ability to close all trades at a particular time on Friday. Set time in MT4 military time based on platform time. This will prevent weekend gap trades.
7) Option of money management to increase lots or no management.
* Use standard money management method to automatically increase lot size based on winning trades. Also reduce lot size on losing trades.
8) Automatic lot size or user set.
9) Risk management automatic set or user defined (1% to 100%).
10) Separate buy and sell take profit.
11) Separate buy and sell stop loss.
* Internal program stop loss set by lowest low of user set bars back for buy and highest high of user set bars back for sell.
12) Stealth mode for stop loss and take profit so broker will not see.
* Stop loss and take profit will be handled internally by EA. User should be able to turn this feature on/off. If off stop loss and take profit are seen and handled by broker.
13) Emergency high stop loss in case of internet connection failure. Broker will see this one. This is only active in stealth mode.
* User set stop loss in case EA cannot close trade while in stealth mode.
14) Maximum orders open limit. EA will open orders if trade conditions are correct up to this limit.
15) Automatic magic number based on EA name, pair and time frame or user set.
16) Magic number to be displayed on chart screen (upper left below pair info).
17) Option to show account info, balance, equity, trades etc. on chart screen.
18) Option of standard or mini account.
19) Option to trade by close of candle bar or by tick mode.
* Bar close checks trades only on completed closed bars at the desired time frame.
20) Up to 5 separate buy conditions may be possible.
* Each position would have a unique magic number with the ability to set trade entry condition and trade close condition separately internally within EA. In the future I may want a particular trade to have different entry or exit conditions.
* Magic numbers subset of auto generated or subset of main manual number.
21) Up to 5 separate sell conditions may be possible.
- Each position would have a unique magic number with the ability to set trade entry condition and trade close condition separately internally within EA. In the future I may want a particular trade to have different entry or exit conditions.
- Magic numbers subset of auto generated or subset of main manual number.
22) Option to configure this EA to only trade on demo mode for a set period of time.
23) Set EA time frame as user defined so that it does not matter about on screen time frame.
24) Trade comment in history file as EA name, version, trading pair and trading time frame, eg. Template v1.00, EURJPY, 30m. This info is derived from attached chart.
1. If trade does not complete in profit for X number of bars going forward then close trade (Optional: Can this item be done??)
2. If trade starts off in negative (no profit) direction, can stop loss be made to close in (get closer) on negative price. If equal then close. Most bad trades go immediately in the wrong direction. (Optional: Can this item be done??)
* Bollinger Band settings – Period=13, Deviations=1, Apply to= Close, colors = default
* Envelopes settings – Period=3, MA method=Exponential, Apply to= Close, Deviation= 0.10%, colors = default
* Envelope bands below bollinger bands and high of candle greater than envelopes.
* Stop loss is lowest low of user selected candles back or user selected stop loss.
* Take profit is user selected, stepped, or trailing.
* Envelope bands above bollinger bands and low of candle less than envelopes.
* Stop loss is highest high of user selected candles back or user selected stop loss.
* Take profit is user selected, stepped, or trailing.
EA OPTION SCREEN
EA Name = Template v1.00, EURJPY, 30m
Magic Number Method = True // True =Auto generate, otherwise manual
Magic Number = 1234567
EA Chart Time Frame = 30 // EA will make trades based on this time frame (eg. 30 minute)
Account Type = True // True = standard lots, otherwise mini account
Trading Start Time = 0000 // 0000 = on screen MT4 GMT time
Trading Stop Time = 2400 // 2400 = on screen MT4 GMT time
Regular or Stepped Trailing Stop = True // True = regular, otherwise stepped
Trailing Stop = 19 ’’ Trail by this amount
Trailing Stop set back = 4 // if in profit by trailing stop adjust stop loss back by this amount
Stepped pips profit1 = 10 // In profit by this amount
Stepped pips profit1 lock in = 3 // If profit1 achieved adjust stop loss to lock in this amount
Stepped pips profit2 = 20 // In profit by this amount
Stepped pips profit2 lock in = 8 // If profit2 achieved adjust stop loss to lock in this amount
Stepped pips profit3 = 30 // In profit by this amount
Stepped pips profit3 lock in = 14 // If profit3 achieved adjust stop loss to lock in this amount
Stepped pips profit4 = 35 // In profit by this amount
Stepped pips profit4 lock in = 20// If profit4 achieved adjust stop loss to lock in this amount
Take Profit Buy = 100 // take profit for buy signals
Take Profit Sell = 100 // take profit for sell signals
Regular or Candle Close Stoploss = True // True= regular, otherwise candle close
Stop Loss for Buy = 50 // Stop loss amount for buy from entry
Stop Loss for Sell = 50 // Stop loss amount for sell from entry
Emergency Stop Loss = 100 // Normally not hit since EA will handle close of trade.
Close all orders on Friday = True // True= yes, otherwise no
Time to close Friday orders = 2215 // Close all orders on Friday at this time
Use Money Management = True // True= yes, otherwise no
Risk Percentage = 5 // Percentage of available equity to use for trade
Lot Size = 0.1 // Use this lot size if money management is false
Stealth Mode = True // True= hide stop loss and take profit from broker. EA handles both internally.
Maximum Open Orders = 10 // Amount of orders that are opened if trade conditions met.
Trade by Bars = True //True= Make trade decisions based on closed bars, otherwise tick data
Number of bars back for Stop Loss =3 // Number of bars back to calculate stop loss.
Number of candles to wait for profit lock in =100 // Number of completed bars after trade opened to wait for profit to be locked in. If profit not locked in after this number of completed candles then trade is closed immediately.