Participe de nossa página de fãs
Coloque um link para ele, e permita que outras pessoas também o avaliem
Avalie seu funcionamento no terminal MetaTrader 5
- Visualizações:
- 15364
- Avaliação:
- Publicado:
- 2017.09.22 08:51
-
Precisa de um robô ou indicador baseado nesse código? Solicite-o no Freelance Ir para Freelance
The attached files represent a class system that can be used to simulate a hidden Stop Loss and Take Profit system, however in addition to this, it also creates a live Stop Loss and Take Profit on the trade just in case the connection between the client and broker server goes down. There are also 4 example EAs. A basic description of how the system works is as follows:
- A class object is created with the trade characteristics that are required.
- A set of functions that are very similar to the OrderSend, OrderModify and OrderClose functions have been provided in the class for opening the trade.
- The class records the hidden Stop Loss and hidden Take Profit.
- When a trade is opened, a real Stop Loss and Take Profit is added onto the trade that is bigger than the hidden Stop Loss or Take Profit.
- Buy: Minimum Stop Loss 1 = hidden Stop Loss - Live Spread.
- Buy: Minimum Stop Loss 2 = Current Spot - {Freeze Level/Stop Level Adjustment} - Live Spread.
- Buy: Actual Live Stop Loss is Min (Stop Loss 1, Stop Loss 2).
- Sell: Minimum Stop Loss 1 = hidden Stop Loss + Live Spread.
- Sell: Minimum Stop Loss 2 = Current Spot + {Freeze Level/Stop Level Adjustment} + Live Spread.
- Sell: Actual Live Stop Loss is Max (Stop Loss 1, Stop Loss 2).
- The idea was to choose a level for Live Spread that will be large enough to cover any changes in the spread for Stop Loss hunting, but also any changes in the Stop Level and Freeze Level that may occur.
- I would suggest recording the spread, Stop Level and Freeze Level over a week and recording the difference between the minimum and maximum of these values. The Live Spread should be set so that it is greater than these differences.
To get the system to work please use the following procedure:
- Add GlobalChartFunctions, C_Trade, C_Trade_TrailingStop Loss, C_Trade_SteppedStop Loss, C_Trade_Pending into the include directory.
- Add C_Trade_BasicExample_1, C_Trade_TrailingStop Loss_2, C_Trade_SteppedStop Loss_3, C_Trade_Pending_4 into the Experts directory.
- If you want to move the files to a different location, you may need to adjust the include files.
- Compile the EA's and test them.
This system has only had some basic testing. It has not been tested in a live environment or incorporated into practical trading system yet, so please take great care and beware that bugs may exist.
I consider this a work in progress that I hope to improve upon later, when I have more time available.
![S4T_DaysOfTheWeek](https://c.mql5.com/i/code/indicator.png)
The indicator marks the days of the week with a colored histogram in the chart sub-window.
![Multicurrency hedge example EA (overlay hedge)](https://c.mql5.com/i/code/expert.png)
The example of multicurrency hedging implementation on a single chart in Metatrader 4.
![All In One Divergence](https://c.mql5.com/i/code/indicator.png)
Indicator to trade divergence. One of 30 indicators can be selected.
![Simpler Trend](https://c.mql5.com/i/code/indicator.png)
Get a grasp of the current trend by candle colors.