Average down move from open

Hi guys, hope everyone is doing well. 



I'm trying to get some direction/help with my first try at analyzing something in Python. 



I have daily OLHC data for the E-Mini S&P 500 and I'm trying to calculate the following:

  • On days where the close > Open aka Up Days
  • What is the average size (in points/ticks) of the move from the open to the low of the day?



    Any help would be greatly appreciated. 



    Thank you,



    Bruno



     

Hi Bruno,



Please try the following code. I hope this answers your question.



df = pd.read_csv("E:\Finename.csv",index_col=0)

#date,Open,High,Low,Close,closeopendiff,openlowdiff (creating last 2 coumumns)

df['closeopendiff'] = df['Close']-df['Open']

df['openlowdiff'] = df['Open']-df['Low']

diff = df.to_numpy()

average_openlowdiff = np.average(diff[:,5], weights=(diff[:,4] > 0))

print(average_openlowdiff)