Crazy converting WLD4's stategy to C#

Discussion in 'App Development' started by Xraptor, Feb 20, 2017.

  1. Xraptor

    Xraptor

    Hello!

    I try converted WLD4 strategy to C# code.

    WLD4 has strange circuit of calculation.

    Example: I connected to WLD4 the history data where prices has next type:

    Open: 740,94
    High: 742,33
    Low: 740,59
    Close: 732,67

    Next in the code WLD4, using function print('High: '+ FloatToStr(@#High[Bar])), in the debug windows I can see next value:

    High: 742,330017089844

    and ....

    Open: 740,940002441406
    Low: 740,590026855469
    Close: 732,679992675781

    And when I calculation in WLD4 code sort of: 1156,48 - 1154,80 I get thye bug again: 1,68004841515 instead 1,68.

    And what is it?

    How can I transfer WLD's strategy to C# code if WLD's float and C#'s double has so many differences?
     
  2. jharmon

    jharmon

    Floats have 6-7 digits of precision. Double has a lot more. In C# the decimal type is perhaps what you seek (at a performance cost).

    This is a normal computer programming issue - maybe you just need to round to 6 sig figs?
     
  3. Xraptor

    Xraptor

    Thank jharmon for your response. two questions:

    1. how converted decimal 742,330000000000 to 740,940002441406?
    2. how normalized float in WLD4 that the WLD4 doesn't has the issue?
     
  4. jharmon

    jharmon

    1. I have no idea about this one. Your original post didn't state that, so you seem to be confusing the open with the high.
    2. I do not understand your question. I don't use WLD so can't really answer anything specific though.