Generic Breakout Version 7 adds a few new features, namely in the graphics and trade management sections.
extern string Remark1 = "== Main Settings ==";
extern int MagicNumber = 0;
- Identifier used by an EA to determine which trades the EA should manage. Make sure each EA in the terminal has a unique MagicNumber.
extern bool SignalsOnly = False;
- If set to true, the EA will only give you signals using any combination of the signal methods below.
extern bool Alerts = False;
- Enables/Disables the Pop-up notification.
extern bool SignalMail = False;
- Enables/Disables the e-mail notification. Make sure e-mails are set up properly in Metatrader.
extern bool PlaySounds = False;
- Enables/Disables the sound notification. The EA plays the file 'alert.wav' in the Sounds folder.
extern bool ECNBroker = False;
- Some brokers require an EA to first place a trade, and then modify the trade with a SL/TP. If your broker requires this, set this value to true.
extern bool TickDatabase = True;
- All of my EAs with the tag [TD] send data to a tick database. Every Saturday at 2AM EST, tick data for the past week is put into a .csv file and added to www.RonaldRaygunForex.com/TickDB/Archive. By setting this input to true, the EA will send tick data to my database. I'm only collecting the following pieces of information:
- GMT Time
- Terminal Time
- I am not and will never collect any personal information.
extern bool UseTradingTimes = False;
- If set to true, the EA will only trade between the times set below.
extern int StartHour = 0;
- Starting Hour.
extern int StartMinute = 0;
- Starting Minute
extern int StopHour = 0;
- Stopping Hour.
extern int StopMinute = 0;
- Stopping Minute
- Note: When I combine the previous 4 inputs together, I should get two times:
extern bool CloseOnOppositeSignal = True;
- If set to true, the EA will close a long trade if there is a short signal and a short trade if there is a long signal.
extern bool AutoDetect5DigitBroker = False;
- If set to true, the EA will automatically detect the broker's
'digit-status' and the result will be displayed in the upper left corner. If the EA is wrong, you have to set this value to false, and adjust the necessary pip values.
extern bool EachTickMode = True;
- If set to true, the EA will take a trade immediately when a trade signal presents itself. If set to false, the EA will take a trade if a trade signal is present at the close of a bar.
extern double Lots = 0;
- The fixed lot size of the EA.
extern bool MoneyManagement = False;
- Enables/Disables the money management function
extern int Risk = 0;
- The percentage used (0-100) to determine a lot size. As a reference point, a Risk value of 10 in a $1,000 account with 200:1 leverage is 0.1 lots.
extern int Slippage = 5;
- The maximum slippage in pips allowed for a given trade.
extern bool UseStopLoss = True;
- Enables/Disables the initial stoploss.
extern int StopLoss = 100;
- The fixed stoploss in pips. Set to 0 to disable.
extern double SLMultiplier = 0.0;
- The fixed stoploss calculated as a multiple of the trading range. Set to 0.0 to disable.
extern int SLMultiplierBuffer = 0;
- The number of pips added to the stoploss calculated by SLMultiplier. E.G. if SLMultiplier is set to 2.0 and SLMultiplierBuffer is set to 10, the EA will set the stoploss to twice the range + 10 pips.
extern bool UseTakeProfit = False;
- Enables/Disables the initial TakeProfit
extern int TakeProfit = 60;
- Fixed TakeProfit value in pips. Set to 0 to disable.
extern double TPMultiplier = 0.0;
- Fixed TakeProfit value as a multiple of the range. Set to 0.0 to disable.
extern int TPMultiplierBuffer = 0;
- The number of pips added to the takeprofit calculated by TPMultiplier. E.G. if TPMultiplier is set to 1.5 and TPMultiplierBuffer is set to 100, the EA will set the takeprofit to 1.5 times the range + 100 pips.
extern bool UseTrailingStop = False;
- Enables/Disables a fixed-pip trailing stop.
extern int TrailingStop = 30;
- Fixed trailing stop in pips.
extern bool UseMultipleTrailingStop = False;
- Enables/Disables a trailing stop calculated based on a multiple of the range the trade was opened in.
extern int TSMultiple = 1.0;
- The multiple of the range to calculate a trailing stop. The EA determines which range a trade was opened in.
extern int TSMultipleBuffer = 1.0;
- The number of pips added to the Range-Multiple based trailing stop.
extern bool MoveStopOnce = False;
- Enables/Disables the "Move-To-Breakeven" function.
extern int MoveStopWhenPrice = 50;
- The trigger price which triggers the move-to-breakeven function.
extern int MoveStopTo = 1;
- The number of pips relative to breakeven to move the stoploss to.
extern bool UseMultipleMoveStopOnce = False;
- Enables/Disables the Range-Based "Move-To-Breakeven" function
extern double MoveStopWhenRangeMultiple = 1.0;
- The multiple of the trade's range to set as the trigger price.
extern int MoveStopWhenRangeMultipleBuffer = 0;
- The number of pips added to the multiple above.
extern double MoveStopToMultiple = 0.0;
- The multiple of the trade's range to move the stoploss to.
extern int MoveStopToMultipleBuffer = 1;
- The pips added to the range above.
Note: You can enable all stoplosses options. The EA will use smallest stoploss of the available choices. Keep in mind that there is a a possibility that the smallest stoploss is smaller than the minimum broker's stoploss. If that happens, the EA will return an error.
Note: You can enable all takeprofit options. The EA will use the largest takeprofit value of all the available choices.
extern string Remark2 = "";
extern string Remark3 = "== Breakout Settings ==";
extern int RangeStartHour = 0;
- The hour to start calculating the range start.
extern int RangeStartMinute = 0;
- The minute to start calculating the range start.
extern int RangeStopHour = 0;
- The hour to start calculating the range stop.
extern int RangeStopMinute = 0;
- The minute to start calculating the range stop.
Note: The range times will be displayed on the chart in yellow.
extern string TSDescription = "Trading Style: 1 - Breakout | 2 - Counter Trend";
extern int TradingStyle = 0;
- There are certain times of the day when it is better to trade against a breakout. Instead of expecting the price to break outside the box's range, you expect the price to return to the center of the range.
- Disables the EA.
- Places the long trade at the high price, and the short trade at the low price.
- Places the long trade at the low price and the short trade at the high price.
extern double EntryMultiplier = 0.0;
- The multiple of the range added to the high price/low price. If you set this value to 1.0 and set the TradingStyle input to 2, it's the same as setting the value to 0.0 and setting TradingStyle to 1. Conversely, you could set TradingStyle to 1 and EntryMultipler to -1 to get the same as setting EntryMultiplier to 0.0 and TradingStyle to 2.
extern int EntryBuffer = 0;
- The number of pips added to the entry multiplier.
extern int MaxRangePips = 0;
- The Maximum number of pips allowed in a range. Set to 0 to disable.
extern int MinRangePips = 0;
- The Minimum number of pips allowed in a range. Set to 0 to disable.
extern int MaxTrades = 0;
- The maximum number of trades allowed in a given session.
extern int MaxLongTrades = 0;
- The maximum number of long trades allowed in a given session.
extern int MaxShortTrades = 0;
- The maximum number of short trades allowed in a given session.
extern int MaxProfitTrades = 0;
- The maximum number of profit trades allowed in a given session.
extern bool CountOpenTrades = True;
- Determines whether or not to count open trades' profit/loss.
extern int MaxLossTrades = 0;
- The maximum number of loss trades allowed in a given session.
extern int MaxSimultaneousTrades = 1;
- The maximum number of simultaneous trades allowed in a given session.
extern int MaxSimultaneousLongTrades = 0;
- The maximum number of simultaneous long trades allowed in a given session.
extern int MaxSimultaneousShortTrades = 0;
- The maximum number of simultaneous short trades allowed in a given session.
Trade counts are calculated from the end of the box drawn on the chart.
Squalou found a glaring bug in this EA, which would cause improper calculation of the high / low range of the box. I have added a fix.
RedBaron was so kind to post a PDF containing explanations on the inputs of this EA.
[A third edit]
xirtam has revealed a bug to me and it has since been fixed.