The most classic of any trading system, is the humble MA crossover. It is tick-database enabled.
- extern string Remark1 = "== Main Settings ==";
- extern int MagicNumber = 0;
- This number should be unique when multiple EAs are attached to a terminal.
- extern bool SignalsOnly = False;
- If set to true, the EA will only alert you to a trade using any combination of the alerts below.
- extern bool Alerts = False;
- If set to true, the EA will send a pop-up alert when a trading signal arrives.
- extern bool SignalMail = False;
- If set to true, the EA will send you an e-mail (assuming you set up your mail in your MT4 Terminal.) when a trading signal arrives.
- extern bool PlaySounds = False;
- If set to true, the EA will play the file, "alerts.wav" when a trading signal arrives.
- extern bool ECNBroker = False;
- Some brokers require EAs to first place a trade, and then modify the trade with the stoploss and takeprofit. If your broker requires this, set this value to True.
- extern bool TickDatabase = True;
- If set to True, the EA will send tick data into the tick database.
- extern bool CloseOnOppositeSignal = True;
- If set to true, the EA will close a trade if an opposite trading signal appears.
- extern bool EachTickMode = True;
- If set to true, the EA will take a trade immediately if it sees a signal. If set to false, the EA will take a trade only if there is a signal at the end of the bar.
- extern double Lots = 0;
- Fixed lot size
- extern bool MoneyManagement = False;
- Enables/Disables the lot sizing function.
- extern int Risk = 0;
- The percent of your available margin that you are willing to put into a trade.
- extern int Slippage = 5;
- Maximum slippage allowed when placing an order.
- extern bool UseStopLoss = True;
- Enables/Disables the stoploss
- extern int StopLoss = 100;
- Hard Stoploss in pips.
- extern bool UseTakeProfit = False;
- Enables/Disables the takeprofit
- extern int TakeProfit = 60;
- Hard take profit in pips.
- extern bool UseTrailingStop = False;
- Enables/Disables the trailingstop
- extern int TrailingStop = 30;
- Trailing stop in pips. Note, the EA will only trail profits.
- extern bool MoveStopOnce = False;
- Enables/disables the move-to-breakeven function.
- extern int MoveStopWhenPrice = 50;
- Trigger price to move the stoploss.
- extern int MoveStopTo = 1;
- Price in pips relative to breakeven to move the stoploss to once the trigger price is hit.
- Using these values as an example, the EA will move the stoploss to breakeven + 1 if the trade hits 50 pips profit.
- extern string Remark2 = "";
- extern string Remark3 = "== MA1 Settings ==";
- extern int MA1Period = 0;
- Period of the Fast MA
- extern int MA1Shift = 0;
- Shift of the Fast MA
- extern int MA1Method = 0
- Method of the Fast MA;
- 0 = SMA
- 1 = EMA
- 2 = SMMA
- 3 = LWMA
- extern int MA1Price = 0;
- Price of the Fast MA
- 0 = Close
- 1 = Open
- 2 = High
- 3 = Low
- 4 = Median
- 5 = Typical
- 6 = Weighted
- extern int MA1CrossBuffer = 0;
- The number of pips above or below MA2 in order to trigger a trade. This is designed to prevent some whiplash and false entries.
- extern string Remark4 = "";
- extern string Remark5 = "== MA2 Settings ==";
- extern int MA2Period = 0;
- Period of the Slow MA
- extern int MA2Shift = 0;
- Shift of the Slow MA
- extern int MA2Method = 0;
- Method of the Slow MA;
- 0 = SMA
- 1 = EMA
- 2 = SMMA
- 3 = LWMA
- extern int MA2Price = 0;
- Price of the Slow MA
- 0 = Close
- 1 = Open
- 2 = High
- 3 = Low
- 4 = Median
- 5 = Typical
- 6 = Weighted
Note: You can enable all of the stoploss options if you so choose, just keep in mind that the EA will use the tightest stoploss available to it.
Attached File(s)
Generic MA Crossover Version 2 [TD].mq4
21 KB
|
2,637 downloads