I'm currently having troubles with replicating the equation used by ObjectGetValueByShift. I think I'm having trouble getting the algebra correctly. I've been using this site as a source; https://www.mathsisfun.com/algebra/line-equation-point-slope.html , but I can't wrap my head around it.
I have the two points of Y-Y (vertical/price: s1-s2) and X-X (horizontal/time: st1-st2) for calculating the slope like this;
As you can imagine subtracting two almost equals returns an infinite number 8.1231241352e-008 and I'm not sure if this is the problem.
Further I've tried several different approaches in finding where price would be on my slope at current time.
double s1B = Bid-TrendSlope*CurrentT;
double s1Current = TrendSlope*CurrentT+s1B;
double s1B = s1-TrendSlope*dateS1;
double s1Current = TrendSlope*dateS1+s1B;
The reason I need to recreate this equation is due to the fact that graphical objects aren't supported when running optimization, so ObjectGetValueByShift doesn't work.
I'd greatly appreciate any help as I'm kind of new to this. I've only been coding for a couple of weeks and I have been struggling with this for a good 12 hours now...
The math. images show you x- and y-values in equidistance.
The chart does not!
If you e.g. take bar by bar you can use 0,1,2,3,... their difference is 1 (similar to the x-values) but the prices aren't 1,2,3 at all and the differences are some points which means e.g. 0.0010.
You have to adjust the scales before you can start to calculate!
To add comments, please log in or register