| 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 | Display Modes |
|
|||
|
I still have question with IndicatorCounted().
In the function start() which is executed everytime new tick is delieved (right?),
function counted_bars = IndicatorCounted() is executed, which means counted_bars is always Bars -1, after line counted_bars--, counted_bars will be equal to Bars - 2, so pos should be equal to 2. But it seems not. What is the problem? |
|
|||
|
It really confirms my doubt.
I tested the values of counted_bars and Bars. The first time the function start() runs,Bars already a big number, but counted_bars is 0, so pos is a large number. After that, I found when new bar first appears,
the Bars increases by 1, the counted_bars keeps the same, so the pos is 3, when the new tick is delievered, the pos will be 2 (Bars keeps the same, counted_bars increases by 1 but keeps the same later). Now my question is: Every time the new bar first appears, pos = 3, so the ExtMapBuffer1[3], ExtMapBuffer1[2], ExtMapBuffer1[1], ExtMapBuffer1[0] will be updated, other ExtMapBuffer1 elements will keep the same. What's the point for that???? Anybody bother to give me a hint? I hate to see the magic buried in the MQL4. Last edited by blooms; 01-25-2006 at 09:04 PM. |
|
|||
|
How does MQL4 deal with the buffer?
My guess is when Bars changes (it always increase by 1), the indicator value
for the new bar to be shown in the windows will be always ExtMapBuffer1[0], others will be rotated from low to high one-by-one??? |
|
|||
|
The interesting thing that I found is when I remove the line
Code:
if(counted_bars > 0) counted_bars--; Code:
if(counted_bars > 0) counted_bars++; I think now I got the answer. All corrections are WELCOME! Last edited by blooms; 01-25-2006 at 09:37 PM. |
|
|||
|
hi
Quote:
=================== Forex Indicators Collection |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Lesson 9 - Preprocessors | codersguru | Lessons | 7 | 05-18-2006 08:26 PM |
| Lesson 17 - Your First Script | codersguru | Metatrader 4 mql 4 - Development course | 0 | 01-04-2006 11:37 PM |
| Lesson 11 - Your First Indicator (Part2) | codersguru | Lessons | 8 | 12-30-2005 02:20 PM |
| Lesson 2 - SYNTAX | codersguru | Lessons | 7 | 12-18-2005 12:57 PM |
| Lesson 10 - Your First Indicator (Part1) | codersguru | Lessons | 1 | 11-08-2005 11:17 PM |