Apr 14 2006, 14:59
Post
|
|
|
|
Hello tout le monde,
Voilà je me permets de vous soumettre un outil de ma composition qui permet de convertir des experts, indicateurs ou fonctions en MQL II donc pour metatrade 3 en MQL 4 pour Metatrade 4. Voici le change log depuis la dernière version. Version 0.6: - Compatibilité améliorée - Ajout des butons MetaEditor et Terminal - Ajout de l'info sur le type de script - Correction d'un bug sur la sauvegarde et compilation Merci de vos observations. Lien pour télécharger |
Apr 15 2006, 18:13
Post
|
|
|
|
Dieupip, j'ai fait donc la modif dans mon logiciel et converti ton indicateur.
J'ai dû cependant effectuer une correction manuelle, en effet, ta variable "l3" peut avoir comme valeur "0" et comme "l3" est utilisé comme diviseur dans le SetIndexValue, on a donc une exception "Zero divide", pour éviter celà j'ai simplement rajouté un test juste avant le SetIndexValue. En fait la conversion se faisait "correctement" même si j'ai découvert un bug, c'est simplement que maintenant sous Metatrader 4 dès qu'il y a une exception ca bloque tout !!! :-( alors qu'avant non, une division par 0 arff pas grave CITATION #include <stdlib.mqh> //+------------------------------------------------------------------+ //| .mq4 | //| | //| | //| Converted by Mql2Mq4 v0.6 | //| http://yousky.free.fr | //| Copyright © 2006, Yousky Soft | //+------------------------------------------------------------------+ #property copyright " Copyright © 2003, MetaQuotes Software Corp." #property link " http://www.metaquotes.ru/" #property indicator_separate_window #property indicator_color1 Red #property indicator_buffers 1 //+------------------------------------------------------------------+ //| Common External variables | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| External variables | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| Special Convertion Functions | //+------------------------------------------------------------------+ int LastTradeTime; double ExtHistoBuffer[]; void SetIndexValue(int shift, double value) { ExtHistoBuffer[shift] = value; } //+------------------------------------------------------------------+ //| End | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| Initialization | //+------------------------------------------------------------------+ int init() { SetIndexStyle(0, DRAW_LINE, STYLE_SOLID); SetIndexBuffer(0, ExtHistoBuffer); return(0); } int start() { //+------------------------------------------------------------------+ //| Local variables | //+------------------------------------------------------------------+ int shift = 0; double l1 = 0; double l2 = 0; double l3 = 0; double cnt = 0; double sum = 0; double loopbegin = 0; bool first = True; double prevbars = 0; /*[[ Name := Test ecart boll Author := Copyright © 2003, MetaQuotes Software Corp. Link := http://www.metaquotes.ru/ Separate Window := Yes First Color := Red First Draw Type := Line First Symbol := 217 Use Second Data := No ]]*/ if( Bars < prevbars || Bars-prevbars>1 ) first = True; prevbars = Bars; // loopbegin prevent counting of counted bars exclude current if( first ) { loopbegin = Bars; if( loopbegin < 0 ) return(0); // not enough bars for counting first = False; // this block is to be evaluated once only } // convergence-divergence loopbegin = loopbegin+1; for(shift =loopbegin;shift >=0 ;shift --){ l1=iBands(NULL, 0, 20, 2, 0, PRICE_CLOSE, MODE_HIGH, shift); l2=iBands(NULL, 0, 20, 2, 0, PRICE_CLOSE, MODE_LOW, shift); l3=iBands(NULL, 0, 20, 2, 0, PRICE_CLOSE, MODE_MAIN, shift); if (l3 != 0) SetIndexValue(shift,(l1-l2)/l3); else SetIndexValue(shift,0); } return(0); } Voilà Yousky |
|
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
3 | oval | 2,463 | 17th October 2005 - 6:27 Last post by: oval |
|||
![]() |
21 | sdfx | 10,798 | 11th November 2006 - 12:40 Last post by: sdfx |
|||
| Lo-Fi Version: Mql2mq4 V 0.6 (outil De Convertion) - Forex Forum |



Apr 14 2006, 14:59

