[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 285
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Right. I think I've finished. Here's the reworked tick collector with its packing them into second candles.
It was:
Became:
Comments on the code.
1. Didn't make switch-case in virtual candlestick selection to save CPU time, instead commented out sections with selection (since selection is done for specific needs once before compilation).
2. On work with local time (off-line that is) not brought to mind. In the"while(time==TimeLocal()){//until one second has passed" loop, I suspect there must beMarketInfo in FileWriteDouble (sounds like the top of an idiot to me). If you tell me what would look more logical there, I will be grateful.
3. An author's construct
I've declared it at the very end of init().
4. At the beginning of init() dynamic arrays
instead of used variables.
5. For optimization, you can theoretically use WinAPI file functions and write to the history at once in block 44 bytes (length of MarketInfo structure or whatever it is in .hst).
6. Completely removed author's modeling of time for writing to the Time[] cell. For the same reason, in head while loop there is no check for TimeLocal(), only for TimeCurrent().
7. What else do you suggest to optimize the code?
From point 4 it must be understood that you were making an indicator, then such actions are not clear:
ArrayInitialize() is most likely suitable?!
And most likely, you should refuse to use indicator arrays.
ArrayInitialize() probably works?!
ArrayInitialize(ask, EMPTY_VALUE); you mean? I didn't. Why did I cut it down exactly, I was afraid of such a case:
(a, b, c)//values in ask after three ticks per second (fantastic, but let's suppose).
ArrayInitialize(ask, 0);//be (0, 0, 0)
FileWriteDouble(hand1e, ask[ArraySize(ask)-1], DOUBLE_VALUE);//Close[]
- The Close cell will get 0. That's why I'm re-defining the size to prevent this from happening. Check ArrayInitialize(ask, EMPTY_VALUE);.
TarasBY:
You have to stop using indicator arrays.They're dynamic, that's what I fell for. Fewer commands, fewer number of processor cycles. You have to do 500 milliseconds of processing at any theoretically possible f... ...to get it done.
ArrayInitialize(ask, EMPTY_VALUE); you mean? I didn't. I was afraid of such a case, that's why I started to cut it down:
(a, b, c)//values in ask after three ticks per second (fantastic, but suppose).
ArrayInitialize(ask, 0);//be (0, 0, 0)
FileWriteDouble(hand1e, ask[ArraySize(ask)-1], DOUBLE_VALUE);//Close[]
- The Close cell will get 0. That's why I'm re-defining the size to prevent this from happening. ArrayInitialize(ask, EMPTY_VALUE);; check them.
They are dynamic, that's what I fell for. Fewer commands, fewer number of processor cycles. You have to manage 500 milliseconds of processing at any theoretically possible bottleneck... ...to get it done.
That's not what I mean: something tells me that you won't manage to shrink the indicator array. Besides, if there are unfilled cells in such array, there's ALWAYS some value there: 0 or EMPTY_VALUE, and what do you get in these calculations:
And by general logic: I would run the whole tick collection in a loop and separately control the time and, as soon as the "new bar" time has passed, write it to the file, zeroing and clipping the working arrays in the process.If i know, is it possible to change Send and Close orders in advisor to call up trade window manually and enter the market through this window, it is necessary for those brokers who do not allow using of advisors
And by general logic: I would run the whole tick collection in a loop and separately control the time and, once the time for the "new bar" has passed, write it to the file, zeroing and clipping the working arrays in the process.
Strange... I have it that way... The only thing is that the time is controlled in the tick collection cycle itself, and the working array is not clipped until a copy of the tick has been drawn as many times as there have been no ticks minus one second. One second passed - a new tick is drawn, two - a copy of the previous tick and a new tick, three - two copies of the previous tick and a new tick, etc. Instead of copies of the previous tick it is possible to draw a dash by the Close level, this variant is commented in the code.
Strange... I have it like this... The only thing is that the time is controlled in the loop itself, and the working array is not clipped until a copy of the tick is drawn as many times as there were no ticks minus one. One second passed - a new tick is drawn, two - a copy of the previous tick and a new tick, three - two copies of the previous tick and a new tick, etc. Instead of copies of the previous tick it is possible to draw a dash by the Close level, this variant is commented in the code.
You and I are talking about different cycles. I'm talking about this:
Can anyone tell me how to remove the zeros after the decimal point? I have 4 decimal places in my code for some reason. Here is the code. string l_dbl2str_12 = DoubleToStr(g_ibuf_140[0] - g_ibuf_144[0],3);
Can you tell me what I'm doing wrong...
I need a variable of double type to contain the date as 0,20130429164459 (meaning 2013.04.29 16:44:59)
Part of the EA code:
Event log for Precision 12,13 and 14 gives wrong result, see picture