yccheok / jstock

JStock is a free stock market software for 28 countries.
https://jstock.org
657 stars 345 forks source link

On Balance Volume indicator #154

Open chuckappdev opened 4 years ago

chuckappdev commented 4 years ago

OBV - On Balance Volume would be a nice indicator

The Formula For OBV Is

                ⎧volume,    if close>close-prev                                                                                                                                                                                                                                    
                ⎪                                                                                                                                                                                                                                                                                 
OBV = OBVprev + ⎨0,         if close=close-prev                                                                                                                                                                                                                                                                                                                                                                                                                       
                ⎪                                                                                                                                                              
                ⎩ −volume,  if close<close-prev

where: OBV = Current on-balance volume level OBV-prev = Previous on-balance volume level volume = Latest trading volume amount ​ Initial OBV of the price series is equal to absolute volume. If current price is greater than previous price, then current OBV= previous OBV+current volume If current price is less than previous price, then current OBV= previous OBV-current volume If current price is equal to previous price, then current OBV= previous OBV

I cannot do this in the Indicator Editor because no conditional 'then' is available. Ideally adding some "If, then else" capability to the editor would be the ultimate.

``