Advertisement
ImDerekD

*OFFICIAL*(Comparison)_01_05_11:51

Jan 6th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.72 KB | None | 0 0
  1. #!/usr/bin/bash python
  2.  
  3. import csv
  4. import datetime
  5. from datetime import datetime
  6. from colorama import Back, Fore, Style
  7. import sys
  8. from termcolor import colored, cprint
  9. from colorama import init
  10. import numbers
  11. import time
  12. import itertools
  13. from itertools import zip_longest
  14. from time import sleep
  15. import pathlib
  16. import os
  17. import os.path
  18. from pathlib import Path
  19. import glob
  20. from progress.bar import Bar
  21.  
  22.  
  23. filename_input = input('[Ticker][Number] Input filename_input: ')
  24. iFiles = '/Users/King/iFiles/'
  25. rangeiFiles = '/Users/King/iFiles/iRanges/' ### All Range files created will be in this iFilesectory
  26. rangeiFileExtension = '_RangeTargets.csv'
  27. default = '/Users/King/Data.csv' ### Easiest for ETRADE to automatically export as this filename_input
  28.  
  29. checkFile = Path(iFiles+filename_input+'.csv')
  30. file_Exists = Path.is_file(checkFile)
  31.  
  32. rangeCheckFile = Path(rangeiFiles+filename_input+rangeiFileExtension)
  33. rangefile_Exists = Path.is_file(rangeCheckFile)
  34.  
  35. if filename_input == 'Watchlist':
  36. import Watchlist
  37. Watchlist.show_available()
  38. time.sleep(.15)
  39. print('These are all symbols currently in your watchlist')
  40. time.sleep(.5)
  41. pick_file_answer = input('Would you like to choose a symbol from here?: ')
  42. if pick_file_answer == 'y':
  43. Watchlist.symbol_dict()
  44.  
  45.  
  46. if file_Exists:
  47. if filename_input != 'Watchlist':
  48. time.sleep(.35)
  49. print(Fore.CYAN+'File Found!'+Style.RESET_ALL)
  50. time.sleep(.75)
  51. pass
  52. else:
  53. print('Sorry, File is not in iFile iFilesectory')
  54.  
  55.  
  56. with open(iFiles+str(filename_input)+'.csv', 'r') as csv_file:
  57. csv_reader = csv.reader(csv_file)
  58. header = next(csv_reader)
  59.  
  60. #####################################################################################################################################################
  61. ref = [] # Start off w/ empty list
  62. ref_Num = int(0) # First to go in list = ref # (390 cells in 1 day)(using ref+=1 for each row)
  63. data = [] # Not sure but I could rearrange for liquidity?
  64. Liquidity = float()
  65. found = int(0)
  66. Range = []
  67. Target = []
  68. filled = bool
  69. filled_Price = float()
  70. Range_List = {}
  71. Low_Range_Found = {}
  72. High_Range_Found = {}
  73. hr_found = bool
  74. ht_filled = bool
  75. hr_filled = bool
  76. lr_found = bool
  77. lr_filled = bool
  78. lt_filled = bool
  79. lows_found = int()
  80. highs_found = int()
  81. Range_Found = {}
  82. range_ref_String = ('')
  83. dTime = []
  84. printRanges = str()
  85. range_identifier_low = 'Low'
  86. range_identifier_high = 'High'
  87. range_identifier_all = 'All'
  88. All_Range_References = []
  89. All_Referenced_Prices = []
  90. TickerID = int(0)
  91. menu_ans = input('What would you like to do? \n [1] Print Liquidity Data | [2] RangeTargets File | [4] No-Stop-Data-Add [6] Current Info\n')
  92. if menu_ans == '1':
  93. Liquidity_Data = input('Would you like to print liquidity data? [y/n]: ')
  94. if menu_ans == '4':
  95. NoStop = True
  96. CandleDur = input('Candle Duration: ')
  97. else:
  98. NoStop = False
  99. ### Might use this space for a (show liquidity) type option to make it false
  100. range_identifier = ''
  101. new_range = bool
  102. t = bool
  103. tLow = bool
  104. tHigh = bool
  105. Target = float()
  106. Range_Dict = {}
  107. TickString = str()
  108. Tick_String = ''
  109. Strength = int()
  110. StartTraceback = {}
  111. day_Count = int()
  112. tList = []
  113. last = float()
  114. LT = float()
  115. HT = float()
  116. last = float()
  117. TrendStrength = ''
  118. Previous = []
  119. allfoundallfilled = {}
  120. lowfilled = float()
  121. highfilled = float()
  122. rangefilled = bool
  123. low_Ranges_Filled = int()
  124. high_Ranges_Filled = int()
  125. high_Targets_Filled = int()
  126. low_Targets_Filled = int()
  127. prevVol = float(1)
  128. prevFlow = float(1)
  129. prevIndexValue = float(1)
  130. prevPrice = float(1)
  131. Status = str('') # # # # # # # # # # $
  132. RangeTarget = float() # # # # $ # # # # # #
  133. rFound = bool
  134. #######################################################################################################################################################
  135. for row in csv_reader:
  136. range_ref_String = ''
  137. LRS = '$'
  138. LRT = '$'
  139. HRS = '$'
  140. HRT = '$'
  141. found_Price_String = '$'
  142. end_String = 'Price while found: $'
  143. # row = [Time, Open, Close, High, Low, realVol, Money_Flow]
  144. ref_Num += 1 # Starting at 0
  145. dTime = str(datetime.strptime(row[0], '%a %b %d %H:%M'))
  146. Time = dTime[-14:]
  147. Open_Price = float(row[1]) # Price Data Dictionary
  148. Close_Price = float(row[2]) # Price Data Dictionary
  149. High_Price = float(row[3]) # Price Data Dictionary
  150. Low_Price = float(row[4]) # Price Data Dictionary
  151. Money_Flow = float(row[6]) # Price Data Dictionary
  152. Vol = row[5] # Price Data Dictionary
  153. f_Vol = float(Vol[:-1]) # Price Data Dictionary
  154. m_Vol = str(Vol[-1:]) # Price Data Dictionary
  155. if m_Vol == "K": # Price Data Dictionary
  156. f_Vol = f_Vol * 1000 # Price Data Dictionary
  157. if m_Vol == "M": # Price Data Dictionary
  158. f_Vol = f_Vol * 1000000
  159. if m_Vol != "K" and m_Vol != "M":
  160. f_Vol = float(row[5]) # Price Data Dictionary
  161. if f_Vol < 1:
  162. M_Price = HLCC
  163. else:
  164. M_Price = round(float(Money_Flow) / f_Vol, 2)
  165. HLCC = float(High_Price + Low_Price + Close_Price + Close_Price)/4 # Price Data Dictionary & RangeReference Dictionary # Price Data Dictionary & RangeReference Dictionary
  166. Diff = round(HLCC - M_Price, 2) # Price Data Dictionary & RangeReference Dictionary & Data Dictionary
  167. MMM = float(f_Vol * HLCC) # Price Data Dictionary & RangeReference Dictionary & Data Dictionary
  168. Liq_change = float(Money_Flow - MMM) # Price Data Dictionary & RangeReference Dictionary & Data Dictionary
  169. Liquidity += Liq_change # Price Data Dictionary & RangeReference Dictionary & Data Dictionary
  170. Date = str(Time[:5]) # Important
  171. military_time = str(Time[-8:])
  172. criteria = abs(.003*HLCC)
  173. Liq_Tick = int()
  174. Price_Tick = int()
  175. tREF = int()
  176. rFound = False
  177. percent_Strength = Strength / ref_Num
  178. allData = [ref_Num,Date, military_time, High_Price,Low_Price,Close_Price, HLCC, M_Price, f_Vol, Money_Flow,MMM, Liquidity,Liq_change]
  179. Data_Dict = {'REF#':[ref_Num],'Date':[Date],'Time':[military_time], 'Close_Price':[Close_Price], 'M_Price':[M_Price], 'Volume':[f_Vol]}
  180. '''USING THIS DATA
  181. [0]REFERENCE NUMBER
  182. [1]DATE
  183. [2]MILITARY_TIME
  184. [3]HIGH_PRICE
  185. [4]LOW_PRICE
  186. [5]CLOSE_PRICE
  187. [6]HLCC
  188. [7]M_Price
  189. [8]F_VOL
  190. [9]MONEY_FLOW
  191. [10]MARKETMAKERMOVE 'MMM'
  192. [11]LIQUIDITY
  193. [12]LIQ_CHANGE
  194. '''
  195. #####################################################################################################################################################
  196. ####################DEFINE#####RANGE########DATA#######################
  197. if abs(allData[7]-allData[6]) >= criteria:
  198. diff = abs(M_Price - Close_Price)
  199. Range_Clause = True
  200. range_identifier_all = 'All'
  201. else:
  202. Range_Clause = False
  203. if Range_Clause == True:
  204. t_price = M_Price
  205. found_Price = HLCC
  206. Low_Range = round(HLCC - abs(float(M_Price - HLCC)), 2)
  207. High_Range = round(HLCC + abs(float(M_Price - HLCC)), 2)
  208. Low_Target = round(Low_Range - abs(float(M_Price - HLCC)), 2)
  209. High_Target = round(High_Range + abs(float(M_Price - HLCC)), 2)
  210. RT_Reference1 = [Low_Range, High_Range, Low_Target, High_Target]
  211. LRS = '$' + str(Low_Range)
  212. LRT = '$' + str(Low_Target)
  213. HRS = '$' + str(High_Range)
  214. HRT = '$' + str(High_Target)
  215. found_Price_String = '$' + str(found_Price)
  216. RT_Reference = [LRS, LRT, HRS, HRT]
  217. lows = [LRS, LRT]
  218. highs = [HRS, HRT]
  219. range_ref_String = range_ref_String
  220. target_String = range_ref_String + ': $'
  221. end_String = 'Price while found: $' + str(Close_Price)
  222. Target_String = '$' + str(Target)
  223. if M_Price >= found_Price+diff:
  224. found += 1
  225. range_ref_String = "HIGH TARGET"
  226. tHigh = True
  227. RangeTarget = High_Target
  228. Target = M_Price
  229. range_identifier = 'High'
  230. found_Price = HLCC
  231. range_identifier_all = 'All'
  232. thList = ['HIGH TARGET', High_Target, highfilled]
  233. filled = False
  234. ht_filled = False
  235. hr_filled = False
  236. highs_found += 1
  237. rFound = True
  238. hr_found = True
  239. elif M_Price<= found_Price-diff:
  240. found += 1
  241. range_ref_String = "LOW TARGET"
  242. tLow = True
  243. RangeTarget = Low_Target
  244. Target = M_Price
  245. range_identifier = 'Low'
  246. range_identifier_all = 'All'
  247. found_Price = HLCC
  248. tlList = ['LOW TARGET', Low_Target, lowfilled]
  249. filled = False
  250. lt_filled = False
  251. lr_filled = False
  252. lr_found = True
  253. lows_found += 1
  254. rFound = True
  255. else:
  256. Range_Clause = False
  257. tHigh = False
  258. tLow = False
  259. rFound = False
  260. #################################################START######################LIQUIDITY#####################################################################
  261.  
  262.  
  263. if menu_ans == '1' or menu_ans == '4':
  264. if Close_Price > Open_Price and Liq_change > 0:
  265. Price_Tick = 1
  266. Liq_Tick = 1
  267. elif Close_Price >= Open_Price and Liq_change < 0:
  268. Price_Tick = 0
  269. Liq_Tick = -1
  270. elif Close_Price <= Open_Price and Liq_change > 0:
  271. Price_Tick = -1
  272. Liq_Tick = 0
  273. elif Close_Price <= Open_Price and Liq_change < 0:
  274. Price_Tick = -1
  275. Liq_Tick = -1
  276. Tick = Liq_Tick + Price_Tick
  277. Strength += Tick
  278. percent_Strength = round(Strength / ref_Num, 4)
  279. if Tick == 2:
  280. Tick_String = Fore.BLUE+Back.GREEN+'STRONG BUYERS'+Style.RESET_ALL+' '+Fore.GREEN+str(Strength)
  281. if Tick == -1 and Price_Tick == 0:
  282. Tick_String = Fore.WHITE+'PRICE UP LIQ DOWN'+Style.RESET_ALL+' '+Fore.RED+str(Strength)
  283. if Tick == -2:
  284. Tick_String = Fore.RED+Back.YELLOW+'STRONG SELLERS'+Style.RESET_ALL+' '+Fore.WHITE+str(Strength)
  285. if Tick == -1 and Liq_Tick == 0:
  286. Tick_String = Fore.RED+'SHORT COVERING'+Style.RESET_ALL+' '+Fore.YELLOW+Back.BLUE+str(Strength)
  287. Range_List[ref_Num] = Range_Found
  288. #########################################Tick###########Exception##########Option#1##############Option#4####################################################
  289. if Range_Clause == True:
  290. if range_ref_String == "HIGH TARGET" and Money_Flow < 300000000:
  291. if Liq_change > 1000000:
  292. print("MARKET MAKER HIGH TARGET")
  293. if range_ref_String == "LOW TARGET" and Money_Flow > 300000000:
  294. if Liq_change < 1000000:
  295. print("MARKET MAKER LOW TARGET")
  296. if rFound == True:
  297. if tHigh == True:
  298. tLow = False
  299. HRS = str(High_Range)
  300. HRT = str(High_Target)
  301. LRS = str(Low_Range)
  302. LRT = str(Low_Target)
  303. print(Fore.YELLOW+'['+Date+']',military_time,Style.RESET_ALL+Fore.BLUE+Back.YELLOW+Style.BRIGHT+'Current Liquidity:'+'{:20,.2f}'.format(Liquidity)+Style.RESET_ALL+Fore.BLUE+Back.YELLOW+Style.BRIGHT+' Liq Change: '+'{:20,.2f}'.format(Liq_change)+Style.RESET_ALL, Fore.YELLOW+Back.BLUE+Style.BRIGHT,'Last Price: [$'+str(Close_Price)+'] '+Style.RESET_ALL+Tick_String+Style.RESET_ALL+Fore.GREEN+Back.BLUE+Style.BRIGHT+' NEW HIGH RANGE FOUND:[$'+HRS+']'+' NEW HIGH TARGET FOUND: [$'+HRT+']'+Style.RESET_ALL)
  304. time.sleep(2)
  305. if NoStop == True:
  306. with open(rangeiFiles+str(filename_input)+rangeiFileExtension, 'a') as csv_file:
  307. CandleDuration = CandleDur
  308. file_PriceList = [Date, military_time, range_ref_String, Close_Price, M_Price, HRT, Money_Flow, f_Vol, LRS, LRT, Liquidity, Liq_change, liq_flowPrice, MIV_Index, CandleDuration, ref_Num]
  309. wr = csv.writer(csv_file)
  310. wr.writerow(file_PriceList)
  311.  
  312. else:
  313. add_Range_Target = input('Would you like to add this range to file?: [y/n]:')
  314. if add_Range_Target == 'y':
  315. CandleDuration = str(filename_input[-1:])+'Min'
  316. with open(rangeiFiles+str(filename_input)+rangeiFileExtension, 'a') as csv_file:
  317. file_PriceList = [Date, military_time, range_ref_String, Close_Price, M_Price, HRT, Money_Flow, f_Vol, LRS, LRT, Liquidity, Liq_change, liq_flowPrice, MIV_Index, CandleDuration, ref_Num]
  318. wr = csv.writer(csv_file)
  319. wr.writerow(file_PriceList)
  320.  
  321. else:
  322. tHigh = False
  323.  
  324. if rFound == True:
  325. if tLow == True:
  326. tHigh = False
  327. HRS = str(High_Range)
  328. HRT = str(High_Target)
  329. LRS = str(Low_Range)
  330. LRT = str(Low_Target)
  331. Low_Prices = {'LOW RANGE: $': Low_Range, 'LOW TARGET: $': Low_Target} ##### May not need this line
  332. print(Fore.YELLOW+'['+Date+']',military_time,Style.RESET_ALL+Fore.CYAN+Back.RED+Style.BRIGHT+'Current Liquidity:'+'{:20,.2f}'.format(Liquidity)+Style.RESET_ALL+Fore.CYAN+Back.RED+Style.BRIGHT+' Liq Change: '+'{:20,.2f}'.format(Liq_change)+Style.RESET_ALL, Fore.YELLOW+Back.BLUE+Style.BRIGHT,'Last Price: [$'+str(Close_Price)+'] '+Style.RESET_ALL+Tick_String+Style.RESET_ALL+Fore.CYAN+Back.RED+Style.BRIGHT+' NEW LOW RANGE FOUND:[$'+LRS+']'+' NEW LOW TARGET FOUND: [$'+LRT+']'+Style.RESET_ALL)
  333. time.sleep(2)
  334. if NoStop == True:
  335. with open(rangeiFiles+str(filename_input)+rangeiFileExtension, 'a') as csv_file:
  336. CandleDuration = CandleDur
  337. file_PriceList = [Date, military_time, range_ref_String, Close_Price, M_Price, LRT, Money_Flow, f_Vol, HRS, HRT, Liquidity, Liq_change, liq_flowPrice, MIV_Index, CandleDuration, ref_Num]
  338. wr = csv.writer(csv_file)
  339. wr.writerow(file_PriceList)
  340. else:
  341. add_Range_Target = input('Would you like to add this range to file?: [y/n]:')
  342. if add_Range_Target == 'y':
  343. CandleDuration = str(filename_input[-1:])+'Min'
  344. with open(rangeiFiles+str(filename_input)+rangeiFileExtension, 'a') as csv_file:
  345. file_PriceList = [Date, military_time, range_ref_String, Close_Price, M_Price, LRT, Money_Flow, f_Vol, HRS, HRT, Liquidity, Liq_change, liq_flowPrice, MIV_Index, CandleDuration, ref_Num]
  346. wr = csv.writer(csv_file)
  347. wr.writerow(file_PriceList)
  348. else:
  349. tLow = False
  350.  
  351. #######################################################################################################
  352.  
  353.  
  354. if lr_filled == False:
  355. if filled == False:
  356. if lr_found == True and Low_Price <= Low_Range:
  357. filled_Price = Low_Price
  358. time.sleep(.5)
  359. print(Fore.WHITE + Back.RED + "LOW RANGE FILLED" + Style.RESET_ALL)
  360. time.sleep(1)
  361. lr_filled = True
  362. lt_filled = False
  363. lrf = 1
  364. low_Ranges_Filled += lrf
  365. if lt_filled == False and lr_filled == True:
  366. if Close_Price <= Low_Target:
  367. filled_target_price = Close_Price
  368. time.sleep(.5)
  369. print(Fore.RED + Back.YELLOW + 'LOW TARGET FILLED' + Style.RESET_ALL)
  370. time.sleep(1)
  371. lt_filled = True
  372. filled = True
  373. low_Targets_Filled += 1
  374.  
  375. else:
  376. if High_Price >= High_Range:
  377. time.sleep(.5)
  378. OPPOSITE_RFILLED = (' !!!OPPOSITE RANGE FILLED!!!')
  379. OppRangeFilled_String = colored(OPPOSITE_RFILLED, 'green', attrs=['bold','blink'])
  380. cprint(OppRangeFilled_String)
  381. lr_filled = True
  382.  
  383.  
  384. if hr_filled == False:
  385. if filled == False:
  386. if hr_found == True and High_Price >= High_Range:
  387. filled_range_price = High_Price
  388. time.sleep(.5)
  389. print(Fore.CYAN + "HIGH RANGE FILLED" + Style.RESET_ALL)
  390. time.sleep(1)
  391. hr_filled = True
  392. ht_filled = False
  393. hrf = 1
  394. high_Ranges_Filled += hrf
  395. if ht_filled == False and hr_filled == True:
  396. if Close_Price >= High_Target:
  397. filled_target_price = High_Price
  398. print(Fore.CYAN + "HIGH TARGET FILLED")
  399. time.sleep(1)
  400. ht_filled = True
  401. filled = True
  402. high_Targets_Filled += 1
  403.  
  404. else:
  405. if Low_Price <= Low_Range:
  406. time.sleep(.5)
  407. OPPOSITE_RFILLED = (' !!!OPPOSITE RANGE FILLED!!!')
  408. OppRangeFilled_String = colored(OPPOSITE_RFILLED, 'red', attrs=['bold','blink'])
  409. cprint(OppRangeFilled_String)
  410. hr_filled = True
  411. else:
  412. Range_Clause = False
  413.  
  414. if Liq_change < -1000000 and tLow == False:
  415. if tHigh == False:
  416. print(Fore.YELLOW + '[' + Date + ']', military_time,Style.RESET_ALL + Fore.CYAN + Back.RED + Style.BRIGHT + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL + Fore.YELLOW + Back.RED + Style.BRIGHT + ' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + Style.RESET_ALL, Fore.YELLOW + Back.RED + Style.BRIGHT,'Last Price: [$' + str(Close_Price) + '] ' + Style.RESET_ALL + Tick_String + Style.RESET_ALL + Fore.YELLOW + Back.RED + Style.BRIGHT + '**SELL SIGNAL**' + Style.RESET_ALL)
  417. time.sleep(1)
  418. if abs(Liq_change) > 500000:
  419. time.sleep(.005)
  420. print(Fore.CYAN + '[' + Date + ']', military_time,Fore.CYAN + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL + Fore.YELLOW + Back.BLUE + Style.BRIGHT + ' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + ' ' + Fore.YELLOW + Back.BLUE,'Last Price [$' + str(Close_Price) + '] ' + Tick_String + Style.RESET_ALL)
  421. elif Liquidity > 0:
  422. if Liq_change > 0:
  423. time.sleep(.005)
  424. print(Fore.YELLOW + '[' + Date + ']', military_time,
  425. Fore.GREEN + 'Current Liquidity:' + '{:20,.2f}'.format(
  426. Liquidity) + Fore.GREEN + ' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + ' ' + Fore.YELLOW + Back.BLUE,'Last Price [$' + str(Close_Price) + '] ' + Tick_String + Style.RESET_ALL)
  427. if Liq_change < 0:
  428. time.sleep(.005)
  429. print(Fore.YELLOW + '[' + Date + ']', military_time,
  430. Fore.GREEN + 'Current Liquidity:' + '{:20,.2f}'.format(
  431. Liquidity) + Style.RESET_ALL + Fore.RED + ' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + Style.RESET_ALL + ' ' + Fore.YELLOW + Back.BLUE,'Last Price [$' + str(Close_Price) + '] ' + Tick_String + Style.RESET_ALL)
  432. elif Liq_change > 0:
  433. time.sleep(.005)
  434. print(Fore.YELLOW + '[' + Date + ']', military_time,Fore.BLUE + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL + Fore.WHITE,' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + ' ' + Fore.YELLOW + Back.BLUE,'Last Price [$' + str(Close_Price) + '] ' + Tick_String + Style.RESET_ALL)
  435. elif Liq_change < 0:
  436. time.sleep(.005)
  437. print(Fore.YELLOW + '[' + Date + ']', military_time,Fore.BLUE + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL + Fore.CYAN,' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + ' ' + Fore.YELLOW + Back.BLUE+'Last Price [$' + str(Close_Price) + '] ' + Tick_String + Style.RESET_ALL)
  438.  
  439. if Money_Flow > 0:
  440. MIV_Index = round(100 * (f_Vol / prevVol) - 100 * ((Money_Flow * HLCC) / (prevFlow * prevPrice)), 3)
  441. runningValueIndex = round(MIV_Index + prevIndexValue, 3)
  442. prevPrice = Close_Price
  443. prevFlow = Money_Flow
  444. prevVol = f_Vol
  445. prevIndexValue = MIV_Index
  446. MIV_Index_String = str(MIV_Index)
  447. liq_flowPrice = abs(Liq_change / Money_Flow)
  448. runningValueIndex_String = str(runningValueIndex)
  449. if abs(MIV_Index) > .25:
  450. if MIV_Index > .25:
  451. MIV_Index_String = str(round(MIV_Index, 2))
  452. print(Fore.BLACK+Back.RED+Style.BRIGHT+'MIV_Index: '+Style.RESET_ALL+Fore.BLACK+Back.RED+'[+'+MIV_Index_String+'%]'+Style.RESET_ALL+Fore.BLACK+Back.RED+Style.BRIGHT+'Running Value: '+Style.RESET_ALL+Fore.BLACK+Back.RED+'[+'+runningValueIndex_String+'%]'+Style.RESET_ALL)
  453. elif MIV_Index < -.25:
  454. MIV_Index_String = str(round(MIV_Index, 2))
  455. print(Fore.BLACK+Back.CYAN+Style.BRIGHT+'MIV_Index: '+Style.RESET_ALL+Fore.BLACK+Back.CYAN+'['+MIV_Index_String+'%]'+Style.RESET_ALL+Fore.BLACK+Back.CYAN+'Running Value: '+Style.RESET_ALL+Fore.BLACK+Back.CYAN+'['+runningValueIndex_String+'%]'+Style.RESET_ALL)
  456.  
  457. #####################################################################################
  458.  
  459. if menu_ans == '3':
  460. bar = Bar('Loading Range File', max=20, suffix='%(index)d/%(max)d - %(percent).1f%% - %(eta)ds')
  461. for i in range(20):
  462. time.sleep(.05) # Do some work
  463. bar.next()
  464. bar.finish()
  465. printRangeFile = input('Would you like to see other found ranges?: [y/n]')
  466. if printRangeFile == 'y':
  467. watchlist = iFiles+'watchlist.csv'
  468. with open(rangeiFiles+str(filename_input)+'_RangeTargets.csv', 'r') as csv_file:
  469. csv_reader = csv.reader(csv_file)
  470. for row in csv_reader:
  471. Date = row[0]
  472. Time = row[1]
  473. range_ref_String = row[2]
  474. Close_Price = float(row[3])
  475. M_Price = float(row[4])
  476. TargetPrice = row[5]
  477. Money_Flow = float(row[6])
  478. f_Vol = float(row[7])
  479. OppRange = row[8]
  480. OppTarget = row[9]
  481. Liquidity = float(row[10])
  482. Liq_change = float(row[11])
  483. LFP = float(row[12])
  484. MIVI = float(row[13])
  485. ref_Num = int(row[15])
  486. CandleDuration = str(row[14])
  487. list = [Date, Time, range_ref_String]
  488. Targets = [M_Price, TargetPrice]
  489. MIV_Index = str(MIVI) + str('%')
  490. liq_flowPrice = str(round(LFP, 3))
  491. oppositePrices = [OppRange, OppTarget]
  492. Liq_change_String = str('$' + '{:20,.2f}'.format(Liq_change))
  493. listlist = []
  494. dict = {'': list, 'Targets: ':Targets, 'Found price: ':Close_Price,'Opposite Ranges/Targets':oppositePrices}
  495. range_info = {'MIV Index:': MIV_Index, 'Liq Change:':Liq_change_String,'Candle Duration:':CandleDuration, 'REF#':ref_Num}
  496. if MIVI < 0 and Liq_change > 0:
  497. infotext = colored(str(range_info), 'grey', 'on_cyan', attrs=['reverse', 'underline'])
  498. else:
  499. infotext = colored(str(range_info), 'grey', 'on_red', attrs=['reverse', 'underline'])
  500. for k, v in dict.items():
  501. time.sleep(.001)
  502. print(Fore.YELLOW, k, v)
  503. cprint(infotext)
  504. print('\n')
  505.  
  506.  
  507.  
  508. if menu_ans == '5':
  509. print('Sorry, still testing')
  510. '''choose_info = input('[2] MIV_Index [3] Liquidity [4] Liq Change [5] % Strength [6] Volume [7] Money Flow [8] Liq Flow Price')
  511. if choose_info == '2':
  512. MIV_Index = round(100 * (f_Vol / prevVol) - 100 * ((Money_Flow * HLCC) / (prevFlow * prevPrice)), 3)
  513. runningValueIndex = round(MIV_Index + prevIndexValue, 3)
  514. prevPrice = Close_Price
  515. prevFlow = Money_Flow
  516. prevVol = f_Vol
  517. prevIndexValue = MIV_Index
  518. MIV_Index_String = str(MIV_Index)
  519. liq_flowPrice = abs(Liq_change / Money_Flow)
  520. percent_Strength = round(Strength / ref_Num, 4)
  521. info = [Date, military_time, MIV_Index, Liquidity, Liq_change, percent_Strength]
  522. print(MIV_Index)'''
  523.  
  524.  
  525.  
  526.  
  527.  
  528. print(Fore.CYAN + 'REF#:', ref_Num)
  529. time.sleep(.25)
  530. print(Fore.WHITE + Time)
  531. time.sleep(.25)
  532. print("Last:", "$" + str(Close_Price))
  533. time.sleep(.25)
  534. print("HLCC:", "$" + str(HLCC))
  535. time.sleep(.25)
  536. print("Money Price: ", "$" + str(round(M_Price, 2)))
  537. time.sleep(.25)
  538. print('Price Diff: ' + '$' + str(Diff))
  539. time.sleep(.25)
  540. if f_Vol > 1000000:
  541. print(Fore.YELLOW + 'Volume:' + '{:20,.2f}'.format(f_Vol))
  542. else:
  543. print(Fore.WHITE + 'Volume:' + '{:20,.2f}'.format(f_Vol))
  544. time.sleep(.25)
  545. if Money_Flow > 350000000:
  546. print(Fore.YELLOW + '$Flow:' + '{:20,.2f}'.format(Money_Flow))
  547. else:
  548. print(Fore.WHITE + '$Flow:' + '{:20,.2f}'.format(Money_Flow))
  549. time.sleep(.25)
  550. if Liq_change < 0:
  551. print(Fore.RED + 'Liq Change:', '{:20,.2f}'.format(Liq_change), Style.RESET_ALL)
  552. else:
  553. print(Fore.CYAN + 'Liq Change:', '{:20,.2f}'.format(Liq_change))
  554. time.sleep(.25)
  555. if Liquidity < 0:
  556. print(Fore.RED + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity), Style.RESET_ALL)
  557. else:
  558. print(Fore.CYAN + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity), Style.RESET_ALL)
  559. time.sleep(.25)
  560. if percent_Strength >= -.68:
  561. percent_Strength_String = Fore.GREEN+'Current Strength: '+str(percent_Strength)+'%'
  562. if percent_Strength <-.68:
  563. percent_Strength_String = Fore.RED+'Current Strength: '+str(percent_Strength)+'%'
  564. if percent_Strength < 1 and percent_Strength > -.99:
  565. percent_Strength_String = colored('Current Strength: '+'#N/A', 'white', 'on_grey', attrs=['blink'])
  566. cprint(percent_Strength_String)
  567. else:
  568. print(percent_Strength_String)
  569. new_Strength = 100-(100*abs(percent_Strength- -.3153) / .9333)
  570. if new_Strength > 70:
  571. new_Strength_String = Fore.CYAN+'Bullishness Percentile: '+str(round(new_Strength, 2))+'%'+Style.RESET_ALL
  572. else:
  573. new_Strength_String = Fore.RED+'Bullishness Percentile: '+str(round(new_Strength, 2))+'%'+Style.RESET_ALL
  574. lowAccuracy = round(low_Ranges_Filled/lows_found, 3)
  575. highAccuracy = round(high_Ranges_Filled/highs_found, 3)
  576. print(new_Strength_String)
  577. print('\nLow Ranges/Targets Found|Filled:',lows_found, '| ', low_Ranges_Filled, 'Accuracy: '+str(lowAccuracy)+'%')
  578. print('\nHigh Ranges/Targets Found|Filled: ',highs_found, '| ', high_Ranges_Filled, 'Accuracy: '+str(highAccuracy)+'%')
  579. print(found)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement