Additional Note: The indicator is tied to my MQL5 account, I can't share the file. To conduct testing you can put a lock on your file or whatever method is convenient for you.
UPDATED:
Included spread filter
Included trade expiry after x days (if too difficult to implement or won't work with backtesting/optimization, can ignore this)
Hi :) I want to have a simple EA developed using signals from the PZ day trading MT5 indicator.
The EA should not read from the chart objects, we will be calculating SL and TPs ourself so the strategy can be optimised. This spec looks long but it's not a complex strategy.
Indicator path="MQL5\Indicators\Market\PZ Day Trading MT5.ex5"
The signal buffers are available below:
int start()
{
// Read signal from the signal buffer
double signal = iCustom(Symbol(), Period(), "PZ_DayTrading", 4, 1);
// Place orders or do nothing
if(signal == OP_BUY) { /* Your code for buy signal */ }
if(signal == OP_SELL) { /* Your code for sell signal */ }
if(signal == EMPTY_VALUE) { /* Your code for no signal */ }
}
The indicator's settings and values are below:
St_Ex = "=====INDICATOR SETTINGS====="
Range = 12
Filter = 2.5
Max History Bars = 5000
DS_Settings = "=====DASHBOARD AND STATS====="
Dashboard = false
Statistics = false
Bullish Color = SkyBlue
Bearish Color = LightPink
Positive Label = Blue
Negative Label = Red
Se_Ex3 = "=====PRICE BOXES====="
Display boxes = true
Bullish boxes = DeepSkyBlue
Bearish boxes = Tomato
Fill boxes = false
Boxes width = 5
Se_Ex4 = "=====ANALYSIS OPTIONS====="
Trade Analysis = false
MFE Color = Purple
MFE Label = Blue
MAE Color = Red
MAE Label = Red
Font Size = 7
Alerts_ex = "=====ALERTS====="
Custom name for alerts = "My Alert"
Display alerts = false
Send email alerts = false
Send push alerts = false
Sound alerts = false
Sound file = alert.wav
==============================================================
The EA should have the additional setings at the top of the settings list:
Lot size (default 0.01)
Countback Bars (default 15)
Include signal bar (default false)
Price calculation mode (high/low price or close price)
Trade mode 1-9 dropdown (enum). The number is how many positions will be opened. Each additional position will have a higher take profit fibonacci level, from 1.618, 2, 2.272, 2.618, 3, 3.414, 3.618, 4, 4.236
SL mode 1-4 dropdown (enum), these equate to -0.236, -0.45, -0.618 and -0.786 fibonacci levels respectively
TPs broken dropdown (1-9) how many TPs have been invalidated by signal bar spike to cancel signal
Trailing stop after every x pips (default 0 = off)
Trailing stop amount (default 0 pips)
Spread filter (default 0) if spread is larger than or equal to this number at signal, don't open trade
Trade expiry after days (default 0) close positions that have been open for this many days (or will be if weekends are included) example: trade expiry days = 5 then trades opened on tuesday will close on friday because 5 days is including weekend. Ideally it should be closed as late as possible before the day turns over like 10-20 mins before (if too difficult to implement or won't work with backtesting/optimization, can ignore this)
=============================================================
The fibonacci levels are calculated by counting back the number of bars according to the countback bars setting (including or not including signal bar according to setting), and finding the highest and lowest price according to the calculation mode setting.
An example of a trade execution is on mode 5, a signal would open 5 orders in the signal direction at the given lot size, the SL would be set to the SL fib setting, trade 1 would have a tp of 1.618, trade 2 tp of 2, trade 3 tp of 2.272 etc etc.
There can be a situation where the signal bar can spike, and that would invalidate some of the calculated TP points before the trade is even opened. The TP levels broken setting will be used to check, before a trade is executed, if the signal bar already invalidates that many or more TP points. If it is more than or equal to the setting number, don't open the trade, as it would be determined to be too risky.
Finally, trailing stop is simple. If enabled, after every set amount of pips of profit, the trailing stop will move up by the set amount.