How to convert the price difference into a whole number? - page 4

 
Fernando Carreiro:
Yes, that is a solution. In that case you can simple use a the actual sign (+/-) of the whole value to determine the direction in a quick way.
And (Low - Open) change to  (Open - Low)  to always be positive
 
Ivan Negreshniy: Yes, and to determine the direction of the bar, we can put in the first position (Close-Open)

Here is the alternative simpler way with only positive values for deltas, except the close

OHLC: 1.21031/ 1.21054 / 1.21029 / 1.21030 becomes -000100230002121031

  • Close - Open (points): 121030 - 121031 = -1 is -0001 converted into signed 4 decimal value (with +/- sign)
  • High - Open (points): 121054 - 121031 = 23 is 0023 converted into unsigned 4 decimal value (always positive)
  • Open - Low (points): 121031 - 121029 = 2 is 0002 converted into unsigned 4 decimal value (always positive)
  • Open (points): 121031 converted into unsigned 6 decimal value

Unsigned 4 decimal value (0-9999 positive)

 
Fernando Carreiro:

Here is the alternative simpler way with only positive values for deltas, except the close

OHLC: 1.21031/ 1.21054 / 1.21029 / 1.21030 becomes -000100230002121031

  • Close - Open (points): 121030 - 121031 = -1 is -0001 converted into signed 4 decimal value
  • High - Open (points): 121054 - 121031 = 23 is 0023 converted into unsigned 4 decimal value (always positive)
  • Open - Low (points): 121031 - 121029 = 2 is 0002 converted into unsigned 4 decimal value (always positive)
  • Open (points): 121031 converted into unsigned 6 decimal value

Unsigned 4 decimal value (0-9999 positive)

thanks again, i will experiment)