Advertisement
ImDerekD

Scratch017.py

May 10th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 57.11 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 hashlib
  16. import statistics
  17.  
  18. MIV_Spike_List = []
  19. MIV_Spike_Count = int()
  20. MIV_Spike = float()
  21. Avg_MIV_Spike = float()
  22. ShortPrice = float()
  23. LongPrice = float()
  24. ShortVolumeTotal = float()
  25. C_Price = float()
  26. S_Price = float()
  27. CoverLiquidity = float()
  28. ShortLiquidity = float()
  29. CoverCount = int()
  30. ShortCount = int()
  31.  
  32.  
  33. log = []
  34. lastFPrice = float()
  35. MP_List = []
  36. V_List = []
  37. count_M_items = int()
  38. count_V_items = int()
  39. V_Stdev = float()
  40. MP_Stdev = float()
  41. MV_Stdev = float()
  42. findPrice = float()
  43.  
  44.  
  45.  
  46. CoverPrice = float()
  47. CoverVolumeTotal = float()
  48. CoverMoney = float()
  49. ShortMoney = float()
  50.  
  51. TotalDiff = float()
  52.  
  53. with open('/Users/King/data.csv', 'r') as csv_file:
  54. csv_reader = csv.reader(csv_file)
  55. header = next(csv_reader)
  56.  
  57.  
  58. ref = [] # Start off w/ empty list
  59. ref_Num = int(0) # First to go in list = ref # (390 cells in 1 day)(using ref+=1 for each row)
  60. data = [] # Not sure but I could rearrange for liquidity?
  61. Liquidity = float()
  62. found = int(0)
  63. Range = []
  64. Target = []
  65. filled = bool
  66. filled_Price = float()
  67. Range_List = {}
  68. Low_Range_Found = {}
  69. High_Range_Found = {}
  70. ht_filled = bool
  71. hr_filled = bool
  72. lr_filled = bool
  73. lt_filled = bool
  74. lows_found = int()
  75. highs_found = int()
  76. Tick = int()
  77. Range_Found = {}
  78. range_ref_String = ('')
  79. dTime = []
  80. printRanges = str()
  81. range_identifier_low = 'Low'
  82. range_identifier_high = 'High'
  83. range_identifier_all = 'All'
  84. All_Range_References = []
  85. All_Referenced_Prices = []
  86. menu_ans = input('What would you like to do? \n [1] Print Liquidity Data | [2] See previous ranges | [3] RangeTargets File | [4] No-Stop-Data-Add [5] Current Info\n')
  87. if menu_ans == '1':
  88. Liquidity_Data = input('Would you like to print liquidity data? [y/n]: ')
  89. if menu_ans == '2':
  90. printRanges = input('Which ranges would you like to see?: [High/Low/All]\n')
  91. if menu_ans == '4':
  92. NoStop = True
  93. CandleDur = input('Candle Duration: ')
  94. else:
  95. NoStop = False
  96. if menu_ans == '3':
  97. option3 = True
  98. range_identifier = ''
  99. new_range = bool
  100. t = bool
  101. tLow = bool
  102. tHigh = bool
  103. Target = float()
  104. Range_Dict = {}
  105. TickString = str()
  106. Tick_String = ''
  107. Strength = int()
  108. StartTraceback = {}
  109. day_Count = int()
  110. tList = []
  111. last = float()
  112. LT = float()
  113. HT = float()
  114. last = float()
  115. ATR = float()
  116. OC_ATR = float()
  117. Avg_ATR = float()
  118. TrendStrength = ''
  119. Previous = []
  120. allfoundallfilled = {}
  121. lowfilled = float()
  122. highfilled = float()
  123. rangefilled = bool
  124. low_Ranges_Filled = int()
  125. high_Ranges_Filled = int()
  126. high_Targets_Filled = int()
  127. low_Targets_Filled = int()
  128. prevVol = float(1)
  129. prevFlow = float(1)
  130. prevIndexValue = float(1)
  131. prevPrice = float(1)
  132. Status = str('')
  133. RangeTarget = float()
  134. rFound = bool
  135. count = int(0)
  136. PCT_Range_Str = ''
  137.  
  138. sum_OC_Range = float()
  139. sum_HL_Range = float()
  140. sum_OHLC_Range = float()
  141. WarningString = ''
  142. sum_Liq = float()
  143. avg_Liq_change = float()
  144. HighRangeFlow = float()
  145. LowRangeFlow = float()
  146. LiqFlowPrice = float()
  147. LiqFlowPriceClone = float()
  148. EntryStr = str()
  149. OC_HL_RangePct = float()
  150. StrengthReference = float()
  151. AvgStrengthReference = float()
  152. counter = int()
  153.  
  154. liqList = []
  155. PULQ = bool
  156.  
  157. BuyVolume = float()
  158. BuyPower = float()
  159. ShortVolume = float()
  160. ShortPower = float()
  161. SellVolume = float()
  162. SellPower = float()
  163. BuySellRatio = float()
  164.  
  165.  
  166. Price1 = float()
  167. prevPrice1 = float()
  168. Last = float()
  169. gapDown = int()
  170. gapUp = int()
  171.  
  172. prevMPrice = float()
  173. prevMPrice2 = float()
  174. prevPrice1 = float()
  175. lastMPrice = float()
  176.  
  177.  
  178.  
  179. for row in csv_reader:
  180. range_ref_String = ''
  181. LRS = '$'
  182. LRT = '$'
  183. HRS = '$'
  184. HRT = '$'
  185. found_Price_String = '$'
  186. end_String = 'Price while found: $'
  187. # row = [Time, Open, Close, High, Low, realVol, Money_Flow]
  188. ref_Num += 1 # Starting at 0
  189. dTime = str(datetime.strptime(row[0], '%a %b %d %H:%M'))
  190. Time = dTime[-14:]
  191. Open_Price = float(row[1]) # Price Data Dictionary
  192. Close_Price = float(row[2]) # Price Data Dictionary
  193. High_Price = float(row[3]) # Price Data Dictionary
  194. Low_Price = float(row[4]) # Price Data Dictionary
  195. Money_Flow = float(row[6]) # Price Data Dictionary
  196. Vol = row[5] # Price Data Dictionary
  197. f_Vol = float(Vol[:-1]) # Price Data Dictionary
  198. m_Vol = str(Vol[-1:]) # Price Data Dictionary
  199. if m_Vol == "K": # Price Data Dictionary
  200. f_Vol = f_Vol * 1000 # Price Data Dictionary
  201. if m_Vol == "M": # Price Data Dictionary
  202. f_Vol = f_Vol * 1000000
  203. if m_Vol != "K" and m_Vol != "M":
  204. f_Vol = float(row[5]) # Price Data Dictionary
  205. if f_Vol < 1:
  206. M_Price = HLCC
  207. else:
  208. M_Price = round(float(Money_Flow) / f_Vol, 2)
  209. HLCC = float(High_Price + Low_Price + Close_Price + Close_Price)/4 # Price Data Dictionary & RangeReference Dictionary # Price Data Dictionary & RangeReference Dictionary
  210. Diff = round(HLCC - M_Price, 2)
  211. findDiff = round(M_Price - Close_Price, 2)
  212. TotalDiff += findDiff
  213. PivotPrice = round(Close_Price + TotalDiff, 2)
  214. if PivotPrice > Close_Price + .35:
  215. PivotStr = Fore.CYAN+str(PivotPrice)
  216. if PivotPrice < Close_Price - .35:
  217. PivotStr = Fore.RED+str(PivotPrice)
  218.  
  219. if abs(PivotPrice - Close_Price) < .35:
  220. PivotStr = Fore.YELLOW+str(PivotPrice) # Price Data Dictionary & RangeReference Dictionary & Data Dictionary
  221. MMM = float(f_Vol * HLCC) # Price Data Dictionary & RangeReference Dictionary & Data Dictionary
  222. Liq_change = float(Money_Flow - MMM) # Price Data Dictionary & RangeReference Dictionary & Data Dictionary
  223. Liquidity += Liq_change # Price Data Dictionary & RangeReference Dictionary & Data Dictionary
  224. Date = str(Time[:5]) # Important
  225. military_time = str(Time[-8:])
  226. criteria = abs(.003*HLCC)
  227. hashTime = hashlib.md5(str.encode(military_time))
  228. Liq_Tick = int()
  229. Price_Tick = int()
  230. tREF = int()
  231. rFound = False
  232.  
  233. OC_Range = abs(Close_Price - Open_Price)
  234. HL_Range = abs(High_Price - Low_Price)
  235. sum_OC_Range += OC_Range
  236. sum_HL_Range += HL_Range
  237.  
  238. sum_Liq += abs(Liq_change)
  239. liqList.append(sum_Liq)
  240. avg_HL_Range = float()
  241. avg_OC_Range = float()
  242. abs_Liq = abs(Liq_change)
  243. prevLiq = float()
  244. MP_List.append(Money_Flow)
  245. V_List.append(f_Vol)
  246.  
  247.  
  248. for i in MP_List:
  249. count_M_items += 1
  250.  
  251. for i in V_List:
  252. count_V_items += 1
  253.  
  254. if count_M_items >= 2:
  255. MP_Stdev = statistics.stdev(MP_List[-2:])
  256. MP_List.pop(0)
  257.  
  258. if count_V_items >= 2:
  259. V_Stdev = statistics.stdev(V_List[-2:])
  260. V_List.pop(0)
  261.  
  262. if count_M_items >= 1 and count_M_items >= 1:
  263. if V_Stdev >= 1:
  264. MV_Stdev = 100*round(MP_Stdev / V_Stdev, 2)
  265.  
  266.  
  267. findPrice = MV_Stdev / 100
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274. if ref_Num >=2:
  275. prevPrice1 = Close_Price
  276. prevMPrice = M_Price
  277. prevFPrice = findPrice
  278.  
  279.  
  280.  
  281. if ref_Num % 2 != 0:
  282. Price1 = Close_Price
  283. prevMPrice1 = M_Price
  284. prevFPrice1 = findPrice
  285.  
  286. if ref_Num % 2 == 0:
  287. Price2 = Close_Price
  288. prevMPrice2 = M_Price
  289. prevFPrice2 = findPrice
  290.  
  291.  
  292. if ref_Num % 2 != 0 and ref_Num > 2:
  293. Last = Price2
  294. lastMPrice = prevMPrice2
  295. lastFPrice = prevFPrice2
  296.  
  297.  
  298. if ref_Num % 2 == 0 and ref_Num >= 2:
  299. Last = Price1
  300. lastMPrice = prevMPrice1
  301. lastFPrice = prevFPrice1
  302.  
  303.  
  304.  
  305. percent_Strength = Strength / ref_Num
  306. allData = [ref_Num,Date, military_time, High_Price,Low_Price,Close_Price, HLCC, M_Price, f_Vol, Money_Flow,MMM, Liquidity,Liq_change]
  307. Data_Dict = {'REF#':[ref_Num],'Date':[Date],'Time':[military_time], 'Close_Price':[Close_Price], 'M_Price':[M_Price], 'Volume':[f_Vol]}
  308. '''USING THIS DATA
  309. [0]REFERENCE NUMBER
  310. [1]DATE
  311. [2]MILITARY_TIME
  312. [3]HIGH_PRICE
  313. [4]LOW_PRICE
  314. [5]CLOSE_PRICE
  315. [6]HLCC
  316. [7]M_Price
  317. [8]F_VOL
  318. [9]MONEY_FLOW
  319. [10]MARKETMAKERMOVE 'MMM'
  320. [11]LIQUIDITY
  321. [12]LIQ_CHANGE
  322. '''
  323.  
  324.  
  325.  
  326. if abs(allData[7]-allData[6]) >= criteria:
  327. diff = abs(M_Price - Close_Price)
  328. Range_Clause = True
  329. range_identifier_all = 'All'
  330. else:
  331. Range_Clause = False
  332. if Range_Clause == True:
  333. r_price = M_Price
  334. found_Price = HLCC
  335. Low_Range = round(HLCC - abs(float(M_Price - HLCC)), 2)
  336. High_Range = round(HLCC + abs(float(M_Price - HLCC)), 2)
  337. Low_Target = round(Low_Range - abs(float(M_Price - HLCC)), 2)
  338. High_Target = round(High_Range + abs(float(M_Price - HLCC)), 2)
  339. RT_Reference1 = [Low_Range, High_Range, Low_Target, High_Target]
  340. LRS = '$' + str(Low_Range)
  341. LRT = '$' + str(Low_Target)
  342. HRS = '$' + str(High_Range)
  343. HRT = '$' + str(High_Target)
  344. found_Price_String = '$' + str(found_Price)
  345. RT_Reference = [LRS, LRT, HRS, HRT]
  346. lows = [LRS, LRT]
  347. highs = [HRS, HRT]
  348. range_ref_String = range_ref_String
  349. target_String = range_ref_String + ': $'
  350. end_String = 'Price while found: $' + str(Close_Price)
  351. Target_String = '$' + str(Target)
  352.  
  353. LiqFlowPrice = .01*round(Money_Flow / abs(Liq_change), 3)
  354. VolLiqPrice = round(f_Vol / abs(Liq_change), 2)
  355. LiqFlowPriceClone = round(1000 * (abs(Liq_change) / Money_Flow), 4) * .01
  356.  
  357.  
  358. if M_Price >= High_Range:
  359. found += 1
  360. range_ref_String = "HIGH TARGET"
  361. tHigh = True
  362. RangeTarget = High_Target
  363. Target = M_Price
  364. range_identifier = 'High'
  365. found_Price = HLCC
  366. range_identifier_all = 'All'
  367. thList = ['HIGH TARGET', High_Target, highfilled]
  368. filled = False
  369. ht_filled = False
  370. hr_filled = False
  371. highs_found += 1
  372. rFound = True
  373. HighRangeFlow += Money_Flow
  374. elif M_Price<= Low_Range:
  375. found += 1
  376. range_ref_String = "LOW TARGET"
  377. tLow = True
  378. RangeTarget = Low_Target
  379. Target = M_Price
  380. range_identifier = 'Low'
  381. range_identifier_all = 'All'
  382. found_Price = HLCC
  383. tlList = ['LOW TARGET', Low_Target, lowfilled]
  384. filled = False
  385. lt_filled = False
  386. lr_filled = False
  387. lows_found += 1
  388. rFound = True
  389. LowRangeFlow += Money_Flow
  390.  
  391. if lows_found > 0:
  392. AvgLowRangeFlow = LowRangeFlow / lows_found
  393. if highs_found > 0:
  394. AvgHighRangeFlow = HighRangeFlow / highs_found
  395.  
  396.  
  397. if printRanges == range_identifier and range_identifier == range_identifier_low:
  398. Low_Range_Reference = [Date, military_time, range_ref_String, Target_String, end_String]
  399. Low_Range_Found = {'\nData Found':Low_Range_Reference, 'Watch for: $':lows, 'Potential Resistance: ':highs}
  400. Low_Range = Low_Range_Found
  401. for k, v in dict.items(Low_Range):
  402. print(Fore.RED, k, v)
  403.  
  404. if printRanges == range_identifier and range_identifier == range_identifier_high:
  405. High_Range_Reference = [Date, military_time, range_ref_String, end_String]
  406. High_Range_Found = {'\nData Found': High_Range_Reference, 'Watch for: $':highs, 'Potential Support: ':lows}
  407. High_Range = High_Range_Found
  408. for k, v in dict.items(High_Range):
  409. print(Fore.CYAN, k, v)
  410.  
  411. elif printRanges == range_identifier_all:
  412. if range_ref_String == 'LOW TARGET' or range_ref_String == 'HIGH TARGET':
  413. money_string = '$'
  414. Target_String = '$' + str(Target)
  415. Close_Price_String = money_string+str(Close_Price)
  416. Range_Reference = [Date, military_time, Close_Price_String, range_ref_String, Target_String]
  417. Low_Ranges = [LRS, LRT]
  418. High_Ranges = [HRS, HRT]
  419. Range_Found = {'<-- Reference':Range_Reference, 'Low Ranges':Low_Ranges, 'High Ranges':High_Ranges, 'REF#':ref_Num}
  420. Range_List[ref_Num] = Range_Found
  421. text = colored(str(found)+' '+str(Range_Found), 'cyan', 'on_grey', attrs=['reverse'])
  422. cprint(text)
  423.  
  424.  
  425. '''if Range_Clause == True:
  426. if range_ref_String == "HIGH TARGET" and Money_Flow < 300000000:
  427. print("MARKET MAKER HIGH TARGET")
  428. if range_ref_String == "LOW TARGET" and Money_Flow > 300000000:
  429. print("MARKET MAKER LOW TARGET")'''
  430.  
  431. else:
  432. Range_Clause = False
  433. tHigh = False
  434. tLow = False
  435. rFound = False
  436.  
  437.  
  438.  
  439.  
  440. if menu_ans == '1' and Liquidity_Data == 'y':
  441.  
  442.  
  443. avg_HL_Range = sum_HL_Range / ref_Num
  444. avg_OC_Range = sum_OC_Range / ref_Num
  445. avg_Liq_change = sum_Liq / ref_Num
  446.  
  447.  
  448.  
  449.  
  450. if Money_Flow > 0:
  451. MIV_Index = round(100 * (f_Vol / prevVol) - 100 * ((Money_Flow * HLCC) / (prevFlow * prevPrice)), 3)
  452. runningValueIndex = round(MIV_Index + prevIndexValue, 3)
  453. prevPrice = Close_Price
  454. prevFlow = Money_Flow
  455. prevVol = f_Vol
  456. prevIndexValue = MIV_Index
  457. MIV_Index_String = str(MIV_Index)
  458. runningValueIndex_String = str(runningValueIndex)
  459. MIV_Index_String = str(round(MIV_Index, 2))
  460.  
  461.  
  462. if abs(Liq_change) > 0:
  463. LFP = round(Money_Flow / abs(Liq_change) *.01, 3)
  464. LFPC = round(10000 * (abs(Liq_change) / Money_Flow) * .01, 4)
  465.  
  466. if LFP < 13 and LFPC < .085:
  467. LFP_WarningStr = 'FKN SELL THIS SHIT SON %s' % LFP
  468. LFP_WarningStr_clr = colored(LFP_WarningStr, 'red', attrs=['bold','blink'])
  469. # print(LFP_WarningStr_clr)
  470.  
  471. if LFP < 20 and LFP > 13:
  472. LFP_WarningStr = 'FKN BUY THIS SHIT SON %s' % LFP
  473. LFP_WarningStr_clr = colored(LFP_WarningStr, 'cyan', attrs=['bold','blink'])
  474. # print(LFP_WarningStr_clr)
  475.  
  476.  
  477.  
  478. if abs(MIV_Index) >= .25 and ref_Num > 1:
  479. MIV_Spike += abs(MIV_Index)
  480. MIV_Spike_Count += 1
  481. MIV_Spike_List.append(abs(MIV_Index))
  482. Avg_MIV_Spike = round(MIV_Spike / MIV_Spike_Count, 3)
  483. if abs(MIV_Index) >= .25 and ref_Num > 1:
  484. Avg_MIV_Spike_String = str(Avg_MIV_Spike)
  485. if MIV_Index > 0:
  486. MIV_Index_String = str(round(MIV_Index, 2))
  487. 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+'Avg Spike: '+Style.RESET_ALL+Fore.BLACK+Back.RED+'[+',Avg_MIV_Spike,'%]'+Style.RESET_ALL+Fore.WHITE+'Volume:'+'{:,.2f}'.format(f_Vol)+Style.RESET_ALL)
  488.  
  489. elif MIV_Index < 0:
  490. MIV_Index_String = str(round(MIV_Index, 2))
  491. 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+Style.BRIGHT+'Avg Spike: '+Style.RESET_ALL+Fore.BLACK+Back.CYAN+'[',Avg_MIV_Spike,'%]'+Style.RESET_ALL+Fore.WHITE+'Volume:'+'{:,.2f}'.format(f_Vol)+Style.RESET_ALL)
  492.  
  493.  
  494. if Close_Price >= Open_Price and Liq_change > 0:
  495. Price_Tick = 1
  496. Liq_Tick = 1
  497. BuyVolume += f_Vol
  498. BuyPower += Liq_change
  499. SellPower += Liq_change * -1
  500.  
  501. if Liquidity < 0:
  502. ShortPower += Liq_change*-1
  503.  
  504. PULQ = False
  505. elif Close_Price >= Open_Price and Liq_change < 0:
  506. Price_Tick = 0
  507. Liq_Tick = -1
  508. ShortVolume += f_Vol
  509. BuyVolume += Liq_change * -1
  510. ShortPower += Liq_change * -1
  511. ShortVolumeTotal += f_Vol
  512. ShortMoney += Money_Flow
  513. ShortCount += 1
  514. ShortLiquidity += abs(Liq_change)
  515. S_Price += HLCC
  516.  
  517. PULQ = True
  518. elif Close_Price <= Open_Price and Liq_change > 0:
  519. Price_Tick = -1
  520. Liq_Tick = 0
  521. ShortPower += Liq_change
  522. BuyPower += Liq_change
  523. SellPower += Liq_change
  524. CoverVolumeTotal += f_Vol
  525. CoverMoney += Money_Flow
  526. CoverCount += 1
  527. CoverLiquidity += Liq_change
  528. C_Price += HLCC
  529.  
  530.  
  531. PULQ = False
  532. elif Close_Price <= Open_Price and Liq_change < 0:
  533. Price_Tick = -1
  534. Liq_Tick = -1
  535. SellVolume += f_Vol
  536. SellPower += abs(Liq_change)
  537. BuyPower += Liq_change
  538.  
  539.  
  540.  
  541. PULQ = False
  542. Tick = Liq_Tick + Price_Tick
  543. Strength += Tick
  544. percent_Strength = round(Strength / ref_Num, 4)
  545. new_Strength = round(100-(100*abs(percent_Strength- -.3153) / .8794), 2)
  546. SS = str(new_Strength)
  547. abs_Liq = abs(Liq_change)
  548. counter += 1
  549.  
  550. if ShortCount >= 1:
  551. ShortPrice = round(S_Price / ShortCount, 2)
  552.  
  553. if CoverCount >= 1:
  554. CoverPrice = round(C_Price / CoverCount, 2)
  555.  
  556.  
  557. if ref_Num < 10:
  558. AvgStrengthReference += new_Strength
  559. if ref_Num == 20:
  560. AvgStrengthReference = StrengthReference / ref_Num
  561. StrengthReference = AvgStrengthReference
  562. counter = 1
  563. if ref_Num >= 20:
  564. counter += 1
  565. AvgStrengthReference = AvgStrengthReference + new_Strength
  566.  
  567. if counter < 20 and counter >= 1:
  568. AvgStrengthReference = AvgStrengthReference / counter
  569. StrengthReference = (AvgStrengthReference + new_Strength) / counter
  570.  
  571. if counter == 20:
  572. counter = counter * 0
  573. AvgStrengthReference = AvgStrengthReference * 0 + StrengthReference
  574. StrengthReference = StrengthReference
  575.  
  576.  
  577.  
  578. if M_Price == lastMPrice:
  579. WarningString = '!!!'
  580. if OC_Range >= avg_HL_Range:
  581. if Liq_change > avg_Liq_change:
  582. if Close_Price > Open_Price:
  583. WarningString = Fore.CYAN+'[xxx]'+Style.RESET_ALL
  584. if Close_Price < Open_Price:
  585. WarningString = Fore.RED+'[xxx]'+Style.RESET_ALL
  586. else:
  587. WarningString = Fore.YELLOW+'[xxx]'
  588.  
  589. else:
  590. WarningString = ''
  591.  
  592. if PULQ == True and OC_Range <= avg_OC_Range *.3:
  593. if abs(Liq_change) < 500 and Liq_change < 0:
  594. if abs(Liq_change) < avg_Liq_change * .05:
  595. WarningString = '[*]'
  596. else:
  597. WarningString = ''
  598.  
  599.  
  600.  
  601.  
  602. OC_RangePct = round(OC_Range / avg_OC_Range * 100, 2)
  603. HL_RangePct = round(HL_Range / avg_HL_Range * 100, 2)
  604.  
  605. if abs(OC_Range) > 0 and abs(HL_Range) > 0:
  606. RangePct = round(OC_Range / (HL_Range / avg_HL_Range) * 1000, 4)
  607. OCHL_RangePct = round(OC_Range / HL_Range * 100, 4)
  608. OC_HL_RangePctStr = str(OC_HL_RangePct)+'%'
  609. OCHL_RangePctStr = str(OC_HL_RangePct)+'%'
  610. else:
  611. OCHL_RangePctStr = ''
  612. OC_HL_RangePctStr = ''
  613.  
  614. if M_Price == lastMPrice and OC_Range < avg_OC_Range:
  615. if abs(Liq_change) > avg_Liq_change * .5 or abs(Liq_change) > 1000:
  616. if Liquidity > 0:
  617. if OC_HL_RangePct < 10:
  618. if Close_Price < M_Price and last < lastMPrice:
  619. Tick_String = Fore.BLUE+Style.BRIGHT+Back.WHITE+'BULLISH ACCUMULATION'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
  620. if Close_Price >= M_Price:
  621. if lastMPrice >= lastMPrice or Close_Price == last:
  622. Tick_String = Fore.YELLOW+Style.BRIGHT+'BEARISH INV SHIFT'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
  623.  
  624. elif OC_HL_RangePct > 30:
  625. if Liq_change > 0 and Liq_change < 1000:
  626. Tick_String = Fore.YELLOW+Style.BRIGHT+Back.BLUE+'BREAKDOWN POTENTIAL'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
  627. elif Liq_change < 0:
  628. Tick_String = Style.BRIGHT+Back.CYAN+'BREAKOUT POTENTIAL'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
  629.  
  630. if Liquidity < 0:
  631. Tick_String = Fore.RED+'SHORT COVERING (TOP)'+Style.RESET_ALL+WarningString+' '
  632.  
  633. elif OC_HL_RangePct < 10:
  634. if Liq_change > 100:
  635. Tick_String = Style.BRIGHT+Fore.BLUE+Back.YELLOW+'BOTTOM FEEDERS'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
  636. if abs(Liq_change) < 100:
  637. if HL_RangePct < 50:
  638. Tick_String = Fore.YELLOW+Style.BRIGHT+Back.RED+'LARGE DISTRIBUTION'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
  639. if HL_RangePct > 50:
  640. Tick_String = Fore.BLUE+Style.BRIGHT+Back.CYAN+'MASSIVE ACCUMULATION'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
  641.  
  642. elif abs(Liq_change) < avg_Liq_change * .2 and abs(Liq_change) < 1000:
  643. if HL_RangePct >= 100 and OC_RangePct < 10:
  644. if OC_HL_RangePct > 50:
  645. if Close_Price == Last:
  646. Tick_String = Fore.RED+Style.BRIGHT+Back.YELLOW+'LARGE DISTRIBUTION'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
  647. elif HL_Range >= 100 and Close_Price > lastMPrice:
  648. Tick_String = Fore.BLUE+Style.BRIGHT+Back.WHITE+'LARGE ACCUMULATION'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
  649. elif HL_RangePct > 50 and OC_RangePct > 50:
  650. if Liquidity < 0:
  651. Tick_String = Fore.WHITE+Back.RED+'POTENTIAL SQUEEZE'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
  652. if Liquidity > 0:
  653. if Close_Price < lastMPrice:
  654. Tick_String = Fore.CYAN+Back.BLUE+'HIDDEN BUYERS'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
  655. if Close_Price > lastMPrice:
  656. Tick_String = Fore.BLUE+Back.WHITE+Style.DIM+'HIDDEN SELLERS'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
  657.  
  658.  
  659. else:
  660. if Close_Price >= M_Price and last >= lastMPrice:
  661. Tick_String = Fore.RED+Back.WHITE+Style.BRIGHT+'BEARS RUN IT'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
  662. if Close_Price < M_Price and last < lastMPrice:
  663. Tick_String = Fore.CYAN+Back.BLUE+'BULLS RUN IT'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
  664.  
  665.  
  666.  
  667. if M_Price == lastMPrice and Tick == -1:
  668. if OC_Range >= avg_HL_Range and Liq_Tick == -1:
  669. Tick_String = Fore.RED+Back.YELLOW+Style.BRIGHT+'GET THE FUCK OUT'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
  670. elif M_Price == lastMPrice:
  671. if LFP <= 10:
  672. if LFP < 1:
  673. Tick_String = 'DIP COMING'+Style.RESET_ALL+WarningString+' %s' % LFP
  674. elif LFP > 1:
  675. Tick_String = Style.BRIGHT+'BUY THE SHIT'+Style.RESET_ALL+WarningString+' %s' % LFP
  676. elif LFP > 70:
  677. Tick_String = Fore.WHITE+Style.BRIGHT+'REVERSAL'+Style.RESET_ALL+WarningString+' %s' % LFP
  678. elif LFP <= 20 and LFP >= 10:
  679. Tick_String = Fore.RED+Style.BRIGHT+'SELL THE SHIT'+Style.RESET_ALL+WarningString+' %s' % LFP
  680. else:
  681. if Liq_change > 0:
  682. Tick_String = Fore.RED+Style.BRIGHT+Back.WHITE+'BEARISH DISTRIBUTION'+Style.RESET_ALL+WarningString+' %s' % LFP
  683. if Liq_change < 0:
  684. Tick_String = Fore.BLUE+Style.BRIGHT+Back.WHITE+'BULLISH DISTRIBUTION'+Style.RESET_ALL+WarningString+' %s' % LFP
  685.  
  686.  
  687. else:
  688.  
  689. if Tick == 2:
  690. if abs_Liq >= avg_Liq_change*1.5:
  691. if Liquidity > 0:
  692. Tick_String = Fore.GREEN+Style.BRIGHT+'AGGRESSIVE BUYERS'+Style.RESET_ALL+WarningString+' '
  693.  
  694. else:
  695. Tick_String = Fore.GREEN+Back.RED+Style.BRIGHT+'BEARISH BUYING'+Style.RESET_ALL+WarningString+' '
  696.  
  697. elif abs_Liq >= avg_Liq_change:
  698. Tick_String = Fore.GREEN+Style.BRIGHT+'STRONG BUYERS'+Style.RESET_ALL+WarningString+' '
  699.  
  700. else:
  701. Tick_String = Fore.BLUE+Back.GREEN+'UPTICK'+Style.RESET_ALL+WarningString+' '
  702.  
  703. if Tick == -1 and Price_Tick == 0:
  704. if Liq_Tick == -1:
  705. if abs(Liq_change) < 300 and OC_Range <= avg_OC_Range *.3:
  706. if WarningString == '[*]':
  707. if new_Strength < 60:
  708. Tick_String = Fore.RED+Style.BRIGHT+Back.YELLOW+'<SELL ENTRY>'+Style.RESET_ALL+WarningString+' '
  709. if new_Strength > 60 or StrengthReference >= 65:
  710. Tick_String = Fore.BLUE+Style.BRIGHT+Back.YELLOW+'<BUY ENTRY>'+Style.RESET_ALL+WarningString+' '
  711.  
  712. # if WarningString == '':
  713. # Tick_String = Fore.BLUE+Style.BRIGHT+Back.YELLOW+'<BUY ENTRY>'+Style.RESET_ALL+WarningString+' '
  714. #
  715. elif WarningString == '':
  716. if new_Strength < 50 and new_Strength > 20:
  717. Tick_String = Fore.YELLOW+Style.BRIGHT+'BREAKDOWN'+Style.RESET_ALL+WarningString+' '
  718.  
  719. elif new_Strength < StrengthReference and StrengthReference < 65:
  720. Tick_String = Fore.YELLOW+Style.BRIGHT+'BREAKDOWN'+Style.RESET_ALL+WarningString+' '
  721. elif new_Strength > 90:
  722. Tick_String = Fore.YELLOW+Style.BRIGHT+'BREAKDOWN'+Style.RESET_ALL+WarningString+' '
  723.  
  724. elif new_Strength >= StrengthReference or StrengthReference >= 65:
  725. Tick_String = Fore.CYAN+Style.BRIGHT+'BREAKOUT'+Style.RESET_ALL+WarningString+' '
  726. elif new_Strength <= 20:
  727. Tick_String = Fore.CYAN+Style.BRIGHT+'BREAKOUT'+Style.RESET_ALL+WarningString+' '
  728.  
  729. elif abs(Liq_change) < 300 and avg_Liq_change * .05:
  730. if WarningString == '[*]':
  731. if new_Strength > StrengthReference:
  732. Tick_String = Fore.WHITE+Style.BRIGHT+Back.BLUE+'<VOLATILITY COMING (UPSIDE)>'+Style.RESET_ALL+WarningString+' '
  733. if new_Strength < StrengthReference:
  734. Tick_String = Fore.WHITE+Style.BRIGHT+Back.RED+'<VOLATILITY COMING (DOWNSIDE)>'+Style.RESET_ALL+WarningString+' '
  735.  
  736. else:
  737. Tick_String = Fore.RED+Style.BRIGHT+Back.YELLOW+'<VOLATILITY COMING>'+Style.RESET_ALL+WarningString+' '
  738.  
  739.  
  740.  
  741. else:
  742. Tick_String = Fore.WHITE+'PRICE UP LIQ DOWN'+Style.RESET_ALL+WarningString+' '
  743.  
  744. if Tick == -2:
  745. if abs_Liq < avg_Liq_change:
  746. Tick_String = Fore.BLUE+'PROFIT TAKING'+Style.RESET_ALL+WarningString+' '
  747.  
  748. if abs_Liq > avg_Liq_change*.75:
  749. Tick_String = Fore.RED+Style.BRIGHT+'STRONG SELLERS'+Style.RESET_ALL+WarningString+' '
  750.  
  751. if Tick == -1 and Liq_Tick == 0:
  752. prevLiq = Liquidity - Liq_change
  753. if abs_Liq >= avg_Liq_change*.8 and prevLiq < 0:
  754. Tick_String = Fore.RED+Style.BRIGHT+'AGGRESSIVE COVERING'+Style.RESET_ALL+WarningString+' '
  755.  
  756. if OC_Range >= avg_HL_Range*.9 and abs_Liq < avg_Liq_change*.75:
  757. Tick_String = Fore.RED+Style.BRIGHT+'MM\'s BEARISH'+WarningString+' '
  758.  
  759. elif abs_Liq < avg_Liq_change*.25 and OC_Range < avg_HL_Range:
  760. Tick_String = Fore.YELLOW+'DIP BUYERS'+Style.RESET_ALL+WarningString+' '
  761.  
  762. else:
  763. Tick_String = Fore.CYAN+'PRICE DOWN LIQ UP'+Style.RESET_ALL+WarningString+' '
  764.  
  765.  
  766. Range_List[ref_Num] = Range_Found
  767. # else:
  768. # Tick_String = Fore.WHITE+'PRICE UP LIQ DOWN'+Style.RESET_ALL+WarningString+' '+Fore.WHITE+str(Strength)
  769.  
  770.  
  771. # if abs(Liq_change) <= avg_Liq_change:
  772. # Tick_String = Fore.RED+'SHORT RALLY'+Style.RESET_ALL+WarningString+' '+Fore.RED+str(Strength)
  773. # # else:
  774. # Tick_String = Fore.WHITE+'PRICE UP LIQ DOWN'+Style.RESET_ALL+WarningString+' '+Fore.WHITE+str(Strength)
  775.  
  776. # if Tick == -1 and Liq_Tick == 0:
  777. # if Liquidity < 0:
  778. # if abs(Liq_change) > avg_Liq_change*2:
  779. # Tick_String = Fore.RED+'MM\'s BEARISH'+Style.RESET_ALL+WarningString+' '+Fore.YELLOW+str(Strength)
  780. # else:
  781. # Tick_String = Fore.RED+'SHORT COVERING'+Style.RESET_ALL+WarningString+' '+Fore.YELLOW+Back.BLUE+Style.BRIGHT+str(Strength)
  782.  
  783. Range_List[ref_Num] = Range_Found
  784. else:
  785.  
  786. if Range_Clause == True:
  787. if range_ref_String == "HIGH TARGET" and Money_Flow < 300000000:
  788. if Liq_change > 1000000:
  789. print("MARKET MAKER HIGH TARGET")
  790. if range_ref_String == "LOW TARGET" and Money_Flow > 300000000:
  791. if Liq_change < 1000000:
  792. print("MARKET MAKER LOW TARGET")
  793.  
  794. if lr_filled == False:
  795. if filled == False:
  796. if range_ref_String == "LOW TARGET" and Low_Price <= Low_Range:
  797. filled_Price = Low_Price
  798. time.sleep(.5)
  799. print(Fore.WHITE + Back.RED + "LOW RANGE FILLED" + Style.RESET_ALL)
  800. time.sleep(1)
  801. lr_filled = True
  802. lt_filled = False
  803. lrf = 1
  804. low_Ranges_Filled += lrf
  805. if lt_filled == False and lr_filled == True:
  806. if Close_Price <= Low_Target:
  807. filled_target_price = Close_Price
  808. time.sleep(.5)
  809. print(Fore.RED + Back.YELLOW + 'LOW TARGET FILLED' + Style.RESET_ALL)
  810. time.sleep(1)
  811. lt_filled = True
  812. filled = True
  813. low_Targets_Filled += 1
  814. if hr_filled == False:
  815. if filled == False:
  816. if range_ref_String == "HIGH TARGET" and High_Price >= High_Range:
  817. filled_range_price = High_Price
  818. time.sleep(.5)
  819. print(Fore.CYAN + "HIGH RANGE FILLED" + Style.RESET_ALL)
  820. time.sleep(1)
  821. hr_filled = True
  822. ht_filled = False
  823. hrf = 1
  824. high_Ranges_Filled += hrf
  825. if ht_filled == False and hr_filled == True:
  826. if Close_Price >= High_Target:
  827. filled_target_price = High_Price
  828. print(Fore.CYAN + "HIGH TARGET FILLED")
  829. time.sleep(1)
  830. ht_filled = True
  831. filled = True
  832. high_Targets_Filled += 1
  833.  
  834.  
  835. if menu_ans == '4' or menu_ans == '1':
  836. if rFound == True:
  837. if tHigh == True:
  838. HRS = str(High_Range)
  839. HRT = str(High_Target)
  840. LRS = str(Low_Range)
  841. LRT = str(Low_Target)
  842. MIV_Index_String = str(MIV_Index)
  843.  
  844. 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+']'+Fore.WHITE+' '+MIV_Index_String+'%'+Style.RESET_ALL+Fore.CYAN+' Avg High Flow: $'+'{:20,.2f}'.format(AvgHighRangeFlow), 'MoneyFlow: $','{:20,.2f}'.format(Money_Flow)+Style.RESET_ALL+Fore.WHITE+'Volume: '+'{:20,.2f}'.format(f_Vol))
  845. time.sleep(2)
  846.  
  847.  
  848. else:
  849. tHigh = False
  850. else:
  851. rFound = False
  852. Close_Price = Close_Price
  853.  
  854. if rFound == True:
  855. if tLow == True:
  856. HRS = str(High_Range)
  857. HRT = str(High_Target)
  858. LRS = str(Low_Range)
  859. LRT = str(Low_Target)
  860. lowFlow = str(AvgLowRangeFlow)
  861. flow = str(Money_Flow)
  862. MIV_Index_String = str(MIV_Index)
  863.  
  864. Low_Prices = {'LOW RANGE: $': Low_Range, 'LOW TARGET: $': Low_Target} ##### May not need this line
  865. 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+']'+Fore.WHITE+' '+MIV_Index_String+'%'+Style.RESET_ALL+Fore.RED+' Avg Low Flow: $','{:20,.2f}'.format(AvgLowRangeFlow),'MoneyFlow: $','{:20,.2f}'.format(Money_Flow)+Style.RESET_ALL+Fore.WHITE+'Volume: '+'{:20,.2f}'.format(f_Vol))
  866. time.sleep(2)
  867.  
  868. else:
  869. tLow = False
  870. else:
  871. rFound = False
  872.  
  873.  
  874. if Liq_change < -1000000:
  875. print(Fore.YELLOW + '[' + Date + ']', military_time,PCT_Range_Str,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, M_Price)
  876. time.sleep(1)
  877. if abs(Liq_change) > 500000:
  878. time.sleep(.005)
  879. print(Fore.CYAN + '[' + Date + ']', military_time,PCT_Range_Str,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 + ' ' + Fore.WHITE+SS+'%'+Style.RESET_ALL, M_Price, PivotStr)
  880. elif Liquidity > 0:
  881. if Liq_change > 0:
  882. time.sleep(.005)
  883. print(Fore.YELLOW + '[' + Date + ']', military_time,PCT_Range_Str,
  884. Fore.GREEN + 'Current Liquidity:' + '{:20,.2f}'.format(
  885. Liquidity) + Fore.GREEN + ' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + ' ' + Fore.YELLOW + Back.BLUE,'Last Price [$' + str(Close_Price) + '] ' + Style.RESET_ALL+ Tick_String + Style.RESET_ALL+Fore.WHITE+' '+SS+'%'+Style.RESET_ALL, M_Price, PivotStr)
  886. if Liq_change < 0:
  887. time.sleep(.005)
  888. print(Fore.YELLOW + '[' + Date + ']', military_time,PCT_Range_Str,
  889. Fore.GREEN + 'Current Liquidity:' + '{:20,.2f}'.format(
  890. 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) + '] ' + Style.RESET_ALL+ Tick_String + Style.RESET_ALL+Fore.WHITE+' '+SS+'%'+Style.RESET_ALL, M_Price, PivotStr)
  891. elif Liq_change > 0:
  892. time.sleep(.005)
  893. print(Fore.YELLOW + '[' + Date + ']', military_time,PCT_Range_Str,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) + '] ' +Style.RESET_ALL + Tick_String + Style.RESET_ALL + ' ' + Fore.WHITE+SS+'%'+Style.RESET_ALL, M_Price, PivotStr)
  894. elif Liq_change < 0:
  895. time.sleep(.005)
  896. print(Fore.YELLOW + '[' + Date + ']', military_time,PCT_Range_Str,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) + '] ' +Style.RESET_ALL + Tick_String+ Style.RESET_ALL + ' ' + Fore.WHITE+SS+'%'+Style.RESET_ALL, M_Price, PivotStr)
  897.  
  898.  
  899.  
  900.  
  901. '''if runningValueIndex > 0 and MIV_Index > 0:
  902. print(' '+Fore.BLACK+Back.WHITE+'MIV_Index:+'+MIV_Index_String+'% '+Style.RESET_ALL+' '+Fore.BLACK+Back.GREEN+'Running Value:+'+runningValueIndex_String+'%'+Style.RESET_ALL)
  903. if MIV_Index < 0 and runningValueIndex > 0:
  904. print(' '+Fore.RED+Back.YELLOW+'MIV_Index:'+MIV_Index_String+'% '+Style.RESET_ALL+' '+Fore.BLACK+Back.GREEN+'Running Value:+'+runningValueIndex_String+'%'+Style.RESET_ALL)
  905. if MIV_Index > 0 and runningValueIndex < 0:
  906. print(' '+Fore.WHITE+'MIV_Index:+'+MIV_Index_String+'% '+Style.RESET_ALL+' '+Fore.RED+Back.YELLOW+'Running Value:'+runningValueIndex_String+'%'+Style.RESET_ALL)
  907. if MIV_Index < 0 and runningValueIndex < 0:
  908. print(' '+Fore.RED+'MIV_Index:'+MIV_Index_String+'% '+Style.RESET_ALL+' '+Fore.RED+'Running Value:'+runningValueIndex_String+'%'+Style.RESET_ALL)'''
  909.  
  910. '''else:
  911. runningValueIndex += MIV_Index
  912. runningValueIndex_String = str(round(runningValueIndex, 2))
  913. if runningValueIndex > 0:
  914. print(Fore.GREEN+'MIV_Index: '+runningValueIndex_String, '%')
  915. else:
  916. runningValueIndex_String = str(round(runningValueIndex, 2))
  917. print(Fore.RED+'MIV_Index: '+runningValueIndex_String, '%')'''
  918.  
  919.  
  920. if menu_ans == '3':
  921. printRangeFile = input('Would you like to see other found ranges?: [y/n]')
  922. if printRangeFile == 'y':
  923. file_Choose = input('Which file would you like to use? [1 = 1 min Ranges] [2 = 2 min ranges] [5 = 5 min ranges]: ')
  924. if file_Choose == '1':
  925. filename = ('/Users/King/iFiles/iRanges/SPY1.csv')
  926. if file_Choose == '2':
  927. filename = ('/Users/King/iFiles/iRanges/SPY2.csv')
  928. if file_Choose == '5':
  929. filename = ('/Users/King/iFiles/iRanges/SPY5.csv')
  930. with open(filename, 'r') as csv_file:
  931. csv_reader = csv.reader(csv_file)
  932. for row in csv_reader:
  933. Date = row[0]
  934. Time = row[1]
  935. range_ref_String = row[2]
  936. Close_Price = float(row[3])
  937. M_Price = float(row[4])
  938. TargetPrice = row[5]
  939. Money_Flow = float(row[6])
  940. f_Vol = float(row[7])
  941. OppRange = row[8]
  942. OppTarget = row[9]
  943. Liquidity = float(row[10])
  944. Liq_change = float(row[11])
  945. LFP = float(row[12])
  946. MIVI = float(row[13])
  947. ref_Num = int(row[15])
  948. CandleDuration = str(row[14])
  949. list = [Date, Time, range_ref_String]
  950. Targets = [M_Price, TargetPrice]
  951. MIV_Index = str(MIVI) + str('%')
  952. LFP = str(round(LFP, 3))
  953. oppositePrices = [OppRange, OppTarget]
  954. Liq_change_String = str('$' + '{:20,.2f}'.format(Liq_change))
  955. listlist = []
  956. dict = {'': list, 'Targets: ':Targets, 'Found price: ':Close_Price,'Opposite Ranges/Targets':oppositePrices}
  957. range_info = {'MIV Index:': MIV_Index, 'Liq Change:':Liq_change_String,'Candle Duration:':CandleDuration, 'REF#':ref_Num}
  958. if MIVI < 0 and Liq_change > 0:
  959. infotext = colored(str(range_info), 'grey', 'on_cyan', attrs=['reverse', 'underline'])
  960. else:
  961. infotext = colored(str(range_info), 'grey', 'on_red', attrs=['reverse', 'underline'])
  962. for k, v in dict.items():
  963. time.sleep(.001)
  964. print(Fore.YELLOW, k, v)
  965. cprint(infotext)
  966. print('\n')
  967. break
  968.  
  969.  
  970.  
  971.  
  972. print('MIV Spike Count: ',MIV_Spike_Count)
  973. print('Avg MIV Spike',Avg_MIV_Spike,'%')
  974. print(Fore.CYAN + 'REF#:', ref_Num)
  975. time.sleep(.25)
  976. print(Fore.WHITE + Time)
  977. time.sleep(.25)
  978. print("Last:", "$" + str(Close_Price))
  979. time.sleep(.25)
  980. print("HLCC:", "$" + str(HLCC))
  981. time.sleep(.25)
  982. if HLCC >= M_Price:
  983. print(Fore.CYAN+"Money Price: "+" $" + str(round(M_Price, 2))+Style.RESET_ALL)
  984. time.sleep(.25)
  985. print(Fore.CYAN+'Price Diff: ' + '$' + str(Diff)+Style.RESET_ALL)
  986.  
  987. if HLCC < M_Price:
  988. print(Fore.RED+"Money Price: "+Fore.RED+" $" + str(round(M_Price, 2))+Style.RESET_ALL)
  989. time.sleep(.25)
  990. print(Fore.RED+'Price Diff: ' + '$' + str(Diff)+Style.RESET_ALL)
  991.  
  992.  
  993. time.sleep(.25)
  994. if f_Vol > 1000000:
  995. print(Fore.YELLOW + 'Volume:' + '{:20,.2f}'.format(f_Vol))
  996. else:
  997. print(Fore.WHITE + 'Volume:' + '{:20,.2f}'.format(f_Vol))
  998. time.sleep(.25)
  999. if Money_Flow > 350000000:
  1000. print(Fore.YELLOW + '$Flow:' + '{:20,.2f}'.format(Money_Flow))
  1001. else:
  1002. print(Fore.WHITE + '$Flow:' + '{:20,.2f}'.format(Money_Flow))
  1003. time.sleep(.25)
  1004. if Liq_change < 0:
  1005. print(Fore.RED + 'Liq Change:', '{:20,.2f}'.format(Liq_change), Style.RESET_ALL)
  1006. else:
  1007. print(Fore.CYAN + 'Liq Change:', '{:20,.2f}'.format(Liq_change))
  1008. time.sleep(.25)
  1009. if Liquidity < 0:
  1010. print(Fore.RED + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity), Style.RESET_ALL)
  1011. else:
  1012. print(Fore.CYAN + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity), Style.RESET_ALL)
  1013. time.sleep(.25)
  1014. print('Avg MIV Spike: ',Avg_MIV_Spike,'%')
  1015. if percent_Strength >= -.68:
  1016. percent_Strength_String = Fore.GREEN+'Current Strength: '+str(percent_Strength)+'%'
  1017. print(percent_Strength_String)
  1018. if percent_Strength <-.68:
  1019. percent_Strength_String = Fore.RED+'Current Strength: '+str(percent_Strength)+'%'
  1020. print(percent_Strength_String)
  1021.  
  1022. new_Strength = 100-(100*abs(percent_Strength- -.3153) / .8794)
  1023. if new_Strength > 70:
  1024. new_Strength_String = Fore.CYAN+'Bullishness Percentile: '+str(round(new_Strength, 2))+'%'+Style.RESET_ALL
  1025. else:
  1026. new_Strength_String = Fore.RED+'Bullishness Percentile: '+str(round(new_Strength, 2))+'%'+Style.RESET_ALL
  1027. print(new_Strength_String)
  1028. pctShortBuying = round(BuyPower / ShortPower, 4)*100
  1029. pctNetSelling = round(SellPower / ShortPower, 4)*100
  1030. pctNetBuying = round(BuyPower / SellPower, 4)*100
  1031. pctNetBuyingStr = str(pctNetBuying)
  1032. pctNetSellingStr = str(pctNetSelling)
  1033. pctShortBuyingStr = str(pctShortBuying)
  1034. print('Buy Power', '{:5,.2f}'.format(BuyPower), 'Short Power:','{:5,.2f}'.format(ShortPower))
  1035. print('Buy Power as % of Short Selling: ['+pctShortBuyingStr+'%]')
  1036. print('Sell Power as % of Short Selling: ['+pctNetSellingStr+'%]')
  1037. BullBearRatio = round(float(pctShortBuying / pctNetSelling), 4)
  1038. print('Bull Bear Ratio: ',BullBearRatio)
  1039. print('Avg Cover Price: $%s' % CoverPrice)
  1040.  
  1041. if lows_found >= 1 or highs_found >= 1:
  1042. print('\nLow Ranges/Targets Found|Filled:',lows_found, '| ', low_Ranges_Filled)
  1043. print('\nHigh Ranges/Targets Found|Filled: ',highs_found, '| ', high_Ranges_Filled)
  1044. print('Total found: ',found)
  1045.  
  1046. '''if found >0:
  1047. tList = tList
  1048. if tList[1] == 'High':
  1049. print(Fore.GREEN+'LAST RANGE FOUND: [$' + str(Low_Range)+']','[$' + str(High_Range)+']', ' [' + range_ref_String + ': $' + str(Target)+']'+Style.RESET_ALL)
  1050. print(Fore.GREEN+'POTENTIAL TARGETS: [$' + str(Low_Target)+']', '[$' + str(High_Target)+']'+Style.RESET_ALL)
  1051. print(Fore.GREEN+'Found price: [$' + found_price + ']', 'Target implies a move of [' + implied_move + '%]'+'from current price ['+str(Close_Price)+']'+Style.RESET_ALL)
  1052. else:
  1053. tList = tList
  1054. if tList[1] == 'Low':
  1055. print(Fore.RED+'LAST RANGE FOUND: [$' + str(Low_Range)+']','$' + str(High_Range) + ' [' + range_ref_String + ': $' + str(Target)+Style.RESET_ALL)
  1056. print(Fore.RED+'POTENTIAL TARGETS: [$' + str(Low_Target)+']', '$' + str(High_Target)+Style.RESET_ALL)
  1057. print(Fore.RED+'Found price: [$' + (found_price) + ']', 'Target implies a move of [' + implied_move + '%]' + 'from current price [' + str(Close_Price) + ']'+Style.RESET_ALL)'''
  1058.  
  1059. '''input = input('Would you like to see other found ranges?: [y/n]')
  1060. if input == 'y':
  1061. with open('/Users/King/Desktop/RangeTargets.csv' 'r') as csv_file:
  1062. csv_reader = csv.reader(csv_file)
  1063. for row in csv_file:
  1064. row[0] = Date
  1065. row[1] = Time
  1066. row[2] = range_ref_String
  1067. row[3] = Close_Price
  1068. row[4] = M_Price
  1069. row[5] = TargetPrice
  1070. print('\nLow Ranges/Targets Found|Filled: ', lows_found, '| ', low_Ranges_Filled, str(round(low_range_Accuracy, 2)), '%')
  1071. low_range_Accuracy = low_Ranges_Filled / lows_found
  1072.  
  1073. row[6] = Money_Flow
  1074. row[7] = f_Vol
  1075. row[8] = OppRange
  1076. row[9] = OppTarget'''
  1077.  
  1078. '''if abs(Liq_change) > 500000:
  1079. time.sleep(.005)
  1080. 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)
  1081. else if Liquidity > 0:
  1082. if Liq_change > 0:
  1083. time.sleep(.005)
  1084. print(Fore.YELLOW+'['+Date+']', military_time,Fore.GREEN+'Current Liquidity:'+'{:20,.2f}'.format(Liquidity)+Fore.GREEN+' Liq Change: ' + '{:20,.2f}'.format(Liq_change)+' '+Fore.YELLOW+Back.BLUE, 'Last Price [$'+str(Close_Price)+'] '+Tick_String+Style.RESET_ALL)
  1085. if Liq_change < 0:
  1086. time.sleep(.005)
  1087. print(Fore.YELLOW+'['+Date+']', military_time,Fore.GREEN+'Current Liquidity:'+'{:20,.2f}'.format(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)
  1088. else if Liq_change > 0:
  1089. time.sleep(.005)
  1090. 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)
  1091. else if Liq_change < 0:
  1092. time.sleep(.005)
  1093. print(Fore.RED+'['+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)'''
  1094.  
  1095. '''if menu_ans == '1' and Liquidity_Data == 'list':
  1096. print(Fore.CYAN + 'REF#:', ref_Num)
  1097. time.sleep(.05)
  1098. print(Fore.WHITE + Time)
  1099. time.sleep(.05)
  1100. print("Last:", "$" + str(Close_Price))
  1101. time.sleep(.05)
  1102. print("HLCC:", "$" + str(HLCC))
  1103. time.sleep(.05)
  1104. print("Money Price: ", "$" + str(round(M_Price, 2)))
  1105. time.sleep(.05)
  1106. print('Price Diff: ' + '$' + str(Diff))
  1107. time.sleep(.05)
  1108. if f_Vol > 1000000:
  1109. print(Fore.YELLOW + 'Volume:' + '{:20,.2f}'.format(f_Vol))
  1110. else:
  1111. print(Fore.WHITE + 'Volume:' + '{:20,.2f}'.format(f_Vol))
  1112. time.sleep(.05)
  1113. if Money_Flow > 350000000:
  1114. print(Fore.YELLOW + '$Flow:' + '{:20,.2f}'.format(Money_Flow))
  1115. else:
  1116. print(Fore.WHITE + '$Flow:' + '{:20,.2f}'.format(Money_Flow))
  1117. time.sleep(.05)
  1118. if Liq_change < 0:
  1119. print(Fore.RED + 'Liq Change:', '{:20,.2f}'.format(Liq_change), Style.RESET_ALL)
  1120. else:
  1121. print(Fore.CYAN + 'Liq Change:', '{:20,.2f}'.format(Liq_change))
  1122. time.sleep(.05)
  1123. if Liquidity < 0:
  1124. print(Fore.RED + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity), Style.RESET_ALL)
  1125. else:
  1126. print(Fore.CYAN + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity), Style.RESET_ALL)
  1127. time.sleep(.1)
  1128. if NoStop == True:
  1129. with open('/Users/King/Desktop/SPY_RangeTargets/NoStop.csv', 'r') as csv_file:
  1130. csv_reader = csv.reader(csv_file)
  1131. for row in csv_reader:
  1132. Date = row[0]
  1133. Time = row[1]
  1134. range_ref_String = row[2]
  1135. Close_Price = float(row[3])
  1136. M_Price = float(row[4])
  1137. TargetPrice = row[5]
  1138. Money_Flow = float(row[6])
  1139. f_Vol = float(row[7])
  1140. OppRange = row[8]
  1141. OppTarget = row[9]
  1142. Liquidity = float(row[10])
  1143. Liq_change = float(row[11])
  1144. LFP = round(float(row[12]), 3)
  1145. MIVI = float(row[13])
  1146. ref_Num = int(row[14])
  1147. list = [Date, Time, range_ref_String]
  1148. Targets = [M_Price, TargetPrice]
  1149. MIV_Index = str(MIVI)+str('%')
  1150. LFP = str(round(LFP, 3))
  1151. oppositePrices = [OppRange, OppTarget]
  1152. Liq_change_String = str('$'+'{:20,.2f}'.format(Liq_change))
  1153. listlist = [MIV_Index, Liq_change, ref_Num]
  1154. dict = {'':list, 'Targets: ':Targets, 'Found price: ':Close_Price, 'Opposite Ranges/Targets':oppositePrices}
  1155. range_info = {'MIV Index: ':MIV_Index, ' Liq Change:':Liq_change_String, 'REF#':ref_Num}
  1156. if MIVI < 0 and Liq_change > 0:
  1157. infotext = colored(str(range_info), 'grey', 'on_cyan', attrs=['reverse', 'underline'])
  1158. else:
  1159. infotext = colored(str(range_info), 'grey', 'on_white', attrs=['reverse', 'underline'])
  1160. for k,v in dict.items():
  1161. time.sleep(.001)
  1162. print(Fore.YELLOW, k,v)
  1163.  
  1164. cprint(infotext)
  1165. print('\n')'''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement