Job finished
Specification
I will like an automated expert advisor that will work in real time as I will want to leave it on a server to generate profit.
Signals will be generated as follows:
If Bollinger band(middle Bollinger band) is above/higher than Moving Average and bar closes below highest Bollinger band and the next
bar closes above Highest Bollinger band(thus bar has to close, not only move above), a long position will be opened.
If Bollinger band(middle one) is below Moving Average and bar closes above lowest bollinger band and the next bar below lowest
Bollinger Band (thus bar has to close, not only move below), a short position has to be opened.
MAX 1 position can be opened at a time. Thus only after open position is closed can the next signal be generated.
The following inputs should be available:
Moving average:
1)Length of moving average
2)Source, for example(closing, open, low or high price)
3)Offset
Bollinger band:
1)Length of bolinger band
2)Source, for example(closing, open, low or high price)
3)Offset
4)Standard deviation
There should also be an option that can be set so that either - 1)Only Long Positions can be opened
2)Only Short Positions can be opened
3)Both Long and Short positions can be opened.
Risk Management
Risk management will be determined with the Average True Range(ATR) indicator as follows:
Average true range % will be calculated for each closing bar. This is done by dividing the Average True Range
value by the closing Price value *100.
Then there should then be 2 inputs for:
-Stop loss multiple.
-Take profit multiple.
These inputs will be multiples that will be multiplied with the Average True Range %.
For example if the closing price for a share is $1000 and the Average True Range is 1 then the Average True
Range % will be 1/1000 *100=0.1
Then Stop loss will be determined as follows:
Average True Range % times the input multiple for stop loss.
For example if a input multiple of 2 is entered then the stop loss will be 0.1 *2=0.2%
Thus stop loss will be set at 0.2% below opening price of trade.
Then Take profit will be determined in a similar manner:
Average True Range % times the input multiple for take profit.
For example if a input multiple of 3 is entered then the stop loss will be 0.1 *3=0.3%
Thus take profit will be set at 0.3% above opening price of trade.
Position sizing:
For position sizing there should be an input for the % of equity that should be risked.
For example if equity is $100 000 and input is 2% then only an amount of $2000 should be risked.
Position sizes will then be determined with the Stop loss value(as calculated under Risk Management) as follows:
The amount that should be risked (for example the $2000) should be divided by the Stop loss %.
Thus using the $2000/0.2%=$1 000 000.
Thus a position of $1 000 000 should be opened.
Thus if stop loss is triggered, 0.2%*1 000 000= $2000 loss.
High volatility problem:
Lastly I only want positions opened when volatility is low. I thought about adding a extremely long moving average(500 ma length)
to the Average true range indicator and only opening positions if the ATR%/or the ATR(as they are identical in movement but not value)
are below the 500 moving average, I know you can do this in Tradingview but not sure about mql5? Any other suitable suggestions are welcome.
In any case there should be in input to whether the volatility limit should be true or false.
Indexes and commodities:
Lastly the system has to work on all commodities(including gold and silver) and indexes as available to trade by XM brokers.
Testing
I am going to use the coded algorithm to back test data, run it on a demo account; and if there is no errors on a real account.
I would also have possesion of source code and programmer should be available for final tweaks and adjustments.