| New signals service! | |
|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
|
|
LinkBack | Thread Tools |
|
|
||||
|
||||
|
Quote:
If you have the indicator source code, it's sometimes easier to peep into it, and learn the buffer indexes from the SetIndexBuffer function calls. As a point on the side: an indicator may also plot "objects" onto the display, and those are not accessible via the iCustom call. Instead you'll need to know the "object name", and can the read off its properties. Thus, you always need to be clear about which indicator buffer to read off, and use that index as the second last argument to iCustom. For example, the use of the VQ indicator does not seem quite right, because (going by the source I've sighted), its buffers [1] and [2] are used for the green and red lines respectively, and there is never a case where they are both non-empty. I.e., "Up2==Down2" is always false, except when both are "empty", and that's when the VQ line is neither green nor red, but yellow. Apart from that, I think you are doing things in the right way. One can discuss choice of variable names, of course, but that's academic. The way to go is to pick the values of interest using the iCustom call, then express the particular required value relationships in the trading conditions. |
|
|
||||
|
||||
|
Quote:
Thanks |
|
|
||||
|
||||
|
Lack of source is not a problem. Let's focus on indicator window 2 in your image, which shows an indicator with 4 buffers. If you move the mouse left and right over the indicator, you can work out which buffer is used for which color.
Let me assume that the first buffer ([0]) is for the blue indication of the top line, the second buffer ([1]) is for the red indication of the top line, and likewise [2] and [3] are blue and red of the bottom line. You could then read off the indicator as follows: PHP Code:
PHP Code:
if you want to combine non-concurrent readings of the two lines, it might become more involved coding. For example, the boolean variable "both_go_blue" refers to concurrent readings of the two lines, and does not capture that "one line goes blue, and then other goes blue a little later". Last edited by ralph.ronnquist; 02-05-2008 at 12:35 AM. Reason: revised variable names |
|
|
||||
|
||||
|
Quote:
PHP Code:
Last edited by ralph.ronnquist; 02-05-2008 at 12:55 AM. Reason: added a caveat |
|
|
||||
|
||||
|
Ok, thank you for your clear explanations. I should be able to get it now
![]() One last thing, how would I code it if I didn't only want to compare the Current and Previous bars but wanted to say "if signals agree within that last 2-4 bars then still create the BUY condition" no more than 4 bars difference of when the indicators agree with each other? That would change the whole coding logic of the EA, correct? EDIT: also, what did I do to create a condition where the EA triggered a BUY when One indicator signaled and the other indicator didn't signal but was at least in agreement and going in the same direction, BUY trade was still triggered ?? Last edited by matrixebiz; 02-05-2008 at 01:14 AM. |
|
|
||||
|
||||
|
Quote:
For (2), you would, or I would, use a code snippet to scan backwards for the transitions, e.g. like (in principle): PHP Code:
Quote:
...It involves a) to represent the "right direction" concept, and then have a disjunctive condition of the form: PHP Code:
PHP Code:
|
| Bookmarks |
| Tags |
| icustom, icustom function |
| Thread Tools | |
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Easy iCustom and Alerts! | codersguru | Indicators - Metatrader 4 | 50 | 09-18-2008 02:02 PM |
| iCustom question .. | yaniv_av | Indicators - Metatrader 4 | 16 | 06-20-2008 05:37 PM |
| icustom | maje | Questions | 24 | 12-05-2007 10:26 AM |
| I need help on creating an Icustom statement for my EA using this indicator as input! | iscuba11 | Expert Advisors - Metatrader 4 | 4 | 09-11-2006 08:18 PM |
| iCustom() problem | billritz | Indicators - Metatrader 4 | 5 | 08-23-2006 08:22 AM |