![MQL5 - Langage des stratégies de trading intégré au terminal client MetaTrader 5](https://c.mql5.com/i/registerlandings/logo-2.png)
Vous manquez des opportunités de trading :
- Applications de trading gratuites
- Plus de 8 000 signaux à copier
- Actualités économiques pour explorer les marchés financiers
Inscription
Se connecter
Vous acceptez la politique du site Web et les conditions d'utilisation
Si vous n'avez pas de compte, veuillez vous inscrire
////////////////////////////////////////////////////////////////////< 1> // < Program : Property > //< > // #define 1 " " //< > // #define 2 " " //< > // </Program : Property > //< > // //< > // //< > // < Program : Content > //< > // //< > // < Structure 15 elements in 3 domains > //< > // < 1. Data 7 elements in 1 domains /> //< > // < 2. Code 8 elements in 2 domains /> //< > // </Structure 15 elements in 3 domains > //< > // //< > // < 1. Data 7 = 4 i 3 d - s > //< > // < 1.1. Input 7 = 4 i 3 d - s /> //< > // </1. Data 7 = 4 i 3 d - s > //< > // //< > // < 2. Code 8 / - i 77 l 3 o > //< > // < 2.1. Interface 5 / - i 66 l 3 o /> //< > // < 2.2. Special 3 / - i 11 l - o /> //< > // </2. Code 8 / - i 77 l 3 o > //< > // //< > // </Program : Content > //< >
////////////////////////////////////////////////////////////////////< 2> // < 1.1. Data : Input > //< > // //< > // < 1.1. Input 7 = 4 i 3 d - s > //< > // < 1. Strategy 4 = 2 i 2 d - s /> //< > // < 2. Trading 3 = 2 i 1 d - s /> //< > // </1.1. Input 7 = 4 i 3 d - s > //< > // //< > // < 1. Strategy 4 >=========================================//< > int iBaseLag = 20 ; //< > int iBaseBar = 1 ; //< > double dFactorTP = 1.0 ; //< > double dFactorSL = 2.0 ; //< > // </ 1. Strategy 4 >=========================================//< > // //< > // < 2. Trading 3 >==========================================//< > int iSlippage = 1 ; //< > int iMagic = 1 ; //< > double dLots = 0.1 ; //< > // </ 2. Trading 3 >==========================================//< > // //< > // //< > // //< > // </1.1. Data : Input > //< >
////////////////////////////////////////////////////////////////////< 3> // < 2.1. Code : Interface > //< > // //< > // < 2.1. Interface 5 / - i 66 l 3 o > //< > // < 1. iSignalOpen - i 14 l 1 o /> //< > // < 2. iSignalClose - i 15 l 1 o /> //< > // < 3. iGetTicket - i 7 l 1 o /> //< > // < 4. iTryOpen - i 15 l - o /> //< > // < 5. iTryClose - i 15 l - o /> //< > // </2.1. Interface 5 / - i 66 l 3 o > //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // </2.1. Code : Interface > //< >
////////////////////////////////////////////////////////////////////< 4> // < 2.1.1. Code : Interface : iSignalOpen > //< > int iSignalOpen () // - i 14 l 1 o //< > { //< > static int iTime_0 = EMPTY ; //< > if ( iTime_0 < iTime ( 0 , 0 , 0 ) ) //< > { iTime_0 = iTime ( 0 , 0 , 0 ) ; //< > static double dHighest , dLowest ; //< > // //< > dHighest = High [ iHighest ( 0 , 0 , MODE_HIGH , //< > iBaseLag , iBaseBar ) ] ; //< > // //< > dLowest = Low [ iLowest ( 0 , 0 , MODE_LOW , //< > iBaseLag , iBaseBar ) ] ; //< > } // if //< > // //< > double dAsk = MarketInfo ( Symbol () , MODE_ASK ) ; //< > double dBid = MarketInfo ( Symbol () , MODE_BID ) ; //< > // //< > if ( dAsk > dHighest ) return ( OP_BUY ) ; //< > if ( dBid < dLowest ) return ( OP_SELL ) ; //< > return ( EMPTY ) ; //< > } //< > // </2.1.1. Code : Interface : iSignalOpen > //< >
////////////////////////////////////////////////////////////////////< 5> // < 2.1.2. Code : Interface : iSignalClose > //< > int iSignalClose () // - i 15 l 1 o //< > { //< > static int iTime_0 = EMPTY ; //< > if ( iTime_0 < iTime ( 0 , 0 , 0 ) ) //< > { iTime_0 = iTime ( 0 , 0 , 0 ) ; //< > static double dATR , dProfit , dLoss ; //< > dATR = iATR ( 0 , 0 , iBaseLag , iBaseBar ) ; //< > } // if //< > // //< > double dDelta = OrderOpenPrice () - OrderClosePrice () ; //< > // //< > if ( OrderType () == OP_BUY ) //< > { dProfit = -dDelta ; dLoss = dDelta ; } //< > else if ( OrderType () == OP_SELL ) //< > { dProfit = dDelta ; dLoss = -dDelta ; } //< > else return ( EMPTY ) ; //< > // //< > if ( dProfit > dATR * dFactorTP ) return ( TRUE ) ; //< > if ( dLoss > dATR * dFactorSL ) return ( TRUE ) ; //< > return ( EMPTY ) ; //< > } //< > // </2.1.2. Code : Interface : iSignalClose > //< >
////////////////////////////////////////////////////////////////////< 6> // < 2.1.3. Code : Interface : iGetTicket > //< > int iGetTicket () // - i 7 l 1 o //< > { //< > for ( int i = OrdersTotal () - 1 ; i >= 0 ; i -- ) //< > { //< > if ( OrderSelect ( i , SELECT_BY_POS ) == TRUE ) //< > if ( OrderMagicNumber () == iMagic ) //< > return ( OrderTicket () ) ; //< > } // for //< > return ( EMPTY ) ; //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > } //< > // </2.1.3. Code : Interface : iGetTicket > //< >
////////////////////////////////////////////////////////////////////< 7> // < 2.1.4. Code : Interface : iTryOpen > //< > int iTryOpen () // - i 15 l - o //< > { //< > int iCommand = iSignalOpen () ; //< > if ( iCommand == EMPTY ) return ; //< > if ( iCommand == OP_BUY ) //< > { string sType = "Buy" ; int iColor = Blue ; } //< > else { sType = "Sell" ; iColor = Red ; } //< > // //< > if ( iCommand == OP_BUY ) int iMode = MODE_ASK ; //< > else iMode = MODE_BID ; //< > double dPrice = MarketInfo ( Symbol () , iMode ) ; //< > // //< > OrderSend ( Symbol () , iCommand , dLots , //< > NormalizeDouble ( dPrice , Digits ) , //< > iSlippage , 0 , 0 , "" , iMagic , 0 , iColor ) ; //< > // //< > int iTrap = GetLastError () ; //< > if ( iTrap == 0 ) //< > Alert ( sType , " Was a Big Success" ) ; //< > else Alert ( sType , " open exception " , iTrap ) ; //< > } //< > // </2.1.4. Code : Interface : iTryOpen > //< >
////////////////////////////////////////////////////////////////////< 8> // < 2.1.5. Code : Interface : iTryClose > //< > int iTryClose () // - i 15 l - o //< > { //< > int iCommand = iSignalClose () ; //< > if ( iCommand == EMPTY ) return ; //< > if ( OrderType () == OP_BUY ) //< > { string sType = "Buy" ; int iColor = Red ; } //< > else { sType = "Sell" ; iColor = Blue ; } //< > // //< > if ( OrderProfit () > 0 ) string sAct = "Take" ; //< > else sAct = "Stop" ; //< > double dPrice = OrderClosePrice () ; //< > // //< > OrderClose ( OrderTicket () , OrderLots () , //< > NormalizeDouble ( dPrice , Digits ) , //< > iSlippage , iColor ) ; //< > // //< > int iTrap = GetLastError () ; //< > if ( iTrap == 0 ) //< > Alert ( sType , " closed with Hard " , sAct ) ; //< > else Alert ( sType , " close exception " , iTrap ) ; //< > } //< > // </2.1.5. Code : Interface : iTryClose > //< >
////////////////////////////////////////////////////////////////////< 9> // < 2.2. Code : Special > //< > // //< > // < 2.2. Special 3 / - i 11 l - o > //< > // < 1. init - i 1 l - o /> //< > // < 2. deinit - i 1 l - o /> //< > // < 3. start - i 9 l - o /> //< > // </2.2. Special 3 / - i 11 l - o > //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // </2.2. Code : Special > //< >
////////////////////////////////////////////////////////////////////< 10> // < 2.2.1. Code : Special : Init > //< > int init () // - i 1 l - o //< > { //< > Alert ( "" , "Start " , UninitializeReason () ) ; //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > } //< > // </2.2.1. Code : Special : Init > //< >
////////////////////////////////////////////////////////////////////< 11> // < 2.2.2. Code : Special : Deinit > //< > int deinit () // - i 1 l - o //< > { //< > Alert ( "" , "Stop " , UninitializeReason () ) ; //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > // //< > } //< > // </2.2.2. Code : Special : Deinit > //< >
////////////////////////////////////////////////////////////////////< 12> // < 2.2.3. Code : Special : Start > //< > int start () // - i 9 l - o //< > { //< > // < 2.2.3.1. History data inspection 4 >`````````````````````````//< > static int iTrigger = 0 ; if ( iTrigger == 0 ) { //< > if ( ( iTime ( 0 , 0 , 0 ) == 0 ) //< > || ( iBars ( 0 , 0 ) < iBaseLag + iBaseBar ) ) //< > return ; else iTrigger = 1 ; } //< > // </2.2.3.1. History data inspection 4 >`````````````````````````//< > // //< > // < 2.2.3.2. Main routine 3 >````````````````````````````````````//< > int iTicket = iGetTicket () ; //< > // //< > if ( iTicket < 0 ) iTryOpen () ; //< > else iTryClose () ; //< > // </2.2.3.2. Main routine 3 >````````````````````````````````````//< > // //< > // < 2.2.3.3. Exception handler 2 >```````````````````````````````//< > int iTrap = GetLastError () ; //< > if ( iTrap > 0 ) Alert ( "Exception " , iTrap ) ; //< > // </2.2.3.3. Exception handler 2 >```````````````````````````````//< > } //< > // </2.2.3. Code : Special : Start > //< > ////////////////////////////////////////////////////////////////////< 0>
Liste complète des changements :
1. La valeur initiale du facteur de prise de profit virtuel "double dFactorTP = 1.0 ;" a été modifiée.
2. Le domaine "Data : Buffer" a été supprimé.
3. La fonction "iNewBar ()" a été supprimée. 4.
4. La fonction "iSignalOpen ()" a été modifiée.
5. La fonction "iSignalClose ()" a été modifiée.
Dernière modification : 2010.03.18 20:47
Etat : Prêt
Merci de partager votre système.
C'est un sacré système de codage que vous avez là. vous avez une discipline incroyable :) est-ce que vous le tapez dans excel, pour l'aligner ?
Ais,
Merci de partager votre système...
C'est un sacré système de codage que vous avez là. vous avez une discipline incroyable :) est-ce que vous le tapez dans excel, pour l'aligner ?
C'est peut-être une question stupide, mais je suis très curieux :))
PS. Huckleberry, merci de continuer à faire vivre ce site.
Bonjour Cameofx,
Merci pour votre réponse.
Ce système de codage est très simple et facile.
Tout est fait manuellement dans MetaEditor.
En fait, le système est conçu pour développer de grands programmes facilement et à grande vitesse.
Le système devrait également être flexible et fiable.
Meilleures salutations !