How can I find the difference between 2 values in C#?

怎甘沉沦 提交于 2019-12-06 07:19:48

Of the two, Abs(CB-1BA) would be correct, since there was a change of .5 between the two readings.

EDIT: To make it more readable, and assuming you're getting double values, you'd do something like this, but with error checking, and probably making the .25 a variable.

double[] values = Oscillator(PoFast, PoSlow, PoSmooth);
double currentBar = values[0];
double oneBarAgo = values[3];

if (currentBar > oneBarAgo && Math.Abs(currentBar - oneBarAgo) > .25)
{
    // do something
}

Your logic, Abs(CB-1BA) is correct.

As an aside, if you're not a developer do you really think you should be writing C# code to trade futures contracts? They're risky enough to trade at the best of times, never mind when you're writing code to do it and you're not a developer!!!!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!