A simple scalping EA that trades on rapid changes of a pair's prices and does not use any indicators. Optimized for "EURUSD". It is quite resistant to forward tests, also on pairs other than "EURUSD". Timeframe does not matter.
The Main EA Parameters
- _FreeMarg—minimum free margin for trading;
- PipStep—minimum level of pips (if the price has moved by more than PipStep, a position will be opened);
- PipOut—maximum level of pips (if the price has moved by more than PipOut, the EA will not open a position);
- MaxOrders—the maximum number of placed orders;
- TrailingStop—the value of trailing stop;
- TrailStep—the step of the trailing stop;
- TimeWait—the time between the previous tick and order placing;
- MagicNumber—Magic number of the placed orders;
- _size—the size of the array, in which the prices of teh previous ticks are stored (used to calculate the median price: if the median is above the current price, trade only short; if below it, trade long);
- Lots—minimum lot;
- UseRisk—if true, risk is calculated as a percent of deposit; if false, lot 0.01 is used;
- DecreaseFactor—decrease deposit load after losing deals;
- RiskPercent—percent of equity for opening new positions;
- MaxOrderLot—maximum number of lots;
- maxspread—maximum spread;
- slippage—the value of slippage.
Removed redundant inputs.
Fixed minor errors.
Closing trades by time:
_timeclose - true/false (close/do not close a trade).
_timesecClose - integer value (time in seconds for closing a trade).
Added new algorithms for managing virtual trades by a percentage from profitable trades in trading history:
v_checktime - input parameter for virtual trades (possible double values from 0 to 1).
Setting additional stop orders (BuyStop and SellStop):
StopNet - true/false (set/do not set a stop order)
_point - number of points from the market to set stop orders.
_ords - amount of set orders.
if StopNet==true, virtual trailing function is activated.
Added the filter 2 Medians + 3 MAs:
MedianFilter - true/false (enable/do not enable filtration)
Size for price of Median0 - the first median of the current price (size of the array the previous ticks prices are stored in)
Size for price of Median1 - the second median.
_delta0 - difference in points between the two medians.
Three preset Moving Averages with averaging periods of 3, 6 and 11 for PERIOD_M1 timeframe.
Added ability to set custom position open and close filters:
GlVar_for_extdata - true/false (connect/do not connect the external filter).
if GlVar_for_extdata==true, two terminal global variables are created:
"AMGvar" (possible values: 1 - Buy/-1 - Sell)
"AMGvar_close" (possible values -1 - close all positions).
The values for these global variables should be specified from an external script or an Expert Advisor.
The external filter is placed to the second chart of the terminal.
Optimized the function for calculating the opened positions' lot size.
Fixed some minor errors.
2. Исправлена ошибка в логике выставления ордеров(Теперь при срабатывании функции CloseBy открывается следующая позиция)
- TimeM - trading start time.
- TimeE - trading end time.
Added input parameters for closing reciprocal positions (BUY-SELL)
- _clby - true/false (close/do not close reciprocal positions).