| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Setup Scanner https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=1635 |
Page 1 of 1 |
| Author: | onedognight [ Sun Mar 17, 2013 8:16 am ] |
| Post subject: | Setup Scanner |
Hi people. Here is a bit of 'make life easier' code. Setup Scanner (ss) The idea behind these chunks of code is this. You dream up a strategy based around some long trade setups, some short trade setups and some stay-out-of-it setups. You code your setups and embed your code within the chunks of code that I supplied. You make a couple of easy mods. You end up with a couple of indicators. One will point out historically on the current chart where your setups arose (the bottom indicator in the screen shot above). The other will show on a panel whether, for all of the instruments and timeframes in which you are interested, the setups have currently arisen. This saves you from having to manually scan pairs and timeframes looking for your setups (see the right hand chart in the screen shot). The zip file contains several documents. Those whose name begins with ss_ are documents that you should not have to alter. Those whose name begins with ssXXXX_ are patterns which you can modify to supply your own code. Those beginning with ssPP or ssMAX make up two examples. One is an ema cross-over strategy (setup identifier = "MAX") and the other is based on Power Pro (setup identifier = "PP") which was being pushed around the traps by Russ Horn. It is a band break-out strategy where the upper band limit is an ema of highs and the lower limit is an ema of lows. There is absolutely no endorsement of these strategies by me - they are there purely as examples of what you can develop. To install, download, unzip and distribute the bits of code into appropriate folders as dictated by their extensions (mq4 and ex4 to experts\indicators, mqh to experts\include, tpl to the templates folder - the one on the same level as the experts folder, not the one underneath the experts folder). Some caveats: Use at your own risk. There are hardly any 'extern's. To demonstrate what the scanner does: Reduce or increase the number of charts in your current window to two. Tile them vertically. On the Right-hand Chart Make it EURUSD or other high tick rate instrument (any time frame - doesn't matter). Change template to ss_blankivory (as supplied). Make it narrower (approx 1/3 of window width). On the Left-hand Chart Make it wider. Remove any objects and indicators that are not relevant. You can leave in place some general purpose indicators like 'spread' and 'candle timer' - up to you. Apply template ssPP to the left hand chart. Apply indicator ssPP_Panel to the right hand chart. The code common to all strategies: ss_Utils.mqh contains some utility functions which can be used in any indicator, expert adviser, etc. ss_Chart.mqh contains almost all of the code which goes into the current-chart indicator. ss_Panel.mqh contains almost all of the code which goes into the panel display indicator. The code specific to the MAX (moving average crossover) strategy: ssMAX_ind.mq4 is a custom indicator which displays two moving averages. It is completely self-contained. ssMAX_Chart.mq4 is the indicator which shows what happened historically on the current chart. ssMAX_Panel.mq4 is the indicator which shows the current situation on all of the pairs and timeframes in which you are interested. ssMAX_GetBarFlag.mqh is the code "included" in both the Chart and Panel indicators. It is the bit that decides whether there is a setup at a particular bar. The code specific to the PP (Power Pro) strategy: ssPP_ind.mq4 displays the relevant "chart-window" indicators. ssPP_ind1.mq4 displays the relevant "separate-window" indicators. ssPP_Chart.mq4, PP_Panel.mq4 and PP_GetBarFlag.mqh do the equivalent same thing as for the MAX strategy above. I included two strategies because MAX is trivial but easier to understand while PP is more complex. Some features of the software: The code was written as indicators so that, when a panel is on display and you want to look at a particular pair and timeframe, you just pick the pair from the Market Watch window, drag and drop it onto the current chart space of the left hand chartand change the timeframe to suit. The template looks after the rest. In an effort to reduce computer overload, I did two things. Firstly, when dealing with time-series arrays, I mostly only go back 200 bars. Secondly, the panel display software doesn't test the user's setups at every tick. It uses a timer mechanism such that testing is applied to bar[0] only if bar[0] is 90% formed, otherwise testing is applied to bar[1]. If bar[1] has the focus (i.e. bar[0] is less than 90% formed), it is tested once and a changeover to bar[0] time is calculated. For every subsequent tick that comes along until the changeover time is reached, nothing happens. I am not 100% sure that I have got this coded up right yet but it seems to work pretty good. Further to the timer mechanism mentioned above, the top line of the panel shows the date and time that the most recent setup-testing event occurred. Also, in the examples supplied here, the neutral wingdings will show a zero if bar[0] is in focus and a '1' if bar[1] is in focus. How I go about coding a new strategy: I decide on a strategy identifier (eg Good1). I set my window up as above under "To demonstrate what the scanner does" (except for the last two steps). If my new strategy relies on on-chart indicators, I build them using ssXXXX_0.mq4 as a pattern. I remember to 'save as...' ssGood1_0.mq4. I apply my custom indicator to the left hand chart. If I need a separate window indicator, I build it too. I remember to 'save as...' ssGood1_1.mq4. I apply it to the left hand chart. I build custom indicators rather than standard indicators so that I can refer to them elsewhere using the iCustom function. This way, if I change my mind about the basic parameters of my strategy (eg moving average method) I only have to change my custom indicators. If I used standard indicators, I would have to change them and then go digging into the bowels of my code to accommodate my mind change. I grab ssXXXX_Chart.mq4, replace all instances of 'XXXX' by my strategy identifier 'Good1', and save the code as ssGood1_Chart.mq4. It wont compile yet because there is some "include" code still to be written. Now to provide the "include" code. If the setups for which I want to test are dead easy, I just use the "include" file ssXXXX_GetBarFlag.mqh, code up what I want, and 'save as...' ssGood1_GetBarFlag.mqh. But if the coding is tricky, I go back to the ssGood1_Chart.mq4 that I previously created, I comment out the line of code that now reads "#include <ssGood1_GetBarFlag.mqh>, and I build the code I want directly within the ssGood1_Chart.mq4 document. When I've got it clean, I move/paste the setup-finding code to the "include" document 'ssGood1_GetBarFlag.mqh' and un-comment the #include statement in the 'ssGood1_Chart.mq4 document. Now the 'ssGood1_Chart.mq4' document can be compiled and applied to the left hand chart. At this point, I save the template for the left hand chart as ssGood1.tpl. It incorporates any on-chart custom indicators, separate-window custom indicators, and the plot of results as they apply to the current chart. I load the document 'ssXXXX_Panel.mq4', replace all instances of "XXXX" by "Good1", then 'save as...' "ssGood1_Panel.mq4". This last document is compiled and applied to the right hand chart. It can be a bit slow to run when first applied but doesn't use much resource when running. NOTE: When building custom indicators and then referring to them with the iCustom function, I take care that the names are exactly right. You get no warning if iCustom refers to an indicator that doesn't exist. NOTE: There may be a bug such that when the panel indicator is first loaded, it produces results which are not consistent with those on the specific chart on display. I find that if I change the timescale on the panel window (thus forcing a re-calc), everything comes out right. NOTE: In the ...GetBarFlag.mqh code which you develop yourself, you can return any integer to the calling program to be displayed. As the code stands, zero means 'no result' and causes display of a gray wingding indicating which bar was tested. Returning a negative integer will result in a red display while a positive integer will result in a green display. Have fun. |
|
| Author: | Jemook [ Sun Mar 17, 2013 9:07 am ] |
| Post subject: | Re: Setup Scanner |
Now that's how you do a first post |
|
| Author: | monkeh [ Sun Mar 17, 2013 2:12 pm ] |
| Post subject: | Re: Setup Scanner |
im sure with this awsome tool some talented people may create some super dashboards. i wish i was one thank you very much for it! |
|
| All times are UTC | Page 1 of 1 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|