Custom symbols. Errors, bugs, questions, suggestions. - page 12

 
fxsaber:

Bug 16.

Previously, CustomTicksAdd generated bars from ticks that referred to the current day. This is not the case now either.

This bug seems to be related to bug #14.

The removal of the symbol from the market overview is possible for the following reason. Calling consecutively CustomSymbolCreate - CustomSymbolDelete - CustomSymbolCreate with the same custom symbol name was causing the symbol ID to be hit. Therefore, when checking whether a symbol can be removed from the market overview, the graph of this symbol was not found (the identifier is corrupted), and the symbol was safely removed. This has been fixed.

When applying a tick to a chart, the same thing is possible - searching for the chart by the symbol identifier did not give a result

 
fxsaber:

Bug 15.

We run the following indicator on the symbol of this EA (with ChartSetSymbolPeriod-row removed)

It produces only zeros.

Fair enough.

Calling CustomRatesUpdate resets all change counters and recalculates indicators from zero

 
Slava:

Quite rightly so.

When you call CustomRatesUpdate, all change counters are reset and indicators are recalculated from zero

What is the logic behind this solution? After all, there are unchanged bars on the left.

 
fxsaber:

What is the logic behind this solution? After all, there are invariant bars on the left.

prev_calculated contains a value that was returned on previous OnCalculate call

Indicator can return any value based on its own logic. Therefore, there is no sense to run through all indicators and change the value of prev_calculated to its own calculated value taking into account the timeframe. And it is resource-intensive, may even be unreasonably resource-intensive.

It's much more honest to set it to 0, as in the beginning, when nothing was counted yet

 
Slava:

prev_calculated contains the value that was returned on the previous call to OnCalculate

Indicator writer can return any value based on its own logic. Therefore, there is no sense to run through all indicators and change the value of prev_calculated to its own calculated value taking into account the timeframe. And it is resource-intensive, may even be unreasonably resource-intensive.

It's much more honest to set it to 0, as in the beginning, when nothing was counted yet

Then what to do, when indicators on a custom symbol after each tick rollover are completely recalculated because of this zero value?

Indicators are specially written not to slow down the Terminal, and here it starts the opposite.

 
fxsaber:

Then what about when, on a custom symbol, after each tick rollover, the indicators are completely recalculated because of this zero value?

This shouldn't be the case. Check

 
Slava:

It shouldn't be like that. Check

Let me clarify that it's not only CustomTicksAdd, but also RatesUpdate, which is a tick-through from the past. In fact, even the working TicksAdd did not form the bars earlier than the current day. We have to form them by ourselves. And we get zero prev_calculated because of it.

 
fxsaber:

To clarify, it is not only CustomTicksAdd, but also RatesUpdate, which is a tick-through from the past. In fact, even the working TicksAdd did not form the bars earlier than the current day. We have to form them by ourselves. And we get zero prev_calculated because of it.

Anyway, when replacing, refreshing or deleting bars, all indicators will be recalculated from zero. This is out of question.

The addition of ticks should work as usual, i.e. ticks are fresh, current ticks, but not ticks from yesterday/the day before.

I have run your Expert Advisor from bug 11 description and then run the indicator with a print on each OnCalculate

Here are the logs.

2019.06.07 08:11:34.240 CustomHistoryTick (EURUSD,H1)   CustomSymbolCreate(Name,NULL,_Symbol) = true
2019.06.07 08:11:34.243 CustomHistoryTick (EURUSD,H1)   CustomRatesDelete(Name,0,0) = 0
2019.06.07 08:11:34.243 CustomHistoryTick (EURUSD,H1)   SymbolSelect(Name,false) = true
2019.06.07 08:11:34.243 CustomHistoryTick (EURUSD,H1)   CustomSymbolDelete(Name) = true
2019.06.07 08:11:34.243 CustomHistoryTick (EURUSD,H1)   CustomSymbolCreate(Name,NULL,_Symbol) = true
2019.06.07 08:11:34.321 CustomHistoryTick (EURUSD,H1)   CopyTicksRange(_Symbol,Ticks,COPY_TICKS_INFO,(TimeCurrent()-3600)*1000) = 1114
2019.06.07 08:11:46.158 Custom Moving Average (EURUSD11608,M1)  13  prev_calculated=0  begin=0  data=1.126668940063615
2019.06.07 08:11:46.173 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=13  begin=0  data=0.2989269387755102
2019.06.07 08:11:46.209 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.2989283673469387
2019.06.07 08:11:46.228 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.2989297959183673
2019.06.07 08:11:46.246 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.2989312244897959
2019.06.07 08:11:46.271 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.2989312244897959
2019.06.07 08:11:46.305 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.2989283673469387
2019.06.07 08:11:46.399 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.2989269387755102
2019.06.07 08:11:46.427 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.2989255102040816
2019.06.07 08:11:46.460 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.2989269387755102
2019.06.07 08:11:46.494 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.2989255102040816
2019.06.07 08:11:46.521 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.2989269387755102
2019.06.07 08:11:46.561 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.2989283673469387
2019.06.07 08:11:46.586 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.2989283673469387
2019.06.07 08:11:46.614 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.2989297959183673
2019.06.07 08:11:46.645 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.2989283673469387
2019.06.07 08:11:46.676 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.2989297959183673
2019.06.07 08:11:46.708 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.2989283673469387
2019.06.07 08:11:46.775 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.2989283673469387
2019.06.07 08:11:46.803 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.2989269387755102
2019.06.07 08:11:46.835 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.2989283673469387
2019.06.07 08:11:46.869 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.2989269387755102
2019.06.07 08:11:46.898 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.2989255102040816
2019.06.07 08:11:46.930 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.2989255102040816
2019.06.07 08:11:46.972 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.298924081632653
2019.06.07 08:11:46.993 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.2989226530612245
2019.06.07 08:11:47.024 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.298924081632653
2019.06.07 08:11:47.050 Custom Moving Average (EURUSD11608,M1)  14  prev_calculated=14  begin=0  data=0.2989255102040816
2019.06.07 08:11:47.085 Custom Moving Average (EURUSD11608,M1)  15  prev_calculated=14  begin=0  data=0.4171804373177843
2019.06.07 08:11:47.116 Custom Moving Average (EURUSD11608,M1)  15  prev_calculated=15  begin=0  data=0.4171790087463557
2019.06.07 08:11:47.175 Custom Moving Average (EURUSD11608,M1)  15  prev_calculated=15  begin=0  data=0.4171775801749271
2019.06.07 08:11:47.198 Custom Moving Average (EURUSD11608,M1)  15  prev_calculated=15  begin=0  data=0.4171790087463557
2019.06.07 08:11:47.215 Custom Moving Average (EURUSD11608,M1)  15  prev_calculated=15  begin=0  data=0.4171790087463557
2019.06.07 08:11:47.242 Custom Moving Average (EURUSD11608,M1)  15  prev_calculated=15  begin=0  data=0.4171775801749271
2019.06.07 08:11:47.270 Custom Moving Average (EURUSD11608,M1)  15  prev_calculated=15  begin=0  data=0.4171761516034985
2019.06.07 08:11:47.302 Custom Moving Average (EURUSD11608,M1)  15  prev_calculated=15  begin=0  data=0.4171775801749271
2019.06.07 08:11:47.335 Custom Moving Average (EURUSD11608,M1)  15  prev_calculated=15  begin=0  data=0.4171790087463557
2019.06.07 08:11:47.370 Custom Moving Average (EURUSD11608,M1)  15  prev_calculated=15  begin=0  data=0.4171761516034985
2019.06.07 08:11:47.398 Custom Moving Average (EURUSD11608,M1)  15  prev_calculated=15  begin=0  data=0.4171804373177843
2019.06.07 08:11:47.434 Custom Moving Average (EURUSD11608,M1)  15  prev_calculated=15  begin=0  data=0.4171790087463557
2019.06.07 08:11:47.466 Custom Moving Average (EURUSD11608,M1)  15  prev_calculated=15  begin=0  data=0.4171775801749271
2019.06.07 08:11:47.494 Custom Moving Average (EURUSD11608,M1)  15  prev_calculated=15  begin=0  data=0.4171775801749271
2019.06.07 08:11:47.528 Custom Moving Average (EURUSD11608,M1)  15  prev_calculated=15  begin=0  data=0.4171775801749271
2019.06.07 08:11:47.586 Custom Moving Average (EURUSD11608,M1)  15  prev_calculated=15  begin=0  data=0.4171775801749271
2019.06.07 08:11:47.617 Custom Moving Average (EURUSD11608,M1)  15  prev_calculated=15  begin=0  data=0.4171775801749271
2019.06.07 08:11:47.646 Custom Moving Average (EURUSD11608,M1)  15  prev_calculated=15  begin=0  data=0.41717472303207
2019.06.07 08:11:47.679 Custom Moving Average (EURUSD11608,M1)  15  prev_calculated=15  begin=0  data=0.4171775801749271
2019.06.07 08:11:47.716 Custom Moving Average (EURUSD11608,M1)  16  prev_calculated=15  begin=0  data=0.5185379258642233
2019.06.07 08:11:47.740 Custom Moving Average (EURUSD11608,M1)  16  prev_calculated=16  begin=0  data=0.5185364972927947

It means that everything is working correctly in a normal situation (ticks are today, as they should always be). The ticks are added, and the indicator is considered sparingly

 
Slava:

In any case, when replacing, updating, deleting bars, all indicators will be recalculated from scratch. This is out of the question.

Adding ticks should work as usual, i.e. the ticks are fresh, today's ticks, not yesterday's - the day before yesterday's.

Run your Expert Advisor from bug 11 description, then run the indicator with the print on each OnCalculate

Here are the logs.

It means that everything is working properly in a normal situation (ticks are of today, as they should always be). The ticks are added, and the indicator is considered sparingly

Is this a correct statement?

Click on the image to see the animation.


Moreover, if it is 00:00:01, we cannot use CustomTicksAdd to reshape a bar that was only two seconds ago.

 
fxsaber:

Is this a correct statement?

For the tester, the tick of the day before yesterday is fresh, today's tick of the day before yesterday.

I see your point. Your exercise with custom tics from six months ago is of a distinctly tester nature. Your situation is not normal (in the sense of normal practice)

Reason: