python - I don't know why my code outputs nothing -


this code:

import pandas pd   def readfile(dailyfile, hourlyfile):     daily = pd.read_csv(dailyfile, parse_dates=[0], header=0, dayfirst=true)     hourly = pd.read_csv(hourlyfile, parse_dates=[0], header=0, dayfirst=true)     d_lines = sum(1 line in open(dailyfile))     h_lines = sum(1 line in open(hourlyfile))     return daily, hourly, d_lines, h_lines   def enter(daily, hourly, d_lines, h_lines):     in range(d_lines - 2):         j in range(h_lines - 1):             if daily['gmt time'][i + 1].day == hourly['gmt time'][j].day , daily['gmt time'][i + 1].month == \                     hourly['gmt time'][j].month , daily['gmt time'][i + 1].year == hourly['gmt time'][j].year:                 if daily['rsi'][i] > 50:                     if daily['close'][i] > 0.75 * (daily['high'][i] - daily['low'][i]) + daily['low'][i]:                         if hourly['close'][j] > daily['high'][i]:                             buyingrate = hourly['close'][j]                             sellingrate = none                             holding = true                             timeline = j                             return buyingrate, sellingrate, holding, timeline   def hold(buyingrate, sellingrate, holding, timeline, d_lines, h_lines, daily, hourly):     if buyingrate != none:         in range(d_lines - 2):             j in range(timeline, h_lines - 1):                 if daily['gmt time'][i + 1].day == hourly['gmt time'][j].day , daily['gmt time'][i + 1].month == \                         hourly['gmt time'][j].month , daily['gmt time'][i + 1].year == hourly['gmt time'][j].year:                     if hourly['close'][j] < daily['high'][i]:                         holding = false                         profit = (hourly['close'][j] - buyingrate) / buyingrate                         return profit, holding   def main():     holding = false     daily, hourly, d_lines, h_lines = readfile('data/audusd_d_demo.csv', 'data/audusd_h_demo.csv')     buyingrate, sellingrate, holding, timeline = enter(daily, hourly, d_lines, h_lines)     while holding == false:         enter(daily, hourly, d_lines, h_lines)         if holding == true:             profit, holding = hold(buyingrate, sellingrate, holding, timeline, d_lines, h_lines, daily, hourly)             print(profit)  main() 

these of csv data:

dailyfile:

gmt time    open    high    low close   volume  rsi 15.06.2017 00:00:00.000 0.75892 0.76313 0.7568  0.75858 107799.5406 0 16.06.2017 00:00:00.000 0.75857 0.76294 0.75759 0.76202 94367.4299  0 18.06.2017 00:00:00.000 0.76202 0.76236 0.76152 0.76188 5926.0998   0 19.06.2017 00:00:00.000 0.76189 0.76289 0.75848 0.75902 87514.849   0 

hourlyfile:

gmt time    open    high    low close   volume 15.06.2017 00:00:00.000 0.75892 0.75933 0.75859 0.75883 4777.4702 15.06.2017 01:00:00.000 0.75885 0.76313 0.75833 0.76207 7452.5601 15.06.2017 02:00:00.000 0.76207 0.76214 0.76106 0.76143 4798.4102 15.06.2017 03:00:00.000 0.76147 0.76166 0.76015 0.76154 4961.4502 15.06.2017 04:00:00.000 0.76154 0.76162 0.76104 0.76121 2977.6399 

this part of unfinishe forex strategy assuming codes above supposed output came out nothing, , no bugs either. me identify did wrong?

at least 1 problem in following code fragment:

while holding == false:     enter(daily, hourly, d_lines, h_lines)     if holding == true:         ....         print(profit) 

if holding == false, next iteration of loop executed, if statement (which has print) ignored, because holding cannot true , false @ same time , not change anywhere between while , if lines. if holding == false false, loop stops , nothing printed, anyway.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -