| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Empty4 v600 for Coders https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3439 |
Page 2 of 5 |
| Author: | milanese [ Tue Feb 18, 2014 12:35 pm ] |
| Post subject: | Re: Empty4 v600 for Coders |
The new build uses Unicode strings, not Ansi strings. Look here for more informations...http://forum.mql4.com/60608#903603 Cheers Tommaso |
|
| Author: | Pedigree [ Tue Feb 18, 2014 3:00 pm ] |
| Post subject: | Re: Empty4 v600 for Coders |
Will have a look, Tommaso. Thanks a million! |
|
| Author: | Pedigree [ Thu Feb 20, 2014 10:08 am ] |
| Post subject: | Re: Empty4 v600 for Coders |
Now that's putting it mildly. Just don't mention the monstrous distraction all this is turning out to be. |
|
| Author: | fxdaytrader [ Sun Feb 23, 2014 3:10 pm ] |
| Post subject: | Empty4 v600 for Coders |
For those which want to use the old < build 600 compiler version (e.g. to compile code which cannot be compiled with the newest versions) you may have a look to my thread at http://www.forexfactory.com/showthread.php?t=470340 (download the .zip there pls, I am not sure if it is too big to be uploaded here). [mod=]Ok here is the file attached, thank you fxdaytrader Cheers Tommaso[/mod] |
|
| Author: | JvW [ Mon Feb 24, 2014 12:58 am ] |
| Post subject: | Empty4 v600 for Coders |
Hi all, just my 2 cents worth on the build 600: 1) in Empty4 pre v600 you could do naughty things like this: string S1; S1 = "some text:"; S1 = S1 + " new text"; resulting in S1 acquiring the value "some text: new text"; Unfortunately - you can no longer do this, and if you have any code that relies on this, it will no longer work. The solution to resolve the issue is simple (which is cleaner anyway): string S1, tmp=""; S1 = "some text"; tmp = S1; S1 = tmp + "new text"; 2) I may be wrong in understanding but I have tested the following: IndicatorCounted(): Returned value - The amount of bars not changed after the indicator had been launched last. prev_calculated: 'We should noted the connection between the return value of OnCalculate() and the second input parameter prev_calculated. During the function call, the prev_calculated parameter contains a value returned by OnCalculate() during previous call. This allows for economical algorithms for calculating the custom indicator in order to avoid repeated calculations for those bars that haven't changed since the previous run of this function. For this, it is usually enough to return the value of the rates_total parameter, which contains the number of bars in the current function call. If since the last call of OnCalculate() price data has changed (a deeper history downloaded or history blanks filled), the value of the input parameter prev_calculated will be set to zero by the terminal.' Both in strategy tester and on live data I see the following values produced by Empty4 v600: on NewBar: Bars == rates_total, prev_calculated == rates_total-1, IndicatorCounted() == prev_calculated-1 during bar: Bars == rates_total, prev_calculated == rates_total, IndicatorCounted() == prev_calculated-1 and this is regardless of whether OnCalculate() has a return(x) with x=rates_total, x=prev_calculated, x=0, x=1, x=-1. Somehow it appears that the return value from OnCalculate is not used in any way....(but I may be dumb You can use the following code in an indicator to test this behaviour. Code: Select all loopcount = Bars-IndicatorCounted() [shorthand LC=B-IC] or loopcount = rates_total-prev_calculated [shorthand LC=RT-PC] you will notice that the behaviour is slightly different: on Newbar: RT-PC = 1, and B-IC = 2 during bar: RT-PC = 0, and B-IC = 1. Obviously, and dependent on your indicator code, when porting your code to the new v600 environment this difference in loopcount may have an impact on how and when your indicator gets updated! Cheerio, John |
|
| Author: | milanese [ Mon Feb 24, 2014 1:48 pm ] |
| Post subject: | Empty4 v600 for Coders |
http://www.stevehopwoodforex.com/phpBB3 ... 774#p86774 I edited the post and uploaded the file , again thank you fxdaytrader Cheers Tommaso |
|
| Author: | jcl [ Sun Mar 02, 2014 6:20 pm ] |
| Post subject: | Empty4 v600 for Coders |
Strings have now a completely different format and use Unicode, not ASCII. If you pass and receive strings from external DLLs, you must now convert them to ASCII before, with CharArrayToString() and StringToCharArray(). The trick to trigger an EA by posting a message to the chart window does not work anymore as before. You now need a Unicode message. Previously; msg = RegisterWindowMessageA("MetaTrader4_Internal_Message"); From 600+ on: msg = RegisterWindowMessageW("MetaTrader4_Internal_Message"); |
|
| Author: | renexxxx [ Sat Mar 08, 2014 6:19 am ] |
| Post subject: | Empty4 v600 for Coders |
Further on the subject of concatenating strings with integers, doubles and other strings, there is a new function called: Code: Select all So, you can do things like: Code: Select all |
|
| Author: | SpiderX [ Sat Mar 29, 2014 4:34 am ] |
| Post subject: | Empty4 v600 for Coders |
Hi all, Still doing my best to keep this updated. Please give me a nudge if you feel something could be added to the first post. Cheers |
|
| Author: | SpiderX [ Sat Mar 29, 2014 7:30 am ] |
| Post subject: | Empty4 v600 for Coders |
This is a helpful article for coders: http://articles.mql4.com/1160?source=me ... r5_article Cheers |
|
| All times are UTC | Page 2 of 5 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|