if I need simple math operation:
how to adjust datatypes to avoid the warning ? & to get the result of calculation in datetime datatype...
how to adjust correctly all variables to long or to datetime ? (I suppose adjustment should be to some of these datatypes because of their biggest size 8 byte)...
am I right & how to do it?
p.s. Actually, I also should care if Dist is negative, then dt2 should jump back over the date_holes on the chart (week_end or holiday), but still show the correct size of line to be drawn ... supposing dt1 something like D'YYYY/MM/DD 00:00:00'
dt1, dt2 are datetime, dist is int & scale is double ... at first sight, i would say that scale shouldn't be a double but an int
if I need simple math operation:
how to adjust datatypes to avoid the warning ? & to get the result of calculation in datetime datatype...
how to adjust correctly all variables to long or to datetime ? (I suppose adjustment should be to some of these datatypes because of their biggest size 8 byte)...
am I right & how to do it?
p.s. Actually, I also should care if Dist is negative, then dt2 should jump back over the date_holes on the chart (week_end or holiday), but still show the correct size of line to be drawn ... supposing dt1 something like D'YYYY/MM/DD 00:00:00'
your calculations make no sense with the information you have provided.
IF scale is the chart scale - then that has nothing to do with date and time so why would it be part of the calculation?
Dist is what?
you need to clarify to get any meaningful answers, we could resolve your error message but your result will still be meaningless.
IF scale is the chart scale - .
no it isn't... well, in real code this variable has name ScaleM0 (perhaps I shortened the code in the misleading manner- sorry) - but the name doesn't matter - it is just a coefficient taken from some proportion (its meaning is half-of-a-day=86400/2=43200 as FOR maximum value of Dist & all the rest of Dist values in the array are calculated in a proportion to this max & half-of-a-day)...
we could resolve your error message but your result will still be meaningless.
I don't think so if we speak about datatype-casting & drawing the result correctly from dt1 to dt2 (aka date), not speaking about the sence of my calculations...
Dist is int attribute of myClass & no other way.
Well, I casted in such a manner:
double temp= NormalizeDouble(Dist*ScaleM0,0); dt2= (datetime)((double)dt1+temp);
& warnings disappeared, (let consider so),
BUT I still cannot draw huge lines to the negative side: temp=-350 - OK finding dt2-point on time-scale, but temp=-35000 is being continued till the left side of the whole chart-window (not stopping at dt2=dt1-35000)... testing now at H1 chart
p.s.
I thought the problem was warning... but after it disappeared still not correct drawing... ??
really strange, the problem (like this & as I described above) starts back from 2021/06/01,
but such levels, drawn with CChartObjectTrend to negative side in periods later - behaves normally (with normal adjustment according to the proportion coefficient) -
(I mean levels with huge values - that are comparable to those that are not being drawn normallly before 2021/06/01)
this gives me belief that the algorithm of calculation of dt2 is probably OK, but the problem still appears sometimes in dates before the date I marked here... really strange & yet unexpectedly for me ??
- 2020.01.07
- www.mql5.com
but temp=-35000 is being continued till the left side of the whole chart-window (not stopping at dt2=dt1-35000)...
oh, such mysterious reason appeared to cause such behavior - this.RayRight(false); for somewhat reason is becoming true & getting the default color )) ... now I know where to find the error (in class myDraw probably)... -- & really it was too long myTxtMark passed as parameter to Constructor of Line that makes this.Create(..) - FOUND!
Anyway, if somebody consider my typecast in #4 can be simplified - please, let me know
& thanks for not being indifferent to my problem...
- 2018.11.21
- TenOutOfTen
- stackoverflow.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
if I need simple math operation:
how to adjust datatypes to avoid the warning ? & to get the result of calculation in datetime datatype...
how to adjust correctly all variables to long or to datetime ? (I suppose adjustment should be to some of these datatypes because of their biggest size 8 byte)...
am I right & how to do it?
p.s. Actually, I also should care if Dist is negative, then dt2 should jump back over the date_holes on the chart (week_end or holiday), but still show the correct size of line to be drawn ... supposing dt1 something like D'YYYY/MM/DD 00:00:00'