Advertisement
ImDerekD

Scratch21.py

Jul 22nd, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 93.62 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. import shutil
  18. import os
  19. from sty import fg, bg, ef, rs, RgbFg
  20. import glob
  21.  
  22. shutil.copy('/Users/King/data.csv', '/Users/King/SpyFlow Dropbox/SpyFlow_DropBox/data.csv')
  23.  
  24.  
  25. MIV_Spike_List = []
  26. MIV_Spike_Count = int()
  27. MIV_Spike = float()
  28. Avg_MIV_Spike = float()
  29. ShortPrice = float()
  30. LongPrice = float()
  31. ShortVolumeTotal = float()
  32. C_Price = float()
  33. S_Price = float()
  34. CoverLiquidity = float()
  35. ShortLiquidity = float()
  36. CoverCount = int()
  37. ShortCount = int()
  38. UpTicks = int()
  39. DownTicks = int()
  40. UDR = float()
  41.  
  42. log = []
  43. lastFPrice = float()
  44.  
  45.  
  46. count_M_items = int()
  47. count_V_items = int()
  48. V_Stdev = float()
  49. MP_Stdev = float()
  50. MV_Stdev = float()
  51. findPrice = float()
  52.  
  53. TradingAbove_Count = int()
  54. TradingAbove_Diff = float()
  55. TradingBelow_Count = int()
  56. TradingBelow_Diff = float()
  57.  
  58.  
  59. CoverPrice = float()
  60. CoverVolumeTotal = float()
  61. CoverMoney = float()
  62. ShortMoney = float()
  63.  
  64. TotalDiff = float()
  65.  
  66. sum_Vol = float()
  67. sum_Flow = float()
  68. avg_Flow = float(1)
  69. avg_Vol = float(1)
  70. mRatio = float()
  71. xratio = float()
  72. LFPC = float()
  73. rawdatalist = []
  74. rawdatalist1 = []
  75. rawdatalist2 = []
  76. info_datalist = []
  77. rawdatalist3 = []
  78. est_price = float(1)
  79. LFP = float(1)
  80.  
  81. countitems = int()
  82. SumFlow = float()
  83. SumLiq = float()
  84. avg_Flow = float()
  85. avg_Liq_change = float()
  86. sneakR = float()
  87. new_sneakR = float()
  88. sneakR_Sum = float()
  89. avg_sneakR = float()
  90. BES = bool
  91. bullTS = bool
  92. bearTS1 = bool
  93. bearTS = bool
  94. PD = bool
  95. nTS = bool
  96.  
  97. labels = str()
  98. underline = str()
  99.  
  100. MUTick = int()
  101. MDTick = int()
  102. MTR = float()
  103. MT = int()
  104. DR = float()
  105. Distribution_Price = float()
  106. Cumulutive_DPrice = float()
  107. Avg_DPrice = float()
  108. Weighted_Avg_DPrice = float()
  109. DU = int()
  110. DD = int()
  111. DRC = int()
  112. DP_list = []
  113. DP_Uptick = int()
  114. DP_Downtick = int()
  115. DP_UptickList = []
  116. DP_DowntickList = []
  117. lastDPrice = float()
  118. MIV_Index = float()
  119.  
  120.  
  121. LargeFlowCount = int()
  122. LargeFlowSum = float()
  123. VeryLargeFlowCount = int()
  124. ExtremelyLargeFlowCount = int()
  125. LargesneakRCount = int()
  126. VeryLargesneakRCount = int()
  127. ExtremelyLargesneakRCount = int()
  128. gapRatio = float()
  129. analysis_list = []
  130. analysis_log = []
  131. money_analysis_log = []
  132. sneakR_analysis_log = []
  133.  
  134. UP_c = int()
  135. DOWN_c = int()
  136. UP_IV = float()
  137. DOWN_IV = float()
  138. Avg_Move = float()
  139. BB_Strength = float()
  140. float( )
  141. Avg_Up_Move = float()
  142. Avg_Down_Move = float()
  143. TATBR_Sum = float()
  144. TATBR_Ratio = float()
  145. sneakR_lgst_avg_ratio = float()
  146. sneakR_log = []
  147. qratio = float()
  148. sum_MRatio = float()
  149. avg_mRatio = float()
  150. M_Price_clone = float()
  151. CashOpenHash = '00491302948265c47e651fcff99fd9fb'
  152. CashOpen = float()
  153.  
  154. QR = float()
  155. sum_QR = float()
  156. avg_QR = float()
  157. TATBR_A = float()
  158. TATBR_B = float()
  159.  
  160. sum_LFPC = float()
  161. avg_LFPC = float()
  162. LFPC_Count = int()
  163.  
  164. adj_Strength = float()
  165. new_Strength_String = str()
  166.  
  167. down_val = float()
  168. up_val = float()
  169.  
  170. up_val_count = int()
  171. down_val_count = int()
  172. trend = float()
  173.  
  174. Price_Tick_Total = int()
  175. Liq_Tick_Total = int()
  176. PTLT_Ratio = float()
  177. UpTicks = int()
  178. DownTicks = int()
  179. UD_Ratio = float()
  180. technicals = []
  181. technicals_list = []
  182. PainGauge = float()
  183. PainGaugePct = float()
  184.  
  185. est_diff1 = float()
  186. est_price1 = float
  187.  
  188. LOD = float()
  189. HOD = float()
  190. est_price_filled = bool
  191.  
  192.  
  193. TA = bool
  194. TB = bool
  195. Status = str()
  196.  
  197. est_price_x = float()
  198. est_diff_x = float()
  199.  
  200. unfilled_TA_price = float()
  201. unfilled_TA_price = float()
  202. datafile = '/Users/King/data.csv'
  203. historicaldir = '/Users/King/SPY_CSV_FULL/FULLFILES/'
  204.  
  205. menu_ans = input('What would you like to do? \n [1] Print Liquidity | [2] See previous ranges | [3] Tcopy Ranges | [4] Show Est TA/TB Prices | [5] Analyze Scenarios | [6] Data Analysis\n')
  206. if menu_ans == '1':
  207. Liquidity_Data = input('Would you like to print liquidity data? [y/n]: ')
  208. PrintInfo = True
  209. if menu_ans == '2':
  210. printRanges = input('Which ranges would you like to see?: [High/Low/All]\n')
  211. if menu_ans == '3':
  212. option3 = True
  213. if menu_ans == 'oldfile':
  214. PrintInfo = True
  215. try_file = input('Enter Date [MM_DD_YYYY]: ')
  216. Liquidity_Data = input('Would you like to print liquidity data? [y/n]: ')
  217.  
  218.  
  219. # for file in glob.glob (historicaldir+'*csv'):
  220. # historicaldate = file[39:-8]
  221.  
  222. datafile = historicaldir+'SPY_'+try_file+'FULL.csv'
  223.  
  224.  
  225. with open(datafile, 'r') as csv_file:
  226. csv_reader = csv.reader(csv_file)
  227. header = next(csv_reader)
  228.  
  229.  
  230. ref = [] # Start off w/ empty list
  231. ref_Num = int(0) # First to go in list = ref # (390 cells in 1 day)(using ref+=1 for each row)
  232. data = [] # Not sure but I could rearrange for liquidity?
  233. Liquidity = float()
  234. found = int(0)
  235. Range = []
  236. Target = []
  237. filled = bool
  238. filled_Price = float()
  239. Range_List = {}
  240. Low_Range_Found = {}
  241. High_Range_Found = {}
  242. ht_filled = bool
  243. hr_filled = bool
  244. lr_filled = bool
  245. lt_filled = bool
  246. lows_found = int()
  247. highs_found = int()
  248. Tick = int()
  249. Range_Found = {}
  250. range_ref_String = ('')
  251. dTime = []
  252. printRanges = str()
  253. range_identifier_low = 'Low'
  254. range_identifier_high = 'High'
  255. range_identifier_all = 'All'
  256. All_Range_References = []
  257. All_Referenced_Prices = []
  258. PrintInfo = bool
  259.  
  260. range_identifier = ''
  261. new_range = bool
  262. t = bool
  263. tLow = bool
  264. tHigh = bool
  265. Target = float()
  266. Range_Dict = {}
  267. TickString = str()
  268. Tick_String = ''
  269. Strength = int()
  270. StartTraceback = {}
  271. day_Count = int()
  272. tList = []
  273. Last = float()
  274. LT = float()
  275. HT = float()
  276. ATR = float()
  277. OC_ATR = float()
  278. Avg_ATR = float()
  279. TrendStrength = ''
  280. Previous = []
  281. allfoundallfilled = {}
  282. lowfilled = float()
  283. highfilled = float()
  284. rangefilled = bool
  285. low_Ranges_Filled = int()
  286. high_Ranges_Filled = int()
  287. high_Targets_Filled = int()
  288. low_Targets_Filled = int()
  289. prevVol = float(1)
  290. prevFlow = float(1)
  291. lastFlow = float(1)
  292. lastVol = float(1)
  293. prevIndexValue = float(1)
  294. prevPrice = float(1)
  295. lastLFPC = float(1)
  296. lastsneakR = float(1)
  297. lastmRatio = float(1)
  298.  
  299. Status = str('')
  300. RangeTarget = float()
  301. rFound = bool
  302. count = int(0)
  303. PCT_Range_Str = ''
  304.  
  305. sum_OC_Range = float()
  306. sum_HL_Range = float()
  307. sum_OHLC_Range = float()
  308. WarningString = ''
  309. sum_Liq = float()
  310. avg_Liq_change = float()
  311. HighRangeFlow = float()
  312. LowRangeFlow = float()
  313. LiqFlowPrice = float()
  314. LiqFlowPriceClone = float()
  315. EntryStr = str()
  316. OC_HL_RangePct = float()
  317. StrengthReference = float()
  318. AvgStrengthReference = float()
  319. counter = int()
  320.  
  321. liqList = []
  322. PULQ = bool
  323.  
  324. BuyVolume = float()
  325. BuyPower = float()
  326. ShortVolume = float()
  327. ShortPower = float()
  328. SellVolume = float()
  329. SellPower = float()
  330. BuySellRatio = float()
  331. HL_RangePct = float()
  332.  
  333. Price1 = float()
  334. prevPrice1 = float()
  335. Last = float()
  336. gapDown = int()
  337. gapUp = int()
  338.  
  339. prevMPrice = float()
  340. prevMPrice2 = float()
  341. prevPrice1 = float()
  342. lastMPrice = float()
  343. lastHPrice = float()
  344. lastLPrice = float()
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351. for row in csv_reader:
  352. range_ref_String = ''
  353. LRS = '$'
  354. LRT = '$'
  355. HRS = '$'
  356. HRT = '$'
  357. found_Price_String = '$'
  358. end_String = 'Price while found: $'
  359. # row = [Time, Open, Close, High, Low, realVol, Money_Flow]
  360. ref_Num += 1
  361. dTime = str(datetime.strptime(row[0], '%a %b %d %H:%M'))
  362. Time = dTime[-14:]
  363. Open_Price = float(row[1]) # Price Data Dictionary
  364. Close_Price = float(row[2]) # Price Data Dictionary
  365. High_Price = float(row[3]) # Price Data Dictionary
  366. Low_Price = float(row[4]) # Price Data Dictionary
  367. Money_Flow = float(row[6]) # Price Data Dictionary
  368. Vol = row[5] # Price Data Dictionary
  369. f_Vol = float(Vol[:-1]) # Price Data Dictionary
  370. m_Vol = str(Vol[-1:]) # Price Data Dictionary
  371. if m_Vol == "K": # Price Data Dictionary
  372. f_Vol = f_Vol * 1000 # Price Data Dictionary
  373. if m_Vol == "M": # Price Data Dictionary
  374. f_Vol = f_Vol * 1000000
  375. if m_Vol != "K" and m_Vol != "M":
  376. f_Vol = float(row[5]) # Price Data Dictionary
  377. if f_Vol < 1:
  378. M_Price = HLCC
  379. else:
  380. M_Price = round(float(Money_Flow) / f_Vol, 2)
  381. HLCC = float(High_Price + Low_Price + Close_Price + Close_Price)/4 # Price Data Dictionary & RangeReference Dictionary # Price Data Dictionary & RangeReference Dictionary
  382. Diff = round(HLCC - M_Price, 2)
  383. findDiff = round(M_Price - Close_Price, 2)
  384. TotalDiff += findDiff
  385. PivotPrice = round(Close_Price + TotalDiff, 2)
  386. if PivotPrice > Close_Price + .45:
  387. PivotStr = Fore.CYAN+str(PivotPrice)+Style.RESET_ALL
  388. if PivotPrice < Close_Price - .45:
  389. PivotStr = Fore.RED+str(PivotPrice)+Style.RESET_ALL
  390.  
  391. if abs(PivotPrice - Close_Price) < .15:
  392. PivotStr = Fore.WHITE+str(PivotPrice)+Style.RESET_ALL
  393.  
  394. if abs(PivotPrice - Close_Price) > .15 and abs(PivotPrice - Close_Price) < .45:
  395. PivotStr = Fore.YELLOW+str(PivotPrice)+Style.RESET_ALL # Price Data Dictionary & RangeReference Dictionary & Data Dictionary
  396.  
  397. if PivotPrice > Close_Price + .75:
  398. PivotStr = Fore.CYAN+Style.BRIGHT+str(PivotPrice)+Style.RESET_ALL
  399.  
  400. if PivotPrice < Close_Price - .75:
  401. PivotStr = Fore.RED+Style.BRIGHT+str(PivotPrice)+Style.RESET_ALL
  402. MMM = float(f_Vol * HLCC) # Price Data Dictionary & RangeReference Dictionary & Data Dictionary
  403. Liq_change = float(Money_Flow - MMM) # Price Data Dictionary & RangeReference Dictionary & Data Dictionary
  404. Liquidity += Liq_change # Price Data Dictionary & RangeReference Dictionary & Data Dictionary
  405. Date = str(Time[:5]) # Important
  406. military_time = str(Time[-8:])
  407. criteria = abs(.003*HLCC)
  408. hashTime = hashlib.md5(str.encode(military_time))
  409. Liq_Tick = int()
  410. Price_Tick = int()
  411. tREF = int()
  412. liqstr = '{:20,.2f}'.format(Liquidity)
  413. liqchgstr = '{:20,.2f}'.format(Liq_change)
  414. mf_Str = '{:20,.2f}'.format(Money_Flow)
  415.  
  416. rFound = False
  417.  
  418. OC_Range = abs(Close_Price - Open_Price)
  419. HL_Range = abs(High_Price - Low_Price)
  420. sum_OC_Range += OC_Range
  421. sum_HL_Range += HL_Range
  422.  
  423. sum_Liq += abs(Liq_change)
  424. liqList.append(sum_Liq)
  425. avg_HL_Range = float()
  426. avg_OC_Range = float()
  427. abs_Liq = abs(Liq_change)
  428. prevLiq = float()
  429.  
  430. mticksymbol = ''
  431. ticksymbolc = ''
  432. ticksymbolo = ''
  433. M_Price_clone = M_Price
  434.  
  435. if ref_Num == 1:
  436. CashOpen = Open_Price
  437.  
  438. if ref_Num >= 1:
  439. CashOpen = CashOpen
  440.  
  441.  
  442. chg_Open = round(100*(Close_Price - CashOpen) / CashOpen, 2)
  443.  
  444.  
  445. if Money_Flow > 0:
  446. MIV_Index = round(100 * (f_Vol / prevVol) - 100 * ((Money_Flow * HLCC) / (prevFlow * prevPrice)), 3)
  447. runningValueIndex = round(MIV_Index + prevIndexValue, 3)
  448. prevPrice = Close_Price
  449. prevFlow = Money_Flow
  450. prevVol = f_Vol
  451. prevIndexValue = MIV_Index
  452. MIV_Index_String = str(MIV_Index)
  453. runningValueIndex_String = str(runningValueIndex)
  454. MIV_Index_String = str(round(MIV_Index, 2))
  455.  
  456. if DOWN_c >= 1 and UP_c >= 1:
  457. Avg_Up_Move = round(UP_IV / UP_c, 2)
  458. Avg_Down_Move = round(DOWN_IV / DOWN_c, 2)
  459. Avg_Move = round(100*(DOWN_IV + UP_IV) / Close_Price, 2)
  460. # Avg_Move = round(Avg_Move1 * 100, 2)
  461. PainGauge = round(DOWN_c / UP_c, 3)
  462. PainGaugePct = round(100-100*abs(PainGauge - .637) / 1.529, 2)
  463. BB_Strength = round(DOWN_c / DOWN_IV, 2) + round(UP_c / UP_IV, 2)
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473. if ref_Num >=2:
  474. prevPrice1 = Close_Price
  475. prevMPrice = M_Price
  476. prevFPrice = findPrice
  477.  
  478.  
  479.  
  480.  
  481. if ref_Num % 2 != 0:
  482. Price1 = Close_Price
  483. prevMPrice1 = M_Price
  484. prevFPrice1 = findPrice
  485. prevVol1 = f_Vol
  486. prevFlow1 = Money_Flow
  487. HPrice1 = High_Price
  488. LPrice1 = Low_Price
  489.  
  490. if ref_Num % 2 == 0:
  491. Price2 = Close_Price
  492. prevMPrice2 = M_Price
  493. prevFPrice2 = findPrice
  494. prevVol2 = f_Vol
  495. prevFlow2 = Money_Flow
  496. HPrice2 = High_Price
  497. LPrice2 = Low_Price
  498.  
  499.  
  500. if ref_Num % 2 != 0 and ref_Num > 2:
  501. Last = Price2
  502. lastMPrice = prevMPrice2
  503. lastFPrice = prevFPrice2
  504. lastVol = prevVol2
  505. lastFlow = prevFlow2
  506. lastHPrice = HPrice2
  507. lastLPrice = LPrice2
  508.  
  509.  
  510. if ref_Num % 2 == 0 and ref_Num >= 2:
  511. Last = Price1
  512. lastMPrice = prevMPrice1
  513. lastFPrice = prevFPrice1
  514. lastVol = prevVol1
  515. lastFlow = prevFlow1
  516. lastHPrice = HPrice1
  517. lastLPrice = LPrice1
  518.  
  519. SumFlow += Money_Flow
  520. SumLiq += abs(Liq_change)
  521. sneakR = round(.0000001*(Money_Flow / (OC_Range + HL_Range)), 2)
  522. new_sneakR = round(.0000001*(Money_Flow / (HL_Range)), 2)
  523. sneakR_Sum += round(sneakR, 2)
  524. if mRatio > 0:
  525. QR = round(sneakR / mRatio, 2)
  526. sum_QR += QR
  527.  
  528. sum_MRatio += mRatio
  529.  
  530. sneakR_log.append(sneakR)
  531.  
  532. if ref_Num >= 2:
  533. avg_Flow = round(SumFlow / ref_Num, 2)
  534. avg_Liq_change = round(SumLiq / ref_Num, 2)
  535. mRatio = round(Money_Flow / avg_Flow, 3)
  536. xratio = round(100 * abs(Liq_change) / abs(Liquidity), 3)
  537. lastLFPC = LFPC
  538. lastmRatio = mRatio
  539. lastsneakR = sneakR
  540. avg_sneakR = round(sneakR_Sum / ref_Num, 2)
  541. avg_mRatio = round(sum_MRatio / ref_Num, 2)
  542. avg_QR = round(sum_QR / ref_Num, 2)
  543.  
  544.  
  545. analysis_list = [Date, military_time, Close_Price, M_Price, liqchgstr, liqstr, mf_Str, mRatio, sneakR]
  546.  
  547. if mRatio >= 1:
  548. LargeFlowCount += 1
  549. LargeFlowSum += mRatio
  550. analysis_log.append(analysis_list)
  551. if mRatio >= 2:
  552. VeryLargeFlowCount += 1
  553. if mRatio >= 5:
  554. ExtremelyLargeFlowCount += 1
  555. money_analysis_log.append(Money_Flow)
  556.  
  557. if sneakR >= 100:
  558. if analysis_list not in analysis_log:
  559. analysis_log.append(analysis_list)
  560. sneakR_analysis_log.append(sneakR)
  561. LargesneakRCount += 1
  562. if sneakR >= 200:
  563. VeryLargesneakRCount += 1
  564. if sneakR >= 300:
  565. ExtremelyLargesneakRCount += 1
  566.  
  567. if ref_Num >= 2:
  568. qratio = round(sneakR / mRatio, 2)
  569.  
  570. if Close_Price < Last:
  571. DOWN_c += 1
  572. if HLCC < lastLPrice:
  573. DOWN_c += 1.5
  574. DownTicks += 1
  575. DOWN_IV += round(round(Close_Price - Last, 2) - avg_HL_Range, 2)
  576. if Close_Price > Last:
  577. UP_c += 1
  578. if HLCC > lastHPrice:
  579. UP_c += 1.5
  580. UpTicks += 1
  581. UP_IV += round(round(Close_Price - Last, 2) + avg_HL_Range, 2)
  582.  
  583.  
  584.  
  585.  
  586. if abs(Liq_change) > 0:
  587. LFP = round(Money_Flow / abs(Liq_change) *.01, 3)
  588. LFPC = round(1000 * (abs(Liq_change) / Money_Flow) * .01, 4)
  589. if LFPC >= .001:
  590. LFPC_Count += 1
  591. if Liq_change > 0:
  592. sum_LFPC += LFPC
  593.  
  594. if Liq_change < 0:
  595. sum_LFPC += (LFPC * -1)
  596.  
  597. if LFPC_Count >= 1:
  598.  
  599. avg_LFPC = round(100*(sum_LFPC / LFPC_Count), 2)
  600.  
  601. if Close_Price < Last:
  602. down_val += abs(Close_Price - Last)
  603. down_val_count += 1
  604.  
  605. if Close_Price > Last:
  606. up_val += Close_Price - Last
  607. up_val_count += 1
  608. if up_val_count >= 1 and down_val_count >= 1:
  609. trend = round(up_val_count / down_val_count, 2)
  610.  
  611.  
  612. timecounter = .02
  613. if ref_Num >= 15:
  614. timecounter = .02-((ref_Num / 15) * .000669)
  615.  
  616. if ref_Num == 1:
  617. HOD = High_Price
  618. LOD = Low_Price
  619.  
  620. if ref_Num >= 1:
  621. if High_Price > HOD:
  622. HOD = High_Price
  623.  
  624. if Low_Price < LOD:
  625. LOD = Low_Price
  626.  
  627.  
  628. ###############################################################################################
  629.  
  630. if abs(Liq_change) > 0 and Money_Flow > 0:
  631. if LFPC >= .0013:
  632. rawdatalist = [Date, military_time, Close_Price, liqchgstr, liqstr, mf_Str, M_Price, LFP, LFPC, est_price_x, mRatio, sneakR, qratio]
  633.  
  634. LFP = round(Money_Flow / abs(Liq_change) *.01, 3)
  635. est_diff_x = round(LFPC * Close_Price, 2)
  636. if Liquidity < 0:
  637. if Liq_change < 0:
  638. est_price_x = round(est_diff_x + Close_Price, 2)
  639. TA = True
  640. TB = False
  641. if Liq_change > 0:
  642. est_price_x = round(Close_Price + (-1 * est_diff_x), 2)
  643. TA = False
  644. TB = True
  645.  
  646.  
  647. if Liquidity > 0:
  648. if Liq_change < 0:
  649. est_price_x = round(Close_Price + (-1 * est_diff_x), 2)
  650. TA = False
  651. TB = True
  652. if Liq_change > 0:
  653. est_price_x = round(est_diff_x + Close_Price, 2)
  654. TA = True
  655. TB = False
  656.  
  657. if TA == True:
  658. if Close_Price >= est_price_x:
  659. Status = 'FILLED'
  660. if Close_Price < est_price_x:
  661. if HOD >= est_price_x:
  662. Status = 'P|Filled'
  663. if HOD < est_price_x:
  664. Status = '[ NYF ]'
  665. unfilled_TA_price = est_price_x
  666.  
  667. if TB == True:
  668. if Close_Price <= est_price_x:
  669. Status = 'FILLED'
  670. if Close_Price > est_price_x:
  671. if LOD <= est_price_x:
  672. Status = 'P|Filled'
  673. if LOD > est_price_x:
  674. Status = '| NYF |'
  675. unfilled_TB_price = est_price_x
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689. ######### Changing status in opt 4 to show filled/unfilled est TA/TB prices
  690. #########################################################################
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700. percent_Strength = Strength / ref_Num
  701. allData = [ref_Num,Date, military_time, High_Price,Low_Price,Close_Price, HLCC, M_Price, f_Vol, Money_Flow,MMM, Liquidity,Liq_change]
  702. Data_Dict = {'REF#':[ref_Num],'Date':[Date],'Time':[military_time], 'Close_Price':[Close_Price], 'M_Price':[M_Price], 'Volume':[f_Vol]}
  703. '''USING THIS DATA
  704. [0]REFERENCE NUMBER
  705. [1]DATE
  706. [2]MILITARY_TIME
  707. [3]HIGH_PRICE
  708. [4]LOW_PRICE
  709. [5]CLOSE_PRICE
  710. [6]HLCC
  711. [7]M_Price
  712. [8]F_VOL
  713. [9]MONEY_FLOW
  714. [10]MARKETMAKERMOVE 'MMM'
  715. [11]LIQUIDITY
  716. [12]LIQ_CHANGE
  717. '''
  718.  
  719.  
  720.  
  721.  
  722.  
  723. if abs(allData[7]-allData[6]) >= criteria:
  724. diff = abs(M_Price - Close_Price)
  725. Range_Clause = True
  726. range_identifier_all = 'All'
  727. else:
  728. Range_Clause = False
  729. if Range_Clause == True:
  730. r_price = M_Price
  731. found_Price = HLCC
  732. Low_Range = round(HLCC - abs(float(M_Price - HLCC)), 2)
  733. High_Range = round(HLCC + abs(float(M_Price - HLCC)), 2)
  734. Low_Target = round(Low_Range - abs(float(M_Price - HLCC)), 2)
  735. High_Target = round(High_Range + abs(float(M_Price - HLCC)), 2)
  736. RT_Reference1 = [Low_Range, High_Range, Low_Target, High_Target]
  737. LRS = '$' + str(Low_Range)
  738. LRT = '$' + str(Low_Target)
  739. HRS = '$' + str(High_Range)
  740. HRT = '$' + str(High_Target)
  741. found_Price_String = '$' + str(found_Price)
  742. RT_Reference = [LRS, LRT, HRS, HRT]
  743. lows = [LRS, LRT]
  744. highs = [HRS, HRT]
  745. range_ref_String = range_ref_String
  746. target_String = range_ref_String + ': $'
  747. end_String = 'Price while found: $' + str(Close_Price)
  748. Target_String = '$' + str(Target)
  749.  
  750.  
  751.  
  752. LiqFlowPrice = .01*round(Money_Flow / abs(Liq_change), 3)
  753. VolLiqPrice = round(f_Vol / abs(Liq_change), 2)
  754. LiqFlowPriceClone = round(1000 * (abs(Liq_change) / Money_Flow), 4) * .01
  755.  
  756.  
  757. if M_Price >= High_Range:
  758. found += 1
  759. range_ref_String = "HIGH TARGET"
  760. tHigh = True
  761. RangeTarget = High_Target
  762. Target = M_Price
  763. range_identifier = 'High'
  764. found_Price = HLCC
  765. range_identifier_all = 'All'
  766. thList = ['HIGH TARGET', High_Target, highfilled]
  767. filled = False
  768. ht_filled = False
  769. hr_filled = False
  770. highs_found += 1
  771. rFound = True
  772. HighRangeFlow += Money_Flow
  773. elif M_Price<= Low_Range:
  774. found += 1
  775. range_ref_String = "LOW TARGET"
  776. tLow = True
  777. RangeTarget = Low_Target
  778. Target = M_Price
  779. range_identifier = 'Low'
  780. range_identifier_all = 'All'
  781. found_Price = HLCC
  782. tlList = ['LOW TARGET', Low_Target, lowfilled]
  783. filled = False
  784. lt_filled = False
  785. lr_filled = False
  786. lows_found += 1
  787. rFound = True
  788. LowRangeFlow += Money_Flow
  789.  
  790. if lows_found > 0:
  791. AvgLowRangeFlow = LowRangeFlow / lows_found
  792. if highs_found > 0:
  793. AvgHighRangeFlow = HighRangeFlow / highs_found
  794.  
  795.  
  796. if printRanges == range_identifier and range_identifier == range_identifier_low:
  797. Low_Range_Reference = [Date, military_time, range_ref_String, Target_String, end_String]
  798. Low_Range_Found = {'\nData Found':Low_Range_Reference, 'Watch for: $':lows, 'Potential Resistance: ':highs}
  799. Low_Range = Low_Range_Found
  800. for k, v in dict.items(Low_Range):
  801. print(Fore.RED, k, v)
  802.  
  803. if printRanges == range_identifier and range_identifier == range_identifier_high:
  804. High_Range_Reference = [Date, military_time, range_ref_String, end_String]
  805. High_Range_Found = {'\nData Found': High_Range_Reference, 'Watch for: $':highs, 'Potential Support: ':lows}
  806. High_Range = High_Range_Found
  807. for k, v in dict.items(High_Range):
  808. print(Fore.CYAN, k, v)
  809.  
  810. elif printRanges == range_identifier_all:
  811. if range_ref_String == 'LOW TARGET' or range_ref_String == 'HIGH TARGET':
  812. money_string = '$'
  813. Target_String = '$' + str(Target)
  814. Close_Price_String = money_string+str(Close_Price)
  815. Range_Reference = [Date, military_time, Close_Price_String, range_ref_String, Target_String]
  816. Low_Ranges = [LRS, LRT]
  817. High_Ranges = [HRS, HRT]
  818. Range_Found = {'<-- Reference':Range_Reference, 'Low Ranges':Low_Ranges, 'High Ranges':High_Ranges, 'REF#':ref_Num}
  819. Range_List[ref_Num] = Range_Found
  820. text = colored(str(found)+' '+str(Range_Found), 'cyan', 'on_grey', attrs=['reverse'])
  821. cprint(text)
  822.  
  823.  
  824. # '''if Range_Clause == True:
  825. # if range_ref_String == "HIGH TARGET" and Money_Flow < 300000000:
  826. # print("MARKET MAKER HIGH TARGET")
  827. # if range_ref_String == "LOW TARGET" and Money_Flow > 300000000:
  828. # print("MARKET MAKER LOW TARGET")'''
  829.  
  830. else:
  831. Range_Clause = False
  832. tHigh = False
  833. tLow = False
  834. rFound = False
  835.  
  836. if M_Price == lastMPrice:
  837. if DRC >= 2:
  838. lastDPrice = Distribution_Price
  839. Weighted_Avg_DPrice = round(((lastDPrice + M_Price) / 2), 2)
  840. Distribution_Price = M_Price
  841. DRC += 1
  842. Cumulutive_DPrice += Distribution_Price
  843. lastDPrice = Distribution_Price
  844.  
  845.  
  846. DP_Uptick = DP_Uptick * 0
  847. DP_Downtick = DP_Downtick * 0
  848. if M_Price not in DP_list:
  849. DP_list.append(M_Price)
  850. else:
  851. pass
  852.  
  853.  
  854.  
  855.  
  856. if DRC >= 1:
  857. if HLCC > Distribution_Price:
  858. DP_Uptick += 1
  859. DU += 1
  860. DP_UptickList.append(DP_Uptick)
  861.  
  862. if HLCC < Distribution_Price:
  863. DD += 1
  864. DP_Downtick += 1
  865. DP_DowntickList.append(DP_Uptick)
  866.  
  867.  
  868.  
  869.  
  870.  
  871.  
  872. Avg_DPrice = round(Cumulutive_DPrice / DRC, 2)
  873.  
  874.  
  875. if DU >= 1 and DD >= 1:
  876. DR = round(DU / DD, 2)
  877.  
  878.  
  879. if M_Price > lastMPrice:
  880. mticksymbol = Fore.GREEN+'∆'
  881. MUTick += 1
  882. MT += 1
  883. if HLCC > Last:
  884. MUTick += 1
  885. MT += 1
  886. if M_Price < lastMPrice:
  887. mticksymbol = Fore.RED+'â—Š'
  888. MDTick += 1
  889. MT += 1
  890. if HLCC < Last:
  891. MDTick += 1
  892. MT += 1
  893. if M_Price == lastMPrice:
  894. if DRC >= 2:
  895. if M_Price > lastDPrice:
  896. MUTick += 1
  897. MT += 1
  898. if M_Price < lastDPrice:
  899. MDTick += 1
  900. MT += 1
  901.  
  902. else:
  903. pass
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910. if MUTick >= 1 and MDTick >= 1:
  911. MTR = round(MUTick / MT, 3)
  912.  
  913.  
  914. if Open_Price > Last:
  915. gapUp += 1
  916. if Open_Price < Last:
  917. gapDown += 1
  918.  
  919. if gapUp >= 1 and gapDown >= 1:
  920. gapRatio = round(gapUp / gapDown, 3)
  921.  
  922.  
  923. if M_Price > High_Price:
  924. TradingAbove_Count += 1
  925. TradingAbove_Diff += round(abs(M_Price - High_Price), 2)
  926.  
  927. if M_Price < Low_Price:
  928. TradingBelow_Count += 1
  929. TradingBelow_Diff += round(abs(M_Price - Low_Price), 2)
  930.  
  931. if TradingAbove_Count >= 1 or TradingBelow_Count >= 1:
  932. TATBR_Sum = round(100*(TradingAbove_Diff - TradingBelow_Diff) / Close_Price, 2)
  933.  
  934.  
  935. if abs(MIV_Index) >= .25 and ref_Num > 1:
  936. MIV_Spike += abs(MIV_Index)
  937. MIV_Spike_Count += 1
  938. MIV_Spike_List.append(abs(MIV_Index))
  939. Avg_MIV_Spike = round(MIV_Spike / MIV_Spike_Count, 3)
  940. if abs(MIV_Index) >= .25 and ref_Num > 1:
  941. Avg_MIV_Spike_String = str(Avg_MIV_Spike)
  942.  
  943.  
  944. newratio = round(10*(LFP * LFPC), 3)
  945.  
  946.  
  947. if Close_Price >= Open_Price and Liq_change > 0:
  948. UpTicks += 1
  949. Price_Tick = 1
  950. Liq_Tick = 1
  951. BuyVolume += f_Vol
  952. BuyPower += Liq_change
  953. SellPower += Liq_change * -1
  954.  
  955. if Liquidity < 0:
  956. ShortPower += Liq_change*-1
  957.  
  958. PULQ = False
  959. elif Close_Price >= Open_Price and Liq_change < 0:
  960. Price_Tick = 0
  961. Liq_Tick = -1
  962. ShortVolume += f_Vol
  963. BuyVolume += Liq_change * -1
  964. ShortPower += Liq_change * -1
  965. ShortVolumeTotal += f_Vol
  966. ShortMoney += Money_Flow
  967. ShortCount += 1
  968. ShortLiquidity += abs(Liq_change)
  969. S_Price += HLCC
  970.  
  971. PULQ = True
  972. elif Close_Price <= Open_Price and Liq_change > 0:
  973. Price_Tick = -1
  974. Liq_Tick = 0
  975. ShortPower += Liq_change
  976. BuyPower += Liq_change
  977. SellPower += Liq_change
  978. CoverVolumeTotal += f_Vol
  979. CoverMoney += Money_Flow
  980. CoverCount += 1
  981. CoverLiquidity += Liq_change
  982. C_Price += HLCC
  983.  
  984.  
  985. PULQ = False
  986. elif Close_Price <= Open_Price and Liq_change < 0:
  987. Price_Tick = -1
  988. Liq_Tick = -1
  989. SellVolume += f_Vol
  990. SellPower += abs(Liq_change)
  991. BuyPower += Liq_change
  992. DownTicks += 1
  993.  
  994.  
  995.  
  996.  
  997.  
  998. PULQ = False
  999. Price_Tick_Total += Price_Tick
  1000. Liq_Tick_Total += Liq_Tick
  1001. if abs(Price_Tick_Total) >= 1 and abs(Liq_Tick_Total) >= 1:
  1002. PTLT_Ratio = round(abs(Price_Tick_Total) / abs(Liq_Tick_Total), 2)
  1003.  
  1004. if UpTicks >= 1 and DownTicks >= 1:
  1005. UDR = round(UpTicks / DownTicks, 3)
  1006. Tick = Liq_Tick + Price_Tick
  1007. Strength += Tick
  1008. percent_Strength = round(Strength / ref_Num, 4)
  1009. step1 = -210 * ref_Num
  1010. step2 = step1 / 390
  1011. step3 = Strength / 390
  1012. step4 = round(100*(step3 / step2), 4)
  1013. new_Strength = round(100 - (step4 * 100), 2)
  1014. # new_Strength = round(100-(100*abs(percent_Strength- -.3153) / .8794), 2)
  1015. # new_Strength = round(100-(100*abs(percent_Strength - -.305128) / .93333), 2)
  1016. intraday_Strength = round(100-(100*abs(percent_Strength- -.3333) / .8974), 2)
  1017. adj_Strength = round(100-(100*abs(percent_Strength - -.3053) / .9512), 2)
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023.  
  1024.  
  1025. if menu_ans == '1' or menu_ans == 'oldfile':
  1026. if Liquidity_Data == 'y':
  1027.  
  1028. est_diff = round(.01*(100 - LFP), 2)
  1029. est_diff1 = round(LFPC * Close_Price, 2)
  1030. if Liquidity < 0:
  1031. if Liq_change < 0:
  1032. est_price = round(est_diff + Close_Price, 2)
  1033. est_price1 = round(est_diff1 + Close_Price, 2)
  1034. if Liq_change > 0:
  1035. est_price = round(Close_Price - est_diff, 2)
  1036. est_price1 = round(Close_Price + (-1 * est_diff1), 2)
  1037. if Liquidity > 0:
  1038. if Liq_change < 0:
  1039. est_price = round(Close_Price - est_diff, 2)
  1040. est_price1 = round(Close_Price + (-1 * est_diff1), 2)
  1041. if Liq_change > 0:
  1042. est_price = round(est_diff + Close_Price, 2)
  1043. est_price1 = round(est_diff1 + Close_Price, 2)
  1044.  
  1045.  
  1046. sum_Vol += f_Vol
  1047. sum_Flow += Money_Flow
  1048.  
  1049.  
  1050. avg_HL_Range = sum_HL_Range / ref_Num
  1051. avg_OC_Range = sum_OC_Range / ref_Num
  1052. avg_Liq_change = sum_Liq / ref_Num
  1053.  
  1054.  
  1055. if Close_Price > Open_Price:
  1056. ticksymbolo = Fore.GREEN+Style.BRIGHT+'ˆ'+Style.RESET_ALL
  1057. if Close_Price < Open_Price:
  1058. ticksymbolo = Fore.RED+Style.BRIGHT+'ˇ'+Style.RESET_ALL
  1059.  
  1060.  
  1061. if (M_Price + lastMPrice) / 2 < (Last + Close_Price) / 2 - (.1 * avg_OC_Range):
  1062. if lastMPrice >= lastLPrice and lastMPrice <= lastHPrice:
  1063. ticksymbolc = Fore.GREEN+Style.BRIGHT+'ˆ '+Style.RESET_ALL
  1064. elif lastMPrice >= lastHPrice and lastMPrice <= lastHPrice + avg_OC_Range:
  1065. ticksymbolc = Fore.YELLOW+Style.BRIGHT+'∞ '+Style.RESET_ALL
  1066.  
  1067.  
  1068.  
  1069.  
  1070. if (M_Price + lastMPrice) / 2 > (Last + Close_Price) / 2 + (.1 * avg_OC_Range):
  1071. if lastMPrice >= lastLPrice and lastMPrice <= lastHPrice:
  1072. ticksymbolc = Fore.RED+Style.BRIGHT+'ˇ '+Style.RESET_ALL
  1073.  
  1074. elif lastMPrice <= lastLPrice and lastMPrice >= lastLPrice - avg_OC_Range:
  1075. ticksymbolc = Fore.YELLOW+Style.BRIGHT+'• '+Style.RESET_ALL
  1076.  
  1077.  
  1078.  
  1079.  
  1080.  
  1081. if abs(MIV_Index) >= .25 and ref_Num > 1:
  1082. MIV_Spike += abs(MIV_Index)
  1083. MIV_Spike_Count += 1
  1084. MIV_Spike_List.append(abs(MIV_Index))
  1085. Avg_MIV_Spike = round(MIV_Spike / MIV_Spike_Count, 3)
  1086. if abs(MIV_Index) >= .25 and ref_Num > 1:
  1087. Avg_MIV_Spike_String = str(Avg_MIV_Spike)
  1088. if MIV_Index > 0:
  1089. MIV_Index_String = str(round(MIV_Index, 2))
  1090. 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)
  1091.  
  1092. elif MIV_Index < 0:
  1093. MIV_Index_String = str(round(MIV_Index, 2))
  1094. 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)
  1095.  
  1096.  
  1097.  
  1098.  
  1099. if abs(Liq_change) > 0:
  1100. LFP = round(Money_Flow / abs(Liq_change) *.01, 3)
  1101. LFPC = round(1000 * (abs(Liq_change) / Money_Flow) * .01, 4)
  1102.  
  1103. if LFP < 13 and LFPC < .085:
  1104. LFP_WarningStr = 'FKN SELL THIS SHIT SON %s' % LFP
  1105. LFP_WarningStr_clr = colored(LFP_WarningStr, 'red', attrs=['bold','blink'])
  1106. # print(LFP_WarningStr_clr)
  1107.  
  1108. if LFP < 20 and LFP > 13:
  1109. LFP_WarningStr = 'FKN BUY THIS SHIT SON %s' % LFP
  1110. LFP_WarningStr_clr = colored(LFP_WarningStr, 'cyan', attrs=['bold','blink'])
  1111. # print(LFP_WarningStr_clr)
  1112.  
  1113.  
  1114. # if Money_Flow > 0 and lastFlow > 0:
  1115. # if f_Vol > 0 and lastVol > 0:
  1116. # M_index = round(100*(Money_Flow / lastFlow), 3)
  1117. # V_index = round(100*(f_Vol / lastVol), 3)
  1118. # new_MIV = round(M_index - V_index, 3)
  1119. # avg_Vol = sum_Vol / ref_Num
  1120.  
  1121. #
  1122. # if new_MIV >= .15 and OC_Range < avg_HL_Range:
  1123. # WarningString = Fore.CYAN+'BULLISH MV'
  1124. # print(WarningString)
  1125. #
  1126. # if new_MIV <= -.15 and OC_Range < avg_HL_Range:
  1127. # WarningString = Fore.RED+'BEARISH MV'
  1128. # print(WarningString)
  1129.  
  1130.  
  1131.  
  1132.  
  1133.  
  1134.  
  1135.  
  1136. SS = str(new_Strength)
  1137. abs_Liq = abs(Liq_change)
  1138. counter += 1
  1139.  
  1140.  
  1141. if ShortCount >= 1:
  1142. ShortPrice = round(S_Price / ShortCount, 2)
  1143.  
  1144. if CoverCount >= 1:
  1145. CoverPrice = round(C_Price / CoverCount, 2)
  1146.  
  1147.  
  1148. if ref_Num < 10:
  1149. AvgStrengthReference += new_Strength
  1150. if ref_Num == 20:
  1151. AvgStrengthReference = StrengthReference / ref_Num
  1152. StrengthReference = AvgStrengthReference
  1153. counter = 1
  1154. if ref_Num >= 20:
  1155. counter += 1
  1156. AvgStrengthReference = AvgStrengthReference + new_Strength
  1157.  
  1158. if counter < 20 and counter >= 1:
  1159. AvgStrengthReference = AvgStrengthReference / counter
  1160. StrengthReference = (AvgStrengthReference + new_Strength) / counter
  1161.  
  1162. if counter == 20:
  1163. counter = counter * 0
  1164. AvgStrengthReference = AvgStrengthReference * 0 + StrengthReference
  1165. StrengthReference = StrengthReference
  1166.  
  1167.  
  1168.  
  1169.  
  1170. if M_Price == lastMPrice:
  1171. WarningString = '!!!'
  1172. mticksymbol = Fore.YELLOW+'≈'
  1173. else:
  1174. WarningString = ''
  1175. if OC_Range >= avg_HL_Range:
  1176. if Liq_change > avg_Liq_change:
  1177. if Close_Price > Open_Price:
  1178. WarningString = Fore.CYAN+'[xxx]'+Style.RESET_ALL
  1179. if Close_Price < Open_Price:
  1180. WarningString = Fore.RED+'[xxx]'+Style.RESET_ALL
  1181. else:
  1182. WarningString = Fore.YELLOW+'[xxx]'
  1183.  
  1184. else:
  1185. WarningString = ''
  1186.  
  1187.  
  1188. if PULQ == True and OC_Range <= avg_OC_Range *.3:
  1189. if abs(Liq_change) < 500 and Liq_change < 0:
  1190. if abs(Liq_change) < avg_Liq_change * .05:
  1191. WarningString = '[*]'
  1192. else:
  1193. WarningString = ''
  1194.  
  1195.  
  1196. if mRatio >= 1:
  1197. WarningString = Fore.WHITE+' $'
  1198. if mRatio > 2:
  1199. WarningString = Style.RESET_ALL+Style.BRIGHT+' $'
  1200. if ref_Num >= 5:
  1201. OC_RangePct = round(OC_Range / avg_OC_Range * 100, 2)
  1202. HL_RangePct = round(HL_Range / avg_HL_Range * 100, 2)
  1203.  
  1204. if abs(OC_Range) > 0 and abs(HL_Range) > 0:
  1205. RangePct = round(OC_Range / (HL_Range / avg_HL_Range) * 1000, 4)
  1206. OCHL_RangePct = round(OC_Range / HL_Range * 100, 4)
  1207. OC_HL_RangePctStr = str(OC_HL_RangePct)+'%'
  1208. OCHL_RangePctStr = str(OC_HL_RangePct)+'%'
  1209. else:
  1210. OCHL_RangePctStr = ''
  1211. OC_HL_RangePctStr = ''
  1212.  
  1213.  
  1214. Tick_String = ''
  1215. # if LFP < 100 and LFPC >= .001:
  1216. # est_diff = round(.01*(100 - LFP), 2)
  1217. # if Liq_change > 0:
  1218. # est_price = round(est_diff + Close_Price, 2)
  1219. # if Liq_change < 0:
  1220. # est_price = round(Close_Price - est_diff, 2)
  1221.  
  1222. if LFPC > 0:
  1223. est_diff = round(LFPC * Close_Price, 2)
  1224. if Liq_change > 0 and Liquidity > 0:
  1225. est_price = round(est_diff + Close_Price, 2)
  1226. if Liq_change < 0 and Liquidity < 0:
  1227. est_price = round(est_diff + Close_Price, 2)
  1228. if Liquidity > 0 and Liq_change < 0:
  1229. est_price = round(Close_Price - est_diff, 2)
  1230.  
  1231. else:
  1232. est_price = M_Price
  1233.  
  1234.  
  1235.  
  1236.  
  1237. if Liq_change > 0:
  1238. if M_Price < Close_Price:
  1239. Tick_String = fg(50)+bg(100)+'ALGO UPTICK'+rs.all+WarningString+' '
  1240. if M_Price >= Close_Price and M_Price < High_Price + .01:
  1241. if Close_Price >= Open_Price:
  1242. Tick_String = Fore.BLUE+Back.GREEN+'UPTICK'+Style.RESET_ALL+WarningString+' '
  1243.  
  1244. if M_Price == High_Price or M_Price == lastHPrice:
  1245. Tick_String = colored('SHORTING HIGH', 'yellow', attrs=['blink'])+Style.RESET_ALL+WarningString+' '
  1246.  
  1247. if Liq_change < 0:
  1248.  
  1249. if Close_Price > Open_Price and M_Price < Close_Price:
  1250. if M_Price < lastMPrice:
  1251. Tick_String = colored('EXTENDO SHORT', 'blue')+Style.RESET_ALL+WarningString+' '
  1252. else:
  1253.  
  1254. if OC_Range > avg_HL_Range:
  1255. Tick_String = fg(11)+bg(60)+'PRICE UP LIQ DOWN'+rs.all+' '
  1256.  
  1257. if Close_Price > lastHPrice:
  1258. if MTR >= .5:
  1259. Tick_String = fg(232)+bg(32)+'PRICE UP LIQ DOWN'+rs.all+WarningString+' '
  1260. else:
  1261. pass
  1262.  
  1263. else:
  1264. Tick_String = Fore.WHITE+'PRICE UP LIQ DOWN'+WarningString+' '
  1265. else:
  1266. pass
  1267.  
  1268.  
  1269.  
  1270.  
  1271.  
  1272. if mRatio < .20 and sneakR < 9: ############## THIS IS GOOD
  1273. if M_Price > High_Price or M_Price >= lastHPrice: ##################### THIS IS GOOD
  1274. Tick_String = colored('DUMP COMING', 'yellow', 'on_red') ####################### THIS IS GOOD
  1275. bearTS = True
  1276.  
  1277. if mRatio < .16 and sneakR < 8:
  1278. Tick_String = colored('MAX VOLATILITY PUMP & DUMP', 'red', attrs=['bold', 'blink'])
  1279. bearTS = True
  1280.  
  1281. else:
  1282. pass
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288. else:
  1289. bearTS = False
  1290. pass
  1291.  
  1292.  
  1293. if M_Price > High_Price and M_Price > lastHPrice:
  1294. ta_price = round((Close_Price * LFPC) + Close_Price, 2)
  1295. if LFPC >= .0013 and LFPC < .002:
  1296.  
  1297.  
  1298. bullTS = False
  1299. Tick_String = colored('TRADING ABOVE', 'cyan', 'on_grey')+WarningString+' ($%s) ' % ta_price
  1300. if LFPC >= .002:
  1301. bullTS = False
  1302. Tick_String = colored('TRADING ABOVE', 'grey', 'on_cyan')+WarningString+' ($%s) ' % ta_price
  1303. else:
  1304. pass
  1305. if M_Price < Low_Price and M_Price < lastLPrice:
  1306. tb_price = round(Close_Price - (LFPC * Close_Price), 2)
  1307.  
  1308. # tb_price = round((Close_Price * (LFPC * -1) + Close_Price), 2)
  1309. if LFPC >= .0013 and LFPC < .002:
  1310. Tick_String = colored('TRADING BELOW', 'red', 'on_grey')+WarningString+' ($%s) ' % tb_price
  1311. if LFPC >= .002:
  1312. Tick_String = colored('TRADING BELOW', 'grey', 'on_red')+WarningString+' ($%s) ' % tb_price
  1313. else:
  1314. pass
  1315.  
  1316.  
  1317. if mRatio >= 2 and Range_Clause == False:
  1318. if mRatio >= 5:
  1319. if MIV_Index < 0 and abs(MIV_Index) > Avg_MIV_Spike:
  1320. if Liq_change > 0:
  1321. if Liquidity < 0:
  1322. Tick_String = Fore.WHITE+Style.BRIGHT+'MASSIVE FKN DUMPING'+Style.RESET_ALL+WarningString+' '
  1323. elif Liquidity > 0:
  1324. Tick_String = Fore.CYAN+Style.BRIGHT+'MASSIVE FKN BUYING'+Style.RESET_ALL+WarningString+' '
  1325. if Liq_change < 0:
  1326. Tick_String = Fore.WHITE+Style.BRIGHT+Back.RED+'MASSIVE FKN DUMPING'+Style.RESET_ALL+WarningString+' '
  1327. bearTS = True
  1328.  
  1329. else:
  1330. bearTS = False
  1331. pass
  1332.  
  1333.  
  1334. if MIV_Index > 0 and MIV_Index > Avg_MIV_Spike:
  1335. if Liq_change < 0:
  1336. Tick_String = Fore.WHITE+Style.BRIGHT+'MASSIVE FKN DUMPING'+Style.RESET_ALL+WarningString+' '
  1337. bearTS = True
  1338. else:
  1339. bearTS = False
  1340. pass
  1341.  
  1342.  
  1343. if abs(MIV_Index) < Avg_MIV_Spike and abs(MIV_Index) < .25:
  1344. Tick_String = Style.BRIGHT+'MASSIVE FLOW NO MIV'+Style.RESET_ALL+WarningString+' '
  1345.  
  1346. else:
  1347. Tick_String = Style.BRIGHT+Back.YELLOW+Fore.WHITE+'MASSIVE FLOW'+Style.RESET_ALL+WarningString+' '
  1348.  
  1349.  
  1350.  
  1351. pass
  1352.  
  1353.  
  1354. if abs(Liq_change) < .05 * avg_Liq_change:
  1355. if Open_Price > Last:
  1356. Tick_String = fg(150)+bg(52)+'ALGOS DOING SOME BEARSHIT'+rs.all
  1357.  
  1358. # Tick_String = Fore.RED+Style.BRIGHT+Back.WHITE+'ALGOS DOIN SUMBEARSHIT'+Style.RESET_ALL+WarningString+' '
  1359.  
  1360.  
  1361. if Close_Price < lastDPrice:
  1362. if M_Price > lastMPrice and Liq_change < 0:
  1363. Tick_String = fg(233)+bg(184)+'ALGOS DOIN SOME BULLSHIT'+rs.all
  1364.  
  1365. # Tick_String = Fore.CYAN+Style.BRIGHT+'ALGOS DOIN SUMBULLSHIT'+Style.RESET_ALL+WarningString+' '
  1366.  
  1367. else:
  1368. pass
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377. if Liq_change > 0:
  1378. if Liq_change > avg_Liq_change * 2 and M_Price >= Close_Price + (.75 * avg_HL_Range):
  1379. if sneakR < 10:
  1380. bullTS = True
  1381. if MIV_Index < -.25:
  1382. Tick_String = colored('BULL EXHAUSTION SETUP', 'cyan', 'on_red')
  1383. bearTS = True
  1384.  
  1385. else:
  1386. Tick_String = colored('BEAR EXHAUSTION SETUP', 'red', 'on_cyan')
  1387. else:
  1388. pass
  1389. else:
  1390. bullTS = False
  1391. pass
  1392.  
  1393.  
  1394. if mRatio >= 1 and sneakR > 100:
  1395. if M_Price > lastMPrice and Close_Price < Last:
  1396. Tick_String = colored('LARGE DUMPING', 'white', 'on_red')+WarningString+' '
  1397.  
  1398. if mRatio < .25 and sneakR < 5:
  1399. if mRatio < .2 and LFP < 100:
  1400. if Liq_change > 0:
  1401. Tick_String = Fore.BLUE+Style.BRIGHT+'BREAKOUT'+Style.RESET_ALL+WarningString+' '
  1402. bullTS = True
  1403.  
  1404. if Liq_change < 0:
  1405. Tick_String = Fore.YELLOW+Style.BRIGHT+'BREAKDOWN'+Style.RESET_ALL+WarningString+' '
  1406. bearTS = True
  1407. else:
  1408. Tick_String = Fore.RED+Back.YELLOW+Style.BRIGHT+'VOLATILITY COMING'+Style.RESET_ALL+WarningString+' '
  1409. nTS = True
  1410.  
  1411.  
  1412. else:
  1413. bearTS = False
  1414. bullTS = False
  1415. nTS = False
  1416. pass
  1417.  
  1418. else:
  1419. nTS = False
  1420. bearTS = False
  1421. bullTS = False
  1422. pass
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429. # if Open_Price > Last and mRatio < .15:
  1430. # Tick_String = colored('PUMP N DUMP V2', 'yellow', attrs=['blink'])
  1431. # bearTS = True
  1432. #
  1433. # else:
  1434. # pass
  1435.  
  1436. if sneakR >= 20 and mRatio < 1:
  1437. if Liq_change < 0 and mRatio >= .6:
  1438. if LFP < 500:
  1439. if est_price < Close_Price:
  1440. price_str = str(est_price)
  1441. Tick_String = 'PROBABLY TRADING BELOW'+' ($%s)' % price_str
  1442. if est_price > Close_Price:
  1443. price_str = str(est_price)
  1444. Tick_String = 'PROBABLY TRADING ABOVE'+' ($%s)' % price_str
  1445.  
  1446.  
  1447. else:
  1448. pass
  1449. else:
  1450. pass
  1451.  
  1452.  
  1453.  
  1454. if mRatio < .18 and sneakR < 10:
  1455. if LFPC >= .001:
  1456. if Liquidity < 0:
  1457. if Liq_change < 0:
  1458. est_price = round(est_diff + Close_Price, 2)
  1459. est_price1 = round(est_diff1 + Close_Price, 2)
  1460.  
  1461. if Liq_change > 0:
  1462. est_price = round(Close_Price - est_diff, 2)
  1463. est_price1 = round(Close_Price + (-1 * est_diff1), 2)
  1464.  
  1465. if Liquidity > 0:
  1466. if Liq_change < 0:
  1467. est_price = round(Close_Price - est_diff, 2)
  1468. est_price1 = round(Close_Price + (-1 * est_diff1), 2)
  1469.  
  1470. if Liq_change > 0:
  1471. est_price = round(est_diff + Close_Price, 2)
  1472. est_price1 = round(est_diff1 + Close_Price, 2)
  1473.  
  1474.  
  1475. if est_price1 > Close_Price:
  1476. if M_Price > High_Price:
  1477. if Liq_change < avg_Liq_change and abs(Liq_change) > 500:
  1478. Tick_String = fg(117)+bg(240)+'RELENTLESS BEAR TRAP'+rs.all+WarningString+' '
  1479. if Liq_change >= avg_Liq_change:
  1480. Tick_String = fg(52)+bg(240)+'RELENTLESS BULL TRAP'+rs.all+WarningString+' '
  1481. if est_price1 < Close_Price:
  1482. Tick_String = fg(52)+bg(240)+'RELENTLESS BULL TRAP'+rs.all+WarningString+' '
  1483. nTS = True
  1484. else:
  1485. nTS = False
  1486. pass
  1487. else:
  1488. nTS = False
  1489. pass
  1490.  
  1491. if mRatio < .15 and sneakR < 8:
  1492. if M_Price > High_Price:
  1493. if Liq_change > avg_Liq_change:
  1494. est_price = round(-1*(LFPC * Close_Price) + Close_Price, 2)
  1495. est_price_str = str(est_price)
  1496. Tick_String = Fore.YELLOW+'GET THE FUCK OUT ($%s)' % est_price_str
  1497. bearTS = True
  1498.  
  1499. if M_Price < Low_Price:
  1500. if abs(Liq_change) > avg_Liq_change:
  1501. est_price = round(1*(LFPC * Close_Price) + Close_Price, 2)
  1502. est_price_str = str(est_price)
  1503. Tick_String = Fore.YELLOW+'MONEY MOVING ($%s)' % est_price_str
  1504. bullTS = True
  1505.  
  1506. else:
  1507. bearTS = False
  1508. bullTS = False
  1509. pass
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515. if Liq_change < 0 and M_Price > Close_Price:
  1516. if mRatio < .5 and sneakR < 10:
  1517. Tick_String = colored('MAJOR DOWNTICK', 'yellow', 'on_red', attrs=['bold'])
  1518. bearTS = True
  1519.  
  1520. else:
  1521. pass
  1522.  
  1523. else:
  1524. bearTS = False
  1525.  
  1526.  
  1527. if sneakR >= 100 and mRatio >= 3:
  1528. Tick_String = colored('SERIOUSLY BULLISH', 'white', 'on_blue', attrs=['bold'])
  1529. bullTS = True
  1530.  
  1531. if mRatio >= 5:
  1532.  
  1533.  
  1534. if sneakR / mRatio >= 30:
  1535. Tick_String = colored('EXTREMELY FKN BULLISH', 'grey', 'on_cyan', attrs=['bold', 'blink'])
  1536. bullTS = True
  1537. bearTS = False
  1538. if sneakR / mRatio <= 15 and Liq_change < 0:
  1539. Tick_String = bg(100)+bg(153)+fg(95)+fg(160)+'MASSIVE DUMPING <LONG TERM CONFIDENCE (3-5DAYS) ONLY>'+rs.all+WarningString+' '
  1540. bearTS = True
  1541. bullTS = False
  1542.  
  1543. else:
  1544. bullTS = False
  1545. bearTS = False
  1546. pass
  1547. else:
  1548. bullTS = False
  1549. bearTS = False
  1550. pass
  1551.  
  1552.  
  1553. else:
  1554. bullTS = False
  1555. bearTS = False
  1556. pass
  1557.  
  1558. if sneakR < 50 and mRatio >= 5:
  1559. if Close_Price > lastMPrice + avg_HL_Range:
  1560. Tick_String = colored('TOP CALLA', 'red', 'on_white', attrs=['bold'])
  1561. bearTS = True
  1562. if Close_Price < lastMPrice - avg_HL_Range:
  1563. Tick_String = colored('FOUND THE BOTTOM', 'blue', 'on_cyan')
  1564. bullTS = True
  1565. else:
  1566. bullTS = False
  1567. bearTS = False
  1568.  
  1569.  
  1570.  
  1571. if mRatio >= 1 and mRatio < 1.5:
  1572. if sneakR >= 60 and Liq_change >= avg_Liq_change:
  1573. Tick_String = fg(117)+bg(244)+'BUY ENTRY'+rs.all+WarningString+' '
  1574. bullTS = True
  1575.  
  1576. else:
  1577. pass
  1578.  
  1579. if Open_Price > Last:
  1580. if mRatio < .175 and sneakR < 10:
  1581. if Liq_change > 0:
  1582. est_price = round(1*(LFPC * Close_Price) + Close_Price, 2)
  1583. Tick_String = fg(0)+bg(118)+'ALGOS WANT IT HIGHER ($'+str(est_price)+')'+fg.rs
  1584. if Liq_change < 0:
  1585. est_price = round(-1*(LFPC * Close_Price) + Close_Price, 2)
  1586. Tick_String = fg(0)+bg(94)+'ALGOS WANT IT LOWER ($'+str(est_price)+')'+rs.all
  1587. else:
  1588. pass
  1589.  
  1590. if sneakR >= 20 and mRatio < .35:
  1591. if ref_Num >= 2 and lastmRatio < 1:
  1592. Tick_String = fg(197)+bg(235)+'$ BEING PUT TO WORK $'+rs.all+WarningString+' '
  1593. bullTS = True
  1594. else:
  1595. bullTS = False
  1596. pass
  1597.  
  1598.  
  1599.  
  1600.  
  1601. if mRatio >= 3 and sneakR / mRatio <= 10:
  1602. if mRatio >= qratio:
  1603. if Liquidity > 0:
  1604. Tick_String = fg(16)+bg(213)+'MASSIVE BUYING <LONG TERM CONFIDENCE ONLY>'+rs.all+WarningString+' '
  1605. bullTS = True
  1606. bearTS = False
  1607. if Liquidity < 0 or Liquidity - Liq_change < 0:
  1608. Tick_String = bg(100)+bg(153)+fg(95)+fg(160)+'MASSIVE SHORT COVERING <LONG TERM CONFIDENCE ONLY>'+rs.all+WarningString+' '
  1609. bearTS = True
  1610. bullTS = False
  1611. else:
  1612. bearTS1 = False
  1613. bullTS = False
  1614. bearTS = False
  1615.  
  1616.  
  1617. else:
  1618. bearTS1 = False
  1619.  
  1620. if Liquidity < 0:
  1621. if Liq_change <= avg_Liq_change and Liq_change > 0: #################
  1622. Tick_String = Fore.RED+'PIRANAHS BITING'+Style.RESET_ALL+WarningString+' ' #################
  1623. if Liq_change > avg_Liq_change * 2 and Liq_change > 0:
  1624. if mRatio >= 1 and mRatio < 3:
  1625. Tick_String = fg(153)+bg(88)+ef.u+'MASSIVE SHORT COVERING RALLY'+rs.all+WarningString+' '
  1626. bullTS = True
  1627. bearTS1 = False
  1628. if mRatio >= 3:
  1629. Tick_String = fg(158)+bg(235)+'DANGEROUS SHORT COVERING'+rs.all+WarningString+' ' ##############
  1630. bearTS1 = True
  1631. bullTS = False
  1632.  
  1633. else:
  1634. bullTS = False
  1635. bearTS1 = False
  1636. pass
  1637.  
  1638. if sneakR >= 25 and new_sneakR / sneakR < 1.1:
  1639. if mRatio < .5:
  1640. if Liquidity > 0:
  1641. Tick_String = fg(118)+bg(234)+'BULLISH ACCUMULATION'+rs.all+WarningString+' '
  1642. if Liquidity < 0:
  1643. Tick_String = fg(96)+fg(17)+bg(103)+bg(141)+'BEARISH ACCUMULATION'+rs.all+WarningString+' '
  1644. if Liq_change < 0 and Close_Price < Open_Price:
  1645. if Close_Price < lastLPrice and abs(Liq_change) > avg_Liq_change + (avg_Liq_change * .2):
  1646. if intraday_Strength >= new_Strength:
  1647. Tick_String = fg(50)+bg(243)+'REDBULL RALLY'+rs.all+WarningString+' '
  1648. bullTS = True
  1649. if new_Strength < intraday_Strength:
  1650. Tick_String = fg(255)+bg(52)+'BEARS RUN IT'+rs.all+WarningString+' '
  1651. bullTS = False
  1652. bearTS = True
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658. else:
  1659. bullTS = False
  1660. bearTS = False
  1661. pass
  1662.  
  1663.  
  1664. if LFPC >= .002 and Range_Clause == False:
  1665. if mRatio >= .2 and sneakR < 10:
  1666. if Liq_change > 0 and M_Price > lastMPrice:
  1667. bullTS = True
  1668. bearTS = False
  1669. est_diff = LFPC * Close_Price
  1670. est_price = round(est_diff + Close_Price, 2)
  1671. Tick_String = fg(159)+'MASSIVE BUYING '+str(est_price)+rs.all+WarningString+' '+str(M_Price_clone)
  1672.  
  1673.  
  1674. if Liq_change < 0 and M_Price < lastMPrice:
  1675. bearTS = True
  1676. bullTS = False
  1677. est_diff = (LFPC * -1) * Close_Price
  1678. est_price = round(est_diff + Close_Price, 2)
  1679. Tick_String = fg(154)+'MASSIVE SELLING '+str(est_price)+rs.all+WarningString+' '
  1680.  
  1681. else:
  1682. bearTS = False
  1683. bullTS = False
  1684.  
  1685. else:
  1686. bearTS = False
  1687. bullTS = False
  1688.  
  1689.  
  1690. if LFPC >= .01:
  1691. if newratio >= 1 and qratio < 10:
  1692. if Liq_change > 0:
  1693. Tick_String = fg(167)+fg(134)+bg(59)+'ALGOS BIGLY SELLERS'+rs.all+WarningString+' '
  1694. if Liq_change < 0:
  1695. Tick_String = fg(156)+fg(84)+'ALGOS BIGLY BUYERS'+rs.all+WarningString+' '
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726.  
  1727.  
  1728. Range_List[ref_Num] = Range_Found
  1729. # else:
  1730. # Tick_String = Fore.WHITE+'PRICE UP LIQ DOWN'+Style.RESET_ALL+WarningString+' '+Fore.WHITE+str(Strength)
  1731.  
  1732.  
  1733. # if abs(Liq_change) <= avg_Liq_change:
  1734. # Tick_String = Fore.RED+'SHORT RALLY'+Style.RESET_ALL+WarningString+' '+Fore.RED+str(Strength)
  1735. # # else:
  1736. # Tick_String = Fore.WHITE+'PRICE UP LIQ DOWN'+Style.RESET_ALL+WarningString+' '+Fore.WHITE+str(Strength)
  1737.  
  1738. # if Tick == -1 and Liq_Tick == 0:
  1739. # if Liquidity < 0:
  1740. # if abs(Liq_change) > avg_Liq_change*2:
  1741. # Tick_String = Fore.RED+'MM\'s BEARISH'+Style.RESET_ALL+WarningString+' '+Fore.YELLOW+str(Strength)
  1742. # else:
  1743. # Tick_String = Fore.RED+'SHORT COVERING'+Style.RESET_ALL+WarningString+' '+Fore.YELLOW+Back.BLUE+Style.BRIGHT+str(Strength)
  1744.  
  1745. Range_List[ref_Num] = Range_Found
  1746. else:
  1747.  
  1748. # if Range_Clause == True:
  1749. # if range_ref_String == "HIGH TARGET" and Money_Flow < 300000000:
  1750. # if Liq_change > 1000000:
  1751. # print("MARKET MAKER HIGH TARGET")
  1752. # if range_ref_String == "LOW TARGET" and Money_Flow > 300000000:
  1753. # if Liq_change < 1000000:
  1754. # print("MARKET MAKER LOW TARGET")
  1755.  
  1756. if lr_filled == False:
  1757. if filled == False:
  1758. if range_ref_String == "LOW TARGET" and Low_Price <= Low_Range:
  1759. filled_Price = Low_Price
  1760. time.sleep(.5)
  1761. print(Fore.WHITE + Back.RED + "LOW RANGE FILLED" + Style.RESET_ALL)
  1762. time.sleep(1)
  1763. lr_filled = True
  1764. lt_filled = False
  1765. lrf = 1
  1766. low_Ranges_Filled += lrf
  1767. if lt_filled == False and lr_filled == True:
  1768. if Close_Price <= Low_Target:
  1769. filled_target_price = Close_Price
  1770. time.sleep(.5)
  1771. print(Fore.RED + Back.YELLOW + 'LOW TARGET FILLED' + Style.RESET_ALL)
  1772. time.sleep(1)
  1773. lt_filled = True
  1774. filled = True
  1775. low_Targets_Filled += 1
  1776. if hr_filled == False:
  1777. if filled == False:
  1778. if range_ref_String == "HIGH TARGET" and High_Price >= High_Range:
  1779. filled_range_price = High_Price
  1780. time.sleep(.5)
  1781. print(Fore.CYAN + "HIGH RANGE FILLED" + Style.RESET_ALL)
  1782. time.sleep(1)
  1783. hr_filled = True
  1784. ht_filled = False
  1785. hrf = 1
  1786. high_Ranges_Filled += hrf
  1787. if ht_filled == False and hr_filled == True:
  1788. if Close_Price >= High_Target:
  1789. filled_target_price = High_Price
  1790. print(Fore.CYAN + "HIGH TARGET FILLED")
  1791. time.sleep(1)
  1792. ht_filled = True
  1793. filled = True
  1794. high_Targets_Filled += 1
  1795.  
  1796.  
  1797. if menu_ans == 'oldfile' or menu_ans == '1':
  1798. if Liquidity_Data == 'y':
  1799. if rFound == True:
  1800. if tHigh == True:
  1801. HRS = str(High_Range)
  1802. HRT = str(High_Target)
  1803. LRS = str(Low_Range)
  1804. LRT = str(Low_Target)
  1805. MIV_Index_String = str(MIV_Index)
  1806.  
  1807. 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+ticksymbolo+mticksymbol+ticksymbolc+' ]'+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))
  1808. time.sleep(2)
  1809.  
  1810.  
  1811. else:
  1812. tHigh = False
  1813. else:
  1814. rFound = False
  1815. Close_Price = Close_Price
  1816.  
  1817. if rFound == True:
  1818. if tLow == True:
  1819. HRS = str(High_Range)
  1820. HRT = str(High_Target)
  1821. LRS = str(Low_Range)
  1822. LRT = str(Low_Target)
  1823. lowFlow = str(AvgLowRangeFlow)
  1824. flow = str(Money_Flow)
  1825. MIV_Index_String = str(MIV_Index)
  1826.  
  1827. Low_Prices = {'LOW RANGE: $': Low_Range, 'LOW TARGET: $': Low_Target} ##### May not need this line
  1828. 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+ticksymbolo+mticksymbol+ticksymbolc+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))
  1829. time.sleep(2)
  1830.  
  1831. else:
  1832. tLow = False
  1833. else:
  1834. rFound = False
  1835.  
  1836. if bullTS == True:
  1837. print(Fore.CYAN+ '[' + Date + ']', military_time,PCT_Range_Str,Style.RESET_ALL + Fore.WHITE + Back.BLUE + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL + Fore.WHITE + Back.BLUE + ' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + Style.RESET_ALL, Fore.WHITE + Back.BLUE + Style.BRIGHT,'Last Price: [$' + str(Close_Price) + ']'+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+ Style.RESET_ALL + ' '+Tick_String + Style.RESET_ALL + Fore.YELLOW + Back.RED + Style.BRIGHT + Style.RESET_ALL, M_Price)
  1838. time.sleep(.5)
  1839.  
  1840.  
  1841. if bearTS == True:
  1842. print(Fore.RED+ '[' + Date + ']', military_time,PCT_Range_Str,Style.RESET_ALL + Fore.WHITE + Back.RED + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL + Fore.WHITE + Back.RED + ' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + Style.RESET_ALL, Fore.WHITE + Back.RED + Style.BRIGHT,'Last Price: [$' + str(Close_Price) + ']'+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+ Style.RESET_ALL + ' '+Tick_String + Style.RESET_ALL + Fore.YELLOW + Back.RED + Style.BRIGHT + Style.RESET_ALL, M_Price)
  1843. time.sleep(.5)
  1844.  
  1845. if nTS == True:
  1846. print(Fore.YELLOW+Style.BRIGHT+fg(123)+bg(236)+ef.u+ '[' + Date + ']', military_time,PCT_Range_Str,Style.RESET_ALL + Fore.YELLOW + Style.BRIGHT+fg(123)+bg(236)+ef.u+'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL + Fore.YELLOW + Style.BRIGHT+fg(123)+bg(236)+ef.u+' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + Style.RESET_ALL, Fore.YELLOW + Style.BRIGHT+fg(123)+bg(236)+ef.u+'Last Price: [$' + str(Close_Price) + ']'+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+ Style.RESET_ALL + ' '+Tick_String + Style.RESET_ALL + Fore.YELLOW + Back.RED + Style.BRIGHT + Style.RESET_ALL,fg(123)+bg(236)+'Est Price: $',est_price,rs.all, M_Price)
  1847. time.sleep(.5)
  1848.  
  1849. if bearTS1 == True:
  1850. print(Fore.YELLOW+Style.BRIGHT+fg(178)+bg(236)+ef.b+ '[' + Date + ']', military_time,PCT_Range_Str,Style.RESET_ALL + Fore.YELLOW + Style.BRIGHT+fg(178)+bg(236)+ef.b+'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL + Fore.YELLOW + Style.BRIGHT+fg(178)+bg(236)+ef.b+' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + Style.RESET_ALL, Fore.YELLOW + Style.BRIGHT+fg(178)+bg(236)+ef.b+'Last Price: [$' + str(Close_Price) + ']'+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+ Style.RESET_ALL + ' '+Tick_String + Style.RESET_ALL + Fore.YELLOW + Back.RED + Style.BRIGHT + Style.RESET_ALL, M_Price)
  1851. time.sleep(.5)
  1852.  
  1853.  
  1854.  
  1855.  
  1856. if bearTS == False and bullTS == False:
  1857. if nTS == False and bearTS1 == False:
  1858. if mRatio >= .45 and LFPC >= .001:
  1859. bg_color_code = bg(57)+bg(236)
  1860. bullish_price_str = fg(190)+fg(40)
  1861. bearish_price_str = fg(88)+fg(226)
  1862. if Liquidity > 0:
  1863. if Liq_change > 0:
  1864. time.sleep(timecounter)
  1865. print(Fore.YELLOW +bg_color_code+fg(191)+'[' + Date + ']', military_time,PCT_Range_Str,fg(159)+fg(10) + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Fore.GREEN + ' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + ' ' +Style.RESET_ALL+bg_color_code+bullish_price_str+'Last Price [$' + str(Close_Price) +']'+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+ Style.RESET_ALL+bg_color_code+ ' '+Tick_String + Style.RESET_ALL+Fore.WHITE+' '+SS+'%'+Style.RESET_ALL,M_Price, ' | ', est_price1)
  1866.  
  1867. if Liq_change < 0:
  1868. time.sleep(timecounter)
  1869. print(Fore.YELLOW +bg_color_code+fg(191)+'[' + Date + ']', military_time,PCT_Range_Str,fg(94)+fg(154) + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL +bg_color_code+fg(94)+fg(154)+' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + Style.RESET_ALL + bg_color_code+bearish_price_str+' ' +'Last Price [$' + str(Close_Price) +']'+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+ Style.RESET_ALL+ ' '+Tick_String + Style.RESET_ALL+Fore.WHITE+' '+SS+'%'+Style.RESET_ALL, M_Price, ' | ', est_price1)
  1870.  
  1871.  
  1872.  
  1873. if Liquidity < 0:
  1874. if Liq_change > 0:
  1875. time.sleep(timecounter)
  1876. print(bg_color_code+fg(191)+'[' + Date + ']', military_time,PCT_Range_Str,fg(88)+fg(196) + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL +bg_color_code+ fg(88)+fg(196),' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + ' ' +Style.RESET_ALL+bg_color_code+bearish_price_str+'Last Price [$' + str(Close_Price) +']'+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+Style.RESET_ALL +' '+Tick_String + Style.RESET_ALL + ' ' + Fore.WHITE+SS+'%'+Style.RESET_ALL, M_Price, ' | ', est_price1)
  1877.  
  1878. if Liq_change < 0:
  1879. time.sleep(timecounter)
  1880. print(bg_color_code+fg(191)+'[' + Date + ']', military_time,PCT_Range_Str,fg(94)+fg(154) + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL +bg_color_code+ fg(94)+fg(154),' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + ' ' +Style.RESET_ALL+bg_color_code+bullish_price_str+'Last Price [$' + str(Close_Price) +']'+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+Style.RESET_ALL + ' '+Tick_String+ Style.RESET_ALL +' ' + Fore.WHITE+SS+'%'+Style.RESET_ALL, M_Price, ' | ', est_price1)
  1881.  
  1882. else:
  1883. if Liq_change < -1000000:
  1884. 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+ticksymbolo+mticksymbol+ticksymbolc+ Style.RESET_ALL + ' '+Tick_String + Style.RESET_ALL + Fore.YELLOW + Back.RED + Style.BRIGHT + '**SELL SIGNAL**' + Style.RESET_ALL, M_Price)
  1885. time.sleep(1)
  1886. if abs(Liq_change) > 500000:
  1887. time.sleep(timecounter)
  1888. 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) +']'+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+ ' '+ Tick_String + Style.RESET_ALL + ' ' + Fore.WHITE+SS+'%'+Style.RESET_ALL, M_Price, ' | ', est_price1)
  1889.  
  1890. if Liquidity < 0:
  1891. if Liq_change > 0:
  1892. time.sleep(timecounter)
  1893. print(Fore.YELLOW+'[' + Date + ']', military_time,PCT_Range_Str+Style.RESET_ALL+Fore.BLUE+ 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL +Fore.WHITE+' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + ' ' +Style.RESET_ALL+Fore.YELLOW+Back.BLUE+'Last Price [$' + str(Close_Price) +']'+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+Style.RESET_ALL +' '+Tick_String + Style.RESET_ALL + ' ' + Fore.WHITE+SS+'%'+Style.RESET_ALL, M_Price, ' | ', est_price1)
  1894. if Liq_change < 0:
  1895. time.sleep(timecounter)
  1896. print(Fore.YELLOW+'[' + Date + ']', military_time,PCT_Range_Str+Style.RESET_ALL+Fore.BLUE+ 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL +Fore.CYAN+' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + ' ' +Style.RESET_ALL+Fore.YELLOW+Back.BLUE+'Last Price [$' + str(Close_Price) +']'+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+Style.RESET_ALL +' '+Tick_String + Style.RESET_ALL + ' ' + Fore.WHITE+SS+'%'+Style.RESET_ALL, M_Price, ' | ', est_price1)
  1897.  
  1898.  
  1899. if Liquidity > 0:
  1900. if Liq_change > 0:
  1901. time.sleep(timecounter)
  1902. print(Fore.YELLOW + '[' + Date + ']', military_time,PCT_Range_Str,
  1903. Fore.GREEN + 'Current Liquidity:' + '{:20,.2f}'.format(
  1904. Liquidity) + Fore.GREEN + ' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + ' ' + Fore.YELLOW + Back.BLUE,'Last Price [$' + str(Close_Price) +']'+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+ Style.RESET_ALL+ ' '+Tick_String + Style.RESET_ALL+Fore.WHITE+' '+SS+'%'+Style.RESET_ALL, M_Price, ' | ', est_price1)
  1905. if Liq_change < 0:
  1906. time.sleep(timecounter)
  1907. print(Fore.YELLOW + '[' + Date + ']', military_time,PCT_Range_Str,
  1908. Fore.GREEN + 'Current Liquidity:' + '{:20,.2f}'.format(
  1909. 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+ticksymbolo+mticksymbol+ticksymbolc+ Style.RESET_ALL+ ' '+Tick_String + Style.RESET_ALL+Fore.WHITE+' '+SS+'%'+Style.RESET_ALL, M_Price, ' | ', est_price1)
  1910. # elif Liq_change > 0:
  1911. # time.sleep(timecounter)
  1912. # 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+ticksymbolo+mticksymbol+ticksymbolc+Style.RESET_ALL + ' '+Tick_String + Style.RESET_ALL + ' ' + Fore.WHITE+SS+'%'+Style.RESET_ALL, M_Price, ' | ', est_price1)
  1913. # elif Liq_change < 0:
  1914. # time.sleep(timecounter)
  1915. # 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+ticksymbolo+mticksymbol+ticksymbolc+Style.RESET_ALL + ' '+Tick_String+ Style.RESET_ALL + ' ' + Fore.WHITE+SS+'%'+Style.RESET_ALL, M_Price, ' | ', est_price1)
  1916.  
  1917.  
  1918.  
  1919.  
  1920. if menu_ans == '3' or Liquidity_Data == 'n3':
  1921. import tcopy
  1922.  
  1923. if menu_ans == '5' or Liquidity_Data == 'n5':
  1924. import analyze4
  1925.  
  1926.  
  1927.  
  1928.  
  1929. if menu_ans == '4':
  1930. if Status == '| NYF |':
  1931. if LOD <= est_price_x:
  1932. Status = 'L8|Filled'
  1933.  
  1934.  
  1935. if Status == '[ NYF ]':
  1936. if HOD >= est_price_x:
  1937. Status = 'L8|Filled'
  1938.  
  1939.  
  1940.  
  1941.  
  1942. labels = ' Date Time Last LiqChange Liquidity $Flow | $Price | LFP | LFPC |EstPrice| Status | mRatio | sneakR | qratio'
  1943. underline = '-------------------------------------------------------------------------------------------------------------------------------------------------------------------------'
  1944. # if M_Price > High_Price or M_Price < Low_Price:
  1945.  
  1946. if Money_Flow > 0 and abs(Liq_change) > 0:
  1947. if LFPC >= .0013 and Range_Clause == False:
  1948. if M_Price > High_Price or M_Price < Low_Price:
  1949.  
  1950. # if LOD <= unfilled_TB_price:
  1951.  
  1952.  
  1953. rawdatalist = [Date, military_time, Close_Price, liqchgstr, liqstr, mf_Str, M_Price, LFP, LFPC, est_price_x, mRatio, sneakR, qratio]
  1954.  
  1955. rawdatalist.insert(10, Status)
  1956.  
  1957. rawdatalist1.append(rawdatalist)
  1958.  
  1959.  
  1960. if menu_ans == '6' or menu_ans == 'x' or Liquidity_Data == 'n6' or Liquidity_Data == 'nx':
  1961.  
  1962. newratio = round(10*(LFP * LFPC), 3)
  1963. if Money_Flow > 0 and abs(Liq_change) > 0:
  1964. LFP = round(Money_Flow / abs(Liq_change) *.01, 3)
  1965. est_diff = round(.01*(100 - LFP), 2)
  1966. est_diff1 = round(LFPC * Close_Price, 2)
  1967. if Liquidity < 0:
  1968. if Liq_change < 0:
  1969. est_price = round(Close_Price - est_diff1, 2)
  1970. est_price1 = round(est_diff1 + Close_Price, 2)
  1971. if Liq_change > 0:
  1972. est_price = round(Close_Price + est_diff1, 2)
  1973. est_price1 = round(Close_Price + (-1 * est_diff1), 2)
  1974. if Liquidity > 0:
  1975. if Liq_change < 0:
  1976. est_price = round(Close_Price - est_diff1, 2)
  1977. est_price1 = round(Close_Price + (-1 * est_diff1), 2)
  1978. if Liq_change > 0:
  1979. est_price = round(est_diff1 + Close_Price, 2)
  1980. est_price1 = round(est_diff1 + Close_Price, 2)
  1981.  
  1982.  
  1983. LFPC = round(1000 * (abs(Liq_change) / Money_Flow) * .01, 4)
  1984. mf_Str = '{:20,.2f}'.format(Money_Flow)
  1985. liqstr = '{:20,.2f}'.format(Liquidity)
  1986. liqchgstr = '{:20,.2f}'.format(Liq_change)
  1987. OC_Range = round(OC_Range, 2)
  1988. HL_Range = round(HL_Range, 2)
  1989. sneakR2_div_sneakR = round(new_sneakR / sneakR, 2)
  1990. rawdatalist = [Date, military_time, Close_Price, liqchgstr, liqstr, mf_Str, M_Price, LFP, LFPC, est_price1, mRatio, sneakR, qratio, avg_QR]
  1991. info_datalist = [Date, military_time, Close_Price, liqchgstr, liqstr, M_Price, PainGauge, MTR, DR, UpTicks, DownTicks, UDR]
  1992. rawdatalist3.append(info_datalist)
  1993. rawdatalist2.append(rawdatalist)
  1994. # if LFPC >= .0013 and LFP < 60:
  1995. # rawdatalist2.append(rawdatalist)
  1996. print(labels)
  1997. print(underline)
  1998. #
  1999. # for i in rawdatalist1:
  2000. # countitems += 1
  2001. # print(i)
  2002.  
  2003. if menu_ans == '6' or Liquidity_Data == 'n6':
  2004. for i in rawdatalist2:
  2005. print(i)
  2006.  
  2007. if menu_ans == 'x' or Liquidity_Data == 'nx':
  2008. for i in rawdatalist3:
  2009. print(i)
  2010.  
  2011.  
  2012. if menu_ans == '7' or Liquidity_Data == 'n7':
  2013.  
  2014.  
  2015. bigFlowbigMovepct = round(100*(LargeFlowCount / (DOWN_c + UP_c)), 2)
  2016. sum_LFPC = round((100*sum_LFPC) / 2, 3)
  2017.  
  2018. if TradingAbove_Count >= 1:
  2019. TATBR_A = round(TradingAbove_Diff / TradingAbove_Count, 2)
  2020.  
  2021. if TradingBelow_Count >= 1:
  2022. TATBR_B = round(TradingBelow_Diff / TradingBelow_Count, 2)
  2023.  
  2024. if TradingAbove_Count >= 1 and TradingBelow_Count >= 1:
  2025. if TradingAbove_Count >= TradingBelow_Count:
  2026. TATBR = round(TradingAbove_Count / TradingBelow_Count, 2)
  2027. TATBR_diff = round((TradingAbove_Diff / TradingAbove_Count) / (TradingBelow_Diff / TradingBelow_Count), 2)
  2028. if TradingAbove_Count < TradingBelow_Count:
  2029. TATBR = round(TradingBelow_Count / TradingAbove_Count, 2)
  2030. TATBR_diff = round((TradingBelow_Diff / TradingBelow_Count) / (TradingAbove_Diff / TradingAbove_Count), 2)
  2031.  
  2032. print(ef.u+Date, military_time,rs.all+'\n')
  2033.  
  2034.  
  2035.  
  2036. if new_Strength <= intraday_Strength:
  2037. print(fg(233)+fg(0)+bg(2)+'Adj BP%: ',adj_Strength,'%',' BP%: ',new_Strength,'%'+rs.all)
  2038. print('PTLT Ratio: ',PTLT_Ratio)
  2039. print('U/D Ratio: ',UD_Ratio)
  2040. print('Price Tick Total: ',Price_Tick_Total)
  2041. print('Liq Tick Total: ',Liq_Tick_Total)
  2042. print('Bullish Percentile: ',new_Strength,'%')
  2043. print('IntraDay BP%: ',intraday_Strength,'%')
  2044. print('Adj BP%: ',adj_Strength,'%')
  2045.  
  2046. sneakR_Sum = round(sneakR_Sum, 2)
  2047. TradingBelow_Diff = round(TradingBelow_Diff, 2)
  2048. TradingAbove_Diff = round(TradingAbove_Diff, 2)
  2049. sneakR_lgst_avg_ratio = round(max(sneakR_log) / avg_sneakR, 3)
  2050. if UpTicks > DownTicks:
  2051. print('Downticks: '+str(DOWN_c)+' | '+str(DownTicks)+'\n'+fg(39)+bg(238)+'Upticks: '+str(UP_c)+' | '+str(UpTicks)+rs.all)
  2052. else:
  2053. print(fg(9)+bg(16)+'Downticks: '+str(DOWN_c)+' | '+str(DownTicks),rs.all+'\n'+'Upticks: '+str(UP_c)+' | '+str(UpTicks)+rs.all)
  2054.  
  2055. if Avg_Up_Move > abs(Avg_Down_Move):
  2056. print(fg(39)+'Avg Up Move: $'+str(Avg_Up_Move)+rs.all,'\n'+'Avg Down Move: $'+str(Avg_Down_Move))
  2057. else:
  2058. if abs(Avg_Down_Move) > Avg_Up_Move:
  2059. print('Avg Up Move: $'+str(Avg_Up_Move)+rs.all,'\n'+fg(9)+'Avg Down Move: $'+str(Avg_Down_Move)+rs.all)
  2060. else:
  2061. print('Avg Up Move: $'+str(Avg_Up_Move)+'\n'+'Avg Down Move: $'+str(Avg_Down_Move))
  2062.  
  2063.  
  2064.  
  2065. print('Large Flow Count: ', LargeFlowCount,' (%s' % bigFlowbigMovepct+'%) Of Up/DownTicks')
  2066. if MTR >= .5:
  2067. if MTR >= .55:
  2068. if MTR >= .6:
  2069. print(fg(39)+bg(238)+'MoneyTickRatio: '+str(MTR)+rs.all)
  2070.  
  2071.  
  2072. else:
  2073. print(fg(38)+'MoneyTickRatio: '+str(MTR)+rs.all)
  2074. else:
  2075. print(fg(79)+'MoneyTickRatio: '+str(MTR)+rs.all)
  2076.  
  2077.  
  2078. else:
  2079. print(fg(9)+'MoneyTickRatio: ',MTR,rs.all)
  2080. if DR >= 1:
  2081. if DR > 2:
  2082. print(fg(39)+bg(238)+'$ Strength: '+str(DR)+rs.all)
  2083. else:
  2084. print(fg(50)+'$ Strength: '+str(DR)+rs.all)
  2085.  
  2086.  
  2087.  
  2088. if DR < 1:
  2089. print(fg(9)+'$ Strength: '+str(DR)+rs.all)
  2090.  
  2091. if PainGauge < 1:
  2092. if PainGauge < .8:
  2093. print(fg(39)+bg(238)+'PainGauge: %s (%s' % (PainGauge, PainGaugePct)+'%)',rs.all)
  2094. else:
  2095. print(fg(117)+bg(238)+'PainGauge: %s (%s' % (PainGauge, PainGaugePct)+'%)',rs.all)
  2096.  
  2097. if PainGauge >= 1:
  2098. print(fg(9)+'PainGauge: %s (%s' % (PainGauge, PainGaugePct)+'%)',rs.all)
  2099.  
  2100.  
  2101. avg_sneakr_avg_m = round(avg_sneakR / avg_mRatio, 3)
  2102.  
  2103. if avg_sneakr_avg_m >= avg_sneakR:
  2104. if avg_sneakr_avg_m < 25 and avg_sneakR < 20:
  2105. print(ef.u+fg(0)+bg(1)+'Avg sneakR1: ',avg_sneakR,rs.all+'\n'+fg(191)+bg(124)+ef.b+'Avg sneakR / avg mRatio',avg_sneakr_avg_m,rs.all)
  2106. else:
  2107.  
  2108. print(ef.dim+fg(100)+'Avg sneakR1: ',avg_sneakR,rs.all+'\n'+fg(9)+ef.u+'Avg sneakR / avg mRatio',avg_sneakr_avg_m,rs.all)
  2109.  
  2110. # print(ef.dim+'Avg sneakR1: ',avg_sneakR,rs.all+'\n'+fg(50)+ef.u+'Avg sneakR / avg mRatio',avg_sneakr_avg_m,rs.all)
  2111. else:
  2112. print(fg(50)+ef.u+'Avg sneakR1: ',avg_sneakR,rs.all+'\n'+ef.dim+fg(100)+'Avg sneakR / avg mRatio',avg_sneakr_avg_m, rs.all)
  2113.  
  2114. if sneakR_lgst_avg_ratio >= 7:
  2115. print('sneakR lgst:avg: '+fg(9)+str(sneakR_lgst_avg_ratio)+rs.all)
  2116. else:
  2117. print(fg(123)+bg(90)+ef.u+'sneakR lgst:avg: '+str(sneakR_lgst_avg_ratio)+rs.all)
  2118.  
  2119. print('Implied Vol: ',Avg_Move,'%')
  2120. print('LFPC Volatility %: ',sum_LFPC,'%')
  2121.  
  2122. print('TATBR Sum As % Of Price: ',str(TATBR_Sum)+'%')
  2123. print('Largest Sneak Ratio: ', max(sneakR_log))
  2124.  
  2125. print(ef.u+'Trading Above Count: ', TradingAbove_Count, 'Trading Above $ Total: $', TradingAbove_Diff,rs.all)
  2126. print(ef.u+'Trading Below Count: ', TradingBelow_Count, 'Trading Below $ Total: $', TradingBelow_Diff,rs.all)
  2127. if TradingAbove_Count >= 1 and TradingBelow_Count >= 1:
  2128. if TradingAbove_Count > TradingBelow_Count:
  2129. if TATBR > TATBR_diff:
  2130. print(ef.dim+'TATBR: ',TATBR,rs.all,'\n'+fg(172)+ef.u+'TATBR Diff: ',TATBR_diff,rs.all)
  2131.  
  2132. if TATBR_diff > TATBR:
  2133. print(ef.dim+'TATBR: ',TATBR,rs.all,'\n'+fg(39)+ef.u+'TATBR Diff: ',TATBR_diff,rs.all)
  2134.  
  2135. if TradingBelow_Count > TradingAbove_Count:
  2136. if TATBR > TATBR_diff:
  2137. print(fg(154)+'TATBR: ',TATBR,rs.all,'\n'+fg(17)+bg(154)+ef.u+'TATBR Diff: ',TATBR_diff,rs.all)
  2138.  
  2139. if TATBR_diff > TATBR:
  2140. print(fg(154)+'TATBR: ',TATBR,rs.all,'\n'+fg(157)+bg(17)+ef.u+'TATBR Diff: ',TATBR_diff,rs.all,)
  2141.  
  2142.  
  2143. print('TATBR_A: ',TATBR_A)
  2144. print('TATBR_B: ',TATBR_B)
  2145. print('GapUps: ',gapUp)
  2146. print('GapDowns: ',gapDown)
  2147. print('UpCount: ',UP_c)
  2148. print('DownCount: ',DOWN_c)
  2149.  
  2150.  
  2151.  
  2152. if gapRatio >= 1:
  2153. if gapRatio >= 1.5:
  2154. print(bg(123)+fg(4)+ef.u+ef.b+'GapRatio: ',gapRatio,rs.all)
  2155. else:
  2156. print(fg(39)+'GapRatio: ',gapRatio,rs.all)
  2157.  
  2158. if gapRatio < 1:
  2159. print(fg(9)+'GapRatio: ',gapRatio,rs.all)
  2160. print('MIV Spike Count: ',MIV_Spike_Count)
  2161. print('Avg MIV Spike',Avg_MIV_Spike,'%')
  2162. print('sneakR_Sum: ',sneakR_Sum)
  2163. if avg_mRatio >= 1:
  2164. print(fg(159)+bg(52)+'Avg mRatio: ',avg_mRatio,rs.all)
  2165. else:
  2166. print('Avg mRatio: ',avg_mRatio)
  2167.  
  2168. print('Avg Liq Change: $','{:5,.2f}'.format(avg_Liq_change))
  2169. if chg_Open > 0:
  2170. print(fg(51)+'% Chg Open: ',chg_Open,'%',rs.all)
  2171. else:
  2172. print(fg(9)+'% Chg Open: ',chg_Open,'%',rs.all)
  2173.  
  2174. liqstr = '{:5,.2f}'.format(Liquidity)
  2175. avg_pct_liq_chg = round(100*(avg_Liq_change / abs(Liquidity)), 3)
  2176. print('Liquidity: $',liqstr)
  2177. print('Avg Liq Change % Liquidity: ',avg_pct_liq_chg,'%')
  2178. if avg_QR < 25:
  2179. print(fg(11)+bg(59)+'Avg QR: ',avg_QR,rs.all)
  2180. else:
  2181. print(fg(20)+bg(59)+'Avg QR: ',avg_QR,rs.all)
  2182. print('PivotPrice: '+PivotStr)
  2183.  
  2184.  
  2185. # for i in analysis_log:
  2186. # print(i)
  2187.  
  2188.  
  2189.  
  2190.  
  2191. if PrintInfo == True:
  2192.  
  2193.  
  2194. print('MIV Spike Count: ',MIV_Spike_Count)
  2195. print('Avg MIV Spike',Avg_MIV_Spike,'%')
  2196. print(Fore.CYAN + 'REF#:', ref_Num)
  2197. time.sleep(.25)
  2198. print(Fore.WHITE + Time)
  2199. time.sleep(.25)
  2200. print('Adj BP%: ',adj_Strength,'%')
  2201.  
  2202. print("Last:", "$" + str(Close_Price))
  2203. time.sleep(.25)
  2204. print("HLCC:", "$" + str(HLCC))
  2205. time.sleep(.25)
  2206. if HLCC >= M_Price:
  2207. print(Fore.CYAN+"Money Price: "+" $" + str(round(M_Price, 2))+Style.RESET_ALL)
  2208. time.sleep(.25)
  2209. print(Fore.CYAN+'Price Diff: ' + '$' + str(Diff)+Style.RESET_ALL)
  2210.  
  2211. if HLCC < M_Price:
  2212. print(Fore.RED+"Money Price: "+Fore.RED+" $" + str(round(M_Price, 2))+Style.RESET_ALL)
  2213. time.sleep(.25)
  2214. print(Fore.RED+'Price Diff: ' + '$' + str(Diff)+Style.RESET_ALL)
  2215.  
  2216. time.sleep(.25)
  2217. if f_Vol > 1000000:
  2218. print(Fore.YELLOW + 'Volume:' + '{:20,.2f}'.format(f_Vol))
  2219. else:
  2220. print(Fore.WHITE + 'Volume:' + '{:20,.2f}'.format(f_Vol))
  2221. time.sleep(.25)
  2222. if Money_Flow > 350000000:
  2223. print(Fore.YELLOW + '$Flow:' + '{:20,.2f}'.format(Money_Flow))
  2224. else:
  2225. print(Fore.WHITE + '$Flow:' + '{:20,.2f}'.format(Money_Flow))
  2226. time.sleep(.25)
  2227. if Liq_change < 0:
  2228. print(Fore.RED + 'Liq Change:', '{:20,.2f}'.format(Liq_change), Style.RESET_ALL)
  2229. else:
  2230. print(Fore.CYAN + 'Liq Change:', '{:20,.2f}'.format(Liq_change))
  2231. time.sleep(.25)
  2232. if Liquidity < 0:
  2233. print(Fore.RED + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity), Style.RESET_ALL)
  2234. else:
  2235. print(Fore.CYAN + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity), Style.RESET_ALL)
  2236. time.sleep(.25)
  2237. print('Avg MIV Spike: ',Avg_MIV_Spike,'%')
  2238. print('Gap Ratio: ',gapRatio)
  2239. if percent_Strength >= -.68:
  2240. percent_Strength_String = Fore.GREEN+'Current Strength: '+str(percent_Strength)+'%'+Style.RESET_ALL
  2241. print(percent_Strength_String)
  2242. if percent_Strength <-.68:
  2243. percent_Strength_String = Fore.RED+'Current Strength: '+str(percent_Strength)+'%'+Style.RESET_ALL
  2244. print(percent_Strength_String)
  2245.  
  2246. # new_Strength = 100-(100*abs(percent_Strength- -.3153) / .8719)
  2247. if new_Strength > 70:
  2248. if intraday_Strength >= new_Strength:
  2249. print(ef.u+'Adj BP%: ',adj_Strength,'%',rs.all,'\n'+'Bullishness Percentile: '+str(round(new_Strength, 2)))
  2250. else:
  2251. new_Strength_String = Fore.CYAN+'Bullishness Percentile: '+str(round(new_Strength, 2))+'%'+Style.RESET_ALL
  2252.  
  2253. else:
  2254. print('Adj BP%: ',adj_Strength,'%')
  2255. new_Strength_String = Fore.RED+'Bullishness Percentile: '+str(round(new_Strength, 2))+'%'+Style.RESET_ALL
  2256. print('PainGauge: ',PainGauge)
  2257. print('IntraDay Strength: ',intraday_Strength,'%')
  2258. # pctShortBuying = round(BuyPower / ShortPower, 4)*100
  2259. # pctNetSelling = round(SellPower / ShortPower, 4)*100
  2260. # pctNetBuying = round(BuyPower / SellPower, 4)*100
  2261. # pctNetBuyingStr = str(pctNetBuying)
  2262. # pctNetSellingStr = str(pctNetSelling)
  2263. # pctShortBuyingStr = str(pctShortBuying)
  2264. # print('Buy Power', '{:5,.2f}'.format(BuyPower), 'Short Power:','{:5,.2f}'.format(ShortPower))
  2265. # print('Buy Power as % of Short Selling: ['+pctShortBuyingStr+'%]')
  2266. # print('Sell Power as % of Short Selling: ['+pctNetSellingStr+'%]')
  2267. # BullBearRatio = abs(round(float(pctShortBuying / pctNetSelling), 4))
  2268. # print('Bull Bear Ratio: ',BullBearRatio)
  2269. print('UpTick/DownTick Ratio: ',UDR)
  2270. print('Avg Cover Price: $%s' % CoverPrice)
  2271. print('Money Tick Ratio: '+str(MTR))
  2272. if DRC >= 1:
  2273. print('DRC: ', DRC)
  2274. print('Avg Distribution Price: $'+str(Avg_DPrice))
  2275. print('Weighted Avg DPrice: $'+str(Weighted_Avg_DPrice))
  2276.  
  2277. print('Last Distribution Price: $'+str(lastDPrice))
  2278. # print('Resistance: $',max(DP_list))
  2279. # print('Support: $',min(DP_list))
  2280. print('$ Strength: '+str(DR))
  2281.  
  2282.  
  2283. if lows_found >= 1 or highs_found >= 1:
  2284. print('\nLow Ranges/Targets Found|Filled:',lows_found, '| ', low_Ranges_Filled)
  2285. print('\nHigh Ranges/Targets Found|Filled: ',highs_found, '| ', high_Ranges_Filled)
  2286. print('Total found: ',found)
  2287.  
  2288. Style.RESET_ALL
  2289.  
  2290.  
  2291.  
  2292. ### OTHER COLORS - 45, 94
  2293. ### 52, 87 (bullish maybe)
  2294. ### 220, 0 (bearish/volatile maybe
  2295. ### 236, 16, dope color combo
  2296. ###197, 232, like a pink on black looks dope
  2297. ### 171,232
  2298. ### 122, 53
  2299. ### 190, 16
  2300. ### 159, 235
  2301. ###118, 234
  2302. ### 246, 237
  2303. ### 152, 233
  2304. ### I like 213 and 113 fg
  2305. ### 15, 161
  2306. ### 21, 85
  2307. ### 130, 120, like a pink on green, bullish
  2308. ### fg 152 is super nice
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement