Maximum Loss - page 2

 
whroeder1:

Only if you don't use strict, which you always should.


Yup, I learned this the hard way... Always initialize your variables and class members!

 
Fernando Carreiro #:

By summing "+=", just as suggested!

Obviously, this is only a simplistic outlook, because the rest of your code would have to be changed to accommodate looking at all the trades and not just the last one.

You need to first learn the basics of coding (eg. by learning about "+=", otherwise you will never get it)!

Also, learn to make your code well spaced out and indented so as to make it more readable and detect possible problematic areas!

the only thing I needed. appreciated

Reason: