Page 1 of 2 12 LastLast
Results 1 to 10 of 13
 2 Attachment(s)    

Thread: EA Template Idea

  1. #1

    Default EA Template Idea

    Hi Everyone,

    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.

    Special Items:

    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??)

    TRADING SETUP

    Indicators

    * 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

    TRADING RULES
    BUY

    * 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.

    SELL

    * 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.
    Attached Files Attached Files
    Last edited by EvertonHarding; 12-22-2008 at 18:22.

  2. #2

    Default

    This is a good template.

    Can consider:
    - to add in whether want to hide the SL and TP values.
    - Spread Control: Wide Spread no trade.

  3. #3
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,003

    Default

    Hi EvertonHarding,

    Welcome !

    This is a good idea, but you still need to have some knowledge to code the conditions that are specific to each indicator.

    Personnally, at the beginning I worked with a simple template that I have developed myself, then I have added several features after each systems. And I'm still developping this one. Sometimes, it is too heavy, and I can't do fast backtesting, so I have to disable or to delete a lot of options. Also there is still some errors. For certain systems, I have to modify all the code, when there is pending orders for example, or with complex indicators, the structure is different, we need to create functions that include the indicator's logics. And there is a lot of things that I still don't know how to code, like and EA based on the murrey math for example, but I'm still learning.

    I suggest all the traders that want to work with a template to understand well this template. It would be better if they start with a simple code. They can use the basic moving average EA that is included in Metatrader.

  4. #4

    Default

    Thanks for the good comments.

    Item #12 does hide TP & SL.
    I will consider if spread too wide, no trade.

  5. #5

    Default

    Quote Originally Posted by funyoo View Post
    Hi EvertonHarding,

    Welcome !

    This is a good idea, but you still need to have some knowledge to code the conditions that are specific to each indicator.

    Personnally, at the beginning I worked with a simple template that I have developed myself, then I have added several features after each systems. And I'm still developping this one. Sometimes, it is too heavy, and I can't do fast backtesting, so I have to disable or to delete a lot of options. Also there is still some errors. For certain systems, I have to modify all the code, when there is pending orders for example, or with complex indicators, the structure is different, we need to create functions that include the indicator's logics. And there is a lot of things that I still don't know how to code, like and EA based on the murrey math for example, but I'm still learning.

    I suggest all the traders that want to work with a template to understand well this template. It would be better if they start with a simple code. They can use the basic moving average EA that is included in Metatrader.
    Thanks Funyoo,

    I do understand the many variables that can happen when you try to do a template.
    I am trying to cover 70% to 80% of EA systems with this template.
    Is it possible to see your template, since you have probably improved it over time?

    Can you fix ordersend error in my template so that I can start to test it?
    I can modify some code but this one is beyond me!

    Thanks if you can.

  6. #6
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,003

    Default

    Quote Originally Posted by EvertonHarding View Post
    I do understand the many variables that can happen when you try to do a template.
    I am trying to cover 70% to 80% of EA systems with this template.
    Is it possible to see your template, since you have probably improved it over time?
    Check my last EAs. But you won't understand the codes, as I have my own way to program.

    Quote Originally Posted by EvertonHarding View Post
    Can you fix ordersend error in my template so that I can start to test it?
    I can modify some code but this one is beyond me!
    Here it is. The error was generated by the stop loss that was not well calculated.
    Attached Files Attached Files

  7. #7

    Default

    Quote Originally Posted by funyoo View Post
    Check my last EAs. But you won't understand the codes, as I have my own way to program.



    Here it is. The error was generated by the stop loss that was not well calculated.
    Thanks Funyoo,

    Thanks very much for fixing my code. I will start testing now.
    Can you give me link to some of your latest ea's.

  8. #8
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,003

    Default

    Quote Originally Posted by EvertonHarding View Post
    Can you give me link to some of your latest ea's.
    http://www.tradingsystemforex.com/2352-post3.html

  9. #9

    Default

    Thanks very much. You are very quick.

    BTW do you know of an ea that places a buy stop and sell stop straddle on a candle close. It should have the option to close opposite buy/sell stop if one trade is triggered or keep it open for X number of bars going forward.

    It should have the standard items like your 8 and 8, trailing stop, hidden SL & TP, stepped take profit, etc.

  10. #10
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,003

    Default

    Quote Originally Posted by EvertonHarding View Post
    BTW do you know of an ea that places a buy stop and sell stop straddle on a candle close. It should have the option to close opposite buy/sell stop if one trade is triggered or keep it open for X number of bars going forward.

    It should have the standard items like your 8 and 8, trailing stop, hidden SL & TP, stepped take profit, etc.
    See here : http://www.tradingsystemforex.com/ne...raddle-ea.html

Similar Threads

  1. MQL5 template
    By cyril.dumas in forum MQL programming
    Replies: 1
    Last Post: 04-05-2012, 15:31
  2. EA Builder Template
    By CodingChris in forum Expert advisors backtesting
    Replies: 3
    Last Post: 01-30-2012, 06:56
  3. FUNYOO TEMPLATE FOR EAs
    By Dutchess in forum MQL programming
    Replies: 1
    Last Post: 11-05-2010, 15:35
  4. Expert Advisor Template
    By SallyFX in forum MQL programming
    Replies: 0
    Last Post: 08-12-2009, 07:39

Tags for this Thread

10%, 100, average, backtesting, bands, bollinger, broker, candle, candles, change, demo, eas, eurjpy, fast backtesting, how to, indicator, indicators, limit, magic, magic number, main, manual, metatrader, money, moving average, mt4, news, pips, profit, programmer, simple, source, spread, stop, stoploss, systems, test, thank you, time, trading, trailing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •