
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
////////////////////////////////////////////////////////////////////< 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>
Complete list of changes:
1. Initial value of virtual take profit factor "double dFactorTP = 1.0 ;" has been changed.
2. Domain "Data : Buffer" has been deleted.
3. Function "iNewBar ()" has been deleted.
4. Function "iSignalOpen ()" has been changed.
5. Function "iSignalClose ()" has been changed.
Last edit: 2010.03.18 20:47
State: Ready
Thanks for sharing your system..
That is some coding system you have there. you have unbelievable discipline :) do you type it in excel, to get it aligned?
Ais,
Thanks for sharing your system..
That is some coding system you have there. you have unbelievable discipline :) do you type it in excel, to get it aligned?
maybe this is a stupid question, but I'm curious as hell :))
PS. Huckleberry thanks for keeping this going.
Hello Cameofx,
Thanks for kind response.
This coding system is very simple and easy.
All done manually in MetaEditor.
In fact, the system is being designed to develop large programs easily and with high speed.
The system should be also flexible and reliable.
Best regards!