Rejoignez notre page de fans
- Vues:
- 20027
- Note:
- Publié:
- 2013.03.12 08:18
- Mise à jour:
- 2016.11.22 07:32
-
Besoin d'un robot ou d'un indicateur basé sur ce code ? Commandez-le sur Freelance Aller sur Freelance
Trade functions library designed for use in the code of scripts and Expert Advisors depending on a broker.
You can get acquainted with the Expert Advisors drawn on the basis of this library in the article "Simple Trading Systems Using Semaphore Indicators".
As a large number of the Expert Advisors using this library was placed in Code Base, it was decided to perform four variants of its program code to use these Expert Advisors with any broker who offers trading on financial markets using MetaTrader 5 Client Terminal:
- For brokers who offer nonzero spread and ability to set Stop Loss and Take Profit simultaneously opening a position;
- For brokers who offer zero spread and ability to set Stop Loss and Take Profit simultaneously opening a position;
- For brokers who offer nonzero spread and Stop Loss and Take Profit setting after opening a position;
- For brokers who offer zero spread and Stop Loss and Take Profit setting after opening a position;
All files placed in archives have one unique name - TradeAlgorithms.mqh. For the Expert Advisors in Code Base which use this library, only one variant of TradeAlgorithms.mqh file is allowed to use under its name in the terminal_data_folder\MQL5\Include\ of one client terminal!
After moving the library file all the Expert Advisors which use it should be compiled. For this, restart MetaEditor, open the Navigator window, right click on the MQL5 label and select "Compile" in the pop-up menu.
Functions
The library contains the following main trading functions:
bool BuyPositionOpen ( bool &BUY_Signal, // deal permission flag const string symbol, // deal's trading pair const datetime &TimeLevel, // time after which the following deal after the current deal will be performed double Money_Management, // MM int Margin_Mode, // way of lot value calculation uint deviation, // slippage int StopLoss, // Stop Loss in points int Takeprofit // Take Profit in points ); bool SellPositionOpen ( bool &SELL_Signal, // deal permission flag const string symbol, // deal's trading pair const datetime &TimeLevel, // time after which the following deal after the current deal will be performed double Money_Management, // MM int Margin_Mode, // way of lot value calculation uint deviation, // slippage int StopLoss, // Stop Loss in points int Takeprofit // Take Profit in points ); bool BuyPositionOpen ( bool &BUY_Signal, // deal permission flag const string symbol, // deal's trading pair const datetime &TimeLevel, // time after which the following deal after the current deal will be performed double Money_Management, // MM int Margin_Mode, // way of lot value calculation uint deviation, // slippage double dStopLoss, // Stop Loss in price chart units double dTakeprofit // Take Profit in price chart units ); bool SellPositionOpen ( bool &SELL_Signal, // deal permission flag const string symbol, // deal's trading pair const datetime &TimeLevel, // time after which the following deal after the current deal will be performed double Money_Management, // MM int Margin_Mode, // way of lot value calculation uint deviation, // slippage double dStopLoss, // Stop Loss in price chart units double dTakeprofit // Take Profit in price chart units ); bool BuyPositionClose ( bool &Signal, // deal permission flag const string symbol, // deal's trading pair uint deviation // slippage ); bool SellPositionClose ( bool &Signal, // deal permission flag const string symbol, // deal's trading pair uint deviation // slippage ); bool BuyPositionModify ( bool &Modify_Signal, // modification permission flag const string symbol, // deal's trading pair uint deviation, // slippage int StopLoss, // Stop Loss in points int Takeprofit // Take Profit in points ); bool SellPositionModify ( bool &Modify_Signal, // modification permission flag const string symbol, // deal's trading pair uint deviation, // slippage int StopLoss, // Stop Loss in points int Takeprofit // Take Profit in points );
Traduit du russe par MetaQuotes Ltd.
Code original : https://www.mql5.com/ru/code/1578
![WeeklyPivot](https://c.mql5.com/i/code/indicator.png)
The indicator of reversal points drawn on the week candlesticks
![TrendRange](https://c.mql5.com/i/code/indicator.png)
The trend indicator with three states.
![MinPriceChange](https://c.mql5.com/i/code/indicator.png)
The indicator of the minimum sum of price changes which forms signals after flat movements and before potential breakthrough in this or that side
![The scripts for opening long positions](https://c.mql5.com/i/code/script.png)
These scripts are designed to buy with fixed values of Stop Loss and Take Profit in points from the current price