工作已完成
![](https://c.mql5.com/i/avatar/avatar_na2.png)
指定
I am currently manually trading and I would like a framework with multiple parameters so that variants of my ideas can be back tested as well as put into practice with real money.
I need A framework in which I can easily take custom indicators, create signals and have trade orders called, as per my risk management. I am mainly looking for the trade operations to be set. This will be for a hedging account to also allow for pyramiding strategies to be implemented. This framework needs to be symbol specific, as the same EA will be used on multiple symbols. I want to just place my indicator decisions in the EA. I want to call the functions for buying/selling.
Risk Management:
- I need the lots size for each trade to gradually increase and decrease in volume, as the account balance raises and falls, The % amount needs to be able to be changed by the user (default to 2% risk per trade) Trades are only to be opened just after the close of the prior candle.
- I need a total account value at risk limit (%) to limit the number of trades that can be made.
- When a trade order is sent and the position is opened I need the Stop loss to be a factor of the ATR away from price upon entry. This will just be a hard stop loss on the position.
- Take Profit can be further explained if I have failed to describe it well enough in the "Partial-close" Below.
The set trade operations I would like to be called for are as follows:
- Entry - Open a new trade and check that the close of all open positions on the specific symbol, that are opposite to the direction of new entry, is true. This can be a "Close-All" check.
- Re-Entry - Open a new trade (when another signal is given, even when there is a trade already open in that direction) The lot size on "Re-Entry" trades will be the same as the first "Entry". Multiple types of this trade can be open (limit on this is dependent on the "Total account value at risk limit" set by the user).
- Close-All - Close all open positions. This will be called when Indicators deem so.
- Partial-Close - Once price moves the factor of the ATR in the desired direction, this order will be called and a user specified % of the trade will be closed. This order will be dependent on the factor of the ATR that can be set by the user (only applies to the Take Profit side of the trade). I understand that the take profit cannot be set when trying to achieve this. Not sure how this would be done but I am assuming a price alert will need to be set for the partial close to initiate, and then the "Close-All" can be used to close out the rest of the position.
- Close-ATR-Factor - This will be a close trade order for the remainder of the trade, after partial close has been completed. This factor will be bigger than the factor used for the Partial-Close.
Open Trade Management:
- I need the Stop loss to be modified when a portion of the trade is closed out. When price moves a user specified factor of the ATR, the Stop Loss then needs to be moved to Breakeven (entry price) on the rest of the trade.
- I need a trailing stop function. This needs to be able to be switched on and off by the user. This only applies to the remainder of the trade after A Partial-Close has completed. The trailing stop initiates when price moves more than a user specified factor of the ATR on the remainder of a trade after a partial close.
- Switch between trailing stop exit when the price moves more than a user specified factor of the ATR and an Indicator based exit.
User Input Variables:
- ATR period
- Risk size (%)
- Stop Loss as a factor of the ATR
- Partial close value of open position (%)
- Take Profit 1 as a factor of the ATR (Partial close)
- Take Profit 2 as a factor of the ATR on close of the rest of trade (Close All)
- Stop Loss as a factor of the ATR
- Trailing stop as a factor of the ATR
- Total account value at risk limit (%)
User Variables (True/False):
- Trailing stop
- Entry prevention ATR ( when prior candle is larger than the user specified ATR measure (open to close) )
- Entry prevention ATR away from MA ( when the close of the prior candle is more than the user specified ATR measure away from the value of the On Chart MA )
- Take Profit 2 ( to allow me to switch from indicator exit on the remainder of a trade and a take profit, again defined by the ATR )
Other required Operations:
- The results of each important operation, logging of error codes, sending of trade requests, calculation of Stop Loss and other operations need to all be recorded. This includes a record of the of signals, the current market price and trade request parameters before sending an order for execution.
- With regards to the partial closing of a position, round up to the closest figure relative to the user input %.
- Messages of errors that are able to be sent to a SMS & email in the event of the system having a problem, the servers are shut down, or broker systems halt for maintenance.
- Needs to be symbol specific, I intend to use this EA on multiple symbols at the same time.
- Prevention of trading in the event that there is a system failure, loss of connection, or power outage
-
Single Licence, open to suggestions with regards to security
-
Needs to be able to be used on All symbols, FOREX, Oil, Gold, Indices, etc...
Signals for trades being called:
I intend to get downloadable custom indicators and get them to provide signals for trades. However, I need an example demonstration to show that the trade operations are called correctly. Please use the (metaquotes) MACD indicator (default settings) as it will show all the types of orders being opened and closed. I have attached an image to show the signals.
- Open Long - "Entry" followed by 4 "Re-Entry" ( Examples shown by The first 5 red lines red line in the attached image)
- Close position - Exit "Close-All" When MACD moves and closes past negative.
- Open Short - "Entry" (Example shown by 6th red line in the attached image)
- Close position - Exit "Close-All" When MACD moves and closes above positive.
At the end of the project I would need the source code and a short consultation with you to set up the back-testing at my end.