| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Utility Procedures / Code Snippets https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=166 |
Page 6 of 7 |
| Author: | AnotherBrian [ Thu Sep 17, 2015 1:28 am ] |
| Post subject: | OnTimer() or start() |
I've started to use the OnTimer() instead of start(). I do this because running my EA only needs to happen once in a while. For example - placing pending orders once a day. I set it to run once every minute. The problem is that OnTimer() doesn't run in Strategy Tester so you cant check code execution. Here is how I solved that. All comments welcome, trying to improve and understand. Code: Select all |
|
| Author: | renexxxx [ Thu Sep 17, 2015 2:13 am ] |
| Post subject: | OnTimer() or start() |
Hi Brian, That code is fine, as long as you understand that in the tester, Main() is called for every tick, whereas, when the EA is run in a normal forward test, Main() is only called every x-seconds. You could do something like this in start() Code: Select all |
|
| Author: | AnotherBrian [ Thu Sep 17, 2015 4:06 am ] |
| Post subject: | Utility Procedures / Code Snippets |
Thanks Renexxxx; Yes, I understand that. Your mod is interesting, that would make that backtester behave more like a forward test (even though backtesting is crap, the goal is simply to check the execution). Thanks Renexxxx, once again, your a code god. Hope this helps other coders. |
|
| Author: | DigitalCrypto [ Mon Jan 04, 2016 12:43 pm ] |
| Post subject: | Utility Procedures / Code Snippets |
Edit: Didn't include right code or pic. Is now fixed for $1 pip example given. One thing I almost always forget to do is price the pips correctly when looking to enter a position. This is a snippet of code you can use to determine what the minimum pip value should be to return 1:1 per pip movement. $1 Pips is the minimum position size you should use to enter the position for a $1USD (or your base currency) per pip return. In this example ATC Brokers minimum lot size is 0.05. So in order to see a 1:1 return per dollar we simply double the minlot cost to 0.14 and multiply by the intended dollar return we would like to have per pip. Maybe someone has better math than I do. I always round up. Nothing like a little freebie here and there! Code: Select all |
|
| Author: | DigitalCrypto [ Wed Jan 27, 2016 11:52 am ] |
| Post subject: | Fix FXCM's Broken Ask Line |
FXCM's Empty4 Terminal still reflects their old pricing models. They said it cannot be fixed for standard accounts because customers around the world are still using the old price models but have worked around the problem by using Market watch Bid/Ask. However when enabling the Ask line on the platform it does not reflect this change. So here's a quick fix for anyone else that may have this issue. First turn off the Ask line in the console properties then we can add the following code to our experts and indicators Make it user selectable Code: Select all Code: Select all Code: Select all |
|
| Author: | AnotherBrian [ Tue Feb 02, 2016 7:35 pm ] |
| Post subject: | Utility Procedures / Code Snippets |
If you want the chart set up a certain way when the EA starts, put this code in, and adjust to your needs. The following give you a blank chart with yellow foreground. No time or price, no grids, no price. I use this for a multi-pair so I want a blank screen. I just discovered this a week ago... Code: Select all |
|
| Author: | DigitalCrypto [ Wed Jul 20, 2016 4:00 am ] |
| Post subject: | Utility Procedures / Code Snippets |
A friend turned me on to a nice coding font called Inconsolata. Give it a try and see what you think. Since I am bad with remembering names a bit of word association got me to thinking about "in console latte". Yeah it's smooth like that... It also gives EA HUDs and Indicators a smoother more professional look IMHO. Main site with GitHub link http://levien.com/type/myfonts/inconsolata.html |
|
| Author: | DigitalCrypto [ Sun Aug 21, 2016 8:00 pm ] |
| Post subject: | Common function shortcuts to speed up coding |
I think if I type any more long MQL functions I will go nuts. Here's a more efficient way if you want shortcuts. I started creating small functions to abbreviate all that crap because I don't really want carpal tunnel syndrome again. I may throw it all into an include file for later or just tag it at the bottom of the scripts. Code: Select all |
|
| Author: | DigitalCrypto [ Fri Jun 30, 2017 12:56 am ] |
| Post subject: | Utility Procedures / Code Snippets |
I've grown really accustomed to the onscreen hud display. I use it for everything. Of course when I am running many charts on the same terminal it's hard to put everything I need to see in a small place. I ventured out to see what I could do about it and wanted to contribute a small piece of code that I implemented for Trading Timeframe and Trading Directions so they use only a single line on the screen. Concept ======= First test long or short are true to remind me that I may be in operating ID10T mode If pass then display TradingTimeframe and Trading Direction(s) Code: Select all - David |
|
| Author: | DigitalCrypto [ Sat Nov 11, 2017 11:16 am ] |
| Post subject: | Finding the trend |
Here's a function I wrote to determine a market trend using a higher timeframe without relying on any indicators. Code: Select all |
|
| All times are UTC | Page 6 of 7 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|