ImDerekD

suga

Mar 24th, 2020
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 136.30 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. import random
  22. import numpy as np
  23. shutil.copy('/Users/King/data.csv', '/Users/King/SpyFlow Dropbox/SpyFlow_Dropbox/data.csv')
  24.  
  25.  
  26. with open('/Users/King/Spy_data_analysis.csv', 'w+') as csv_file2:
  27. writer_labels = ['ref_Num', 'Date', 'Time', 'Price', 'MoneyPrice', 'xString', 'qrdivmax', 'EstimatedPrice', 'EstPrice2', 'MTR', 'PainGauge', 'DR', 'IntradayStrength', 'new_Strength', 'LFP', 'LFPC','mRatio','sneakR','qratio','sneakRSum','avgsneakR','avgQR','MIVCount','avg_Liq_change','lastDPrice','Weighted_Avg_DPrice','Weighted_Movement','UDV','UDR_Ticks','MACD','sneakR_Sum','avg_sneakR','gapRatio','Resistance','Support', 'ChgOpen', 'OpenPrice', 'HighPrice', 'LowPrice', 'LiqChange', 'Liquidity', 'Volume', 'MoneyFlow', 'MIV_Index', 'AvgVol', 'MTR_copy', 'PTLT Ratio', 'gapRatio', 'GDR', 'PVS', 'Vol sneakR Ratio', 'UDR', 'SketchDist', 'MIV_Value', 'VIX_Estimate']
  28. wr = csv.writer(csv_file2)
  29. wr.writerow(writer_labels)
  30.  
  31.  
  32. with open('/Users/King/liveplot_analysis.csv', 'w') as plotfile:
  33. writer_labels = ['ref_Num', 'Date', 'Time', 'Price', 'sneakR', 'qratio', 'LFPC', 'PVS', 'MIV_Index', 'Liquidity', 'LFP', 'Liq_change']
  34. wr = csv.writer(plotfile)
  35. wr.writerow(writer_labels)
  36.  
  37. with open('/Users/King/Spy_var_analysis.csv', 'w+') as plotfile:
  38. vardatalabels = ['Date', 'Time', 'ref_Num', 'Price', 'ChgO', 'PG', 'MTR', 'DR', 'GR', 'GDR', 'PVS', 'avgVol', 'ITDS', 'NS', 'SS', 'avgQR', 'ALQ', 'UDR', 'VSR', 'QRS_Index', 'avgVSR', 'DRC', 'CashOpen', 'Liquidity', 'MTRStrength', 'UDRStrength', 'avgLFP', '45Min', '60Min', '120Min']
  39. wr = csv.writer(plotfile)
  40. wr.writerow(vardatalabels)
  41.  
  42. adj_Strength = float()
  43. analysis_list = []
  44. analysis_log = []
  45. avg_OC_Range = float()
  46. Avg_DPrice = float()
  47. Avg_Down_Move = float()
  48. avg_Flow = float(1)
  49. avg_HL_Range = float()
  50. avgHigh = float()
  51. avgLow = float()
  52. avg_Liq_change = float()
  53. Avg_MIV_Spike = float()
  54. avg_sneakR = float()
  55. Avg_Up_Move = float()
  56. avgVol = float()
  57. Avg_Move = float()
  58. avgQR = float()
  59. avgVIX = float()
  60. avg_large_LFPC = float()
  61. avg_mRatio = float()
  62. avg_up_move_clone = float()
  63. avg_down_move_clone = float()
  64.  
  65.  
  66. BB_Strength = float()
  67. bearTS1 = bool
  68. FMC = bool
  69. bearTS = bool
  70. BES = bool
  71. bullTS = bool
  72.  
  73. CashOpenHash = '00491302948265c47e651fcff99fd9fb'
  74. CashOpen = float()
  75. CoverCount = int()
  76. CoverMoney = float()
  77. CoverPrice = float()
  78. C_Price = float()
  79. CoverLiquidity = float()
  80. CoverVolumeTotal = float()
  81. Cumulutive_DPrice = float()
  82. countitems = int()
  83.  
  84.  
  85. day_left = float()
  86. DU = int()
  87. DD = int()
  88. DownTicks = int()
  89. down_val = float()
  90. down_val_count = int()
  91. DOWN_c = int()
  92. DOWN_IV = float()
  93. DP_list = []
  94. DP_Uptick = int()
  95. DP_Downtick = int()
  96. DP_UptickList = []
  97. DP_DowntickList = []
  98. DRC = int()
  99. DR = float()
  100. Distribution_Price = float()
  101.  
  102.  
  103. est_price_x = float()
  104. est_diff_x = float()
  105. est_diff1 = float()
  106. est_price1 = float()
  107. est_price = float(1)
  108. LQPPrice_match = float()
  109. LQPPrice_no_match = float()
  110. EstLiqPrice = float()
  111. EstimatedPrice = float()
  112. est_price_filled = bool
  113. ExtremelyLargeFlowCount = int()
  114. ExtremelyLargesneakRCount = int()
  115. extremeBearTS = bool
  116. extremeBullTS1 = bool
  117. extremeBullTS = False
  118. extremeDR = bool
  119. extremeGR = bool
  120.  
  121. gapRatio = float()
  122. gapDistanceRatio = float()
  123.  
  124. highlist = []
  125. HOD = float()
  126.  
  127. info_datalist = []
  128.  
  129. labels = str()
  130. LargeFlowCount = int()
  131. LargeFlowSum = float()
  132. LargesneakRCount = int()
  133. lastFPrice = float()
  134. Liq_Tick_Total = int()
  135. LFPC = float()
  136. LFP = float(1)
  137. LOD = float()
  138. log = []
  139. LongPrice = float()
  140. LFPC_Count = int()
  141. lowlist = []
  142. LQP_Match = bool
  143.  
  144. Mark_The_Maker = bool
  145. MIV_Spike_List = []
  146. MIV_Spike_Count = int()
  147. MIV_Spike = float()
  148. MUTick = int()
  149. MDTick = int()
  150. MTR = float()
  151. MTR_copy = float()
  152. MT = int()
  153. mRatio = float()
  154. MIV_Index = float()
  155. money_analysis_log = []
  156. M_Price_clone = float()
  157. MoneyTickGauge = float()
  158. MLOD = bool
  159. MHOD = bool
  160. MHOD_Price = float()
  161. MLOD_Price = float()
  162. MTR_Strength = float()
  163. MTR_s = int()
  164.  
  165. new_sneakR = float()
  166. new_Strength_String = str()
  167. nTS = bool
  168. # newvix = float()
  169.  
  170. pause = float()
  171. PD = bool
  172. PVP = float()
  173. PainGauge = float()
  174. PG = float()
  175. PainGaugePct = float()
  176. PTLT_Ratio = float()
  177. Price_Tick_Total = int()
  178. price_tick_str = str()
  179. PriceTickGauge = float()
  180. PriceUpTickGauge = float()
  181. PriceDownTickGauge = float()
  182. projected_ss_eod = float()
  183. pg_up_var = float()
  184. pg_down_var = float()
  185.  
  186. real_ticks = int()
  187. rawdatalist = []
  188. rawdatalist1 = []
  189. rawdatalist2 = []
  190. rawdatalist3 = []
  191. rPVS = float()
  192.  
  193. SAMS = bool
  194. BAMS = bool
  195. countbam = int()
  196. ShortPrice = float()
  197. ShortVolumeTotal = float()
  198. S_Price = float()
  199. ShortLiquidity = float()
  200. ShortCount = int()
  201. ShortMoney = float()
  202. sumVol = float()
  203. sum_Flow = float()
  204. sumFlow = float()
  205. SumLiq = float()
  206. sum_down_move = float()
  207. sum_down_count = int()
  208. sum_up_move = float()
  209. sum_up_count = int()
  210. sum_OC_Range = float()
  211. sum_HL_Range = float()
  212. sneakR = float()
  213. sneakR_analysis_log = []
  214. sneakR_Sum = float()
  215. sneakR_lgst_avg_ratio = float()
  216. sneakR_log = []
  217. Status = str()
  218. sum_QR = float()
  219. sum_large_LFPC = float()
  220. sum_MRatio = float()
  221. sum_LFPC = float()
  222. sumLFP = float()
  223.  
  224.  
  225. TA = bool
  226. TB = bool
  227. TATBR_Sum = float()
  228. TATBR_Ratio = float()
  229. TATBR_A = float()
  230. TATBR_B = float()
  231. TickGauge = float()
  232. TradingAbove_Count = int()
  233. TradingAbove_Diff = float()
  234. TradingBelow_Count = int()
  235. TradingBelow_Diff = float()
  236. technicals = []
  237. technicals_list = []
  238. TotalDiff = float()
  239. trend = float()
  240. PivotSpread = float()
  241.  
  242. UDR = float()
  243. UD_Ratio = float()
  244. UDR_Ticks = int()
  245. UDV = int()
  246. unfilled_TA_price = float()
  247. unfilled_TA_price = float()
  248. UP_c = int()
  249. UP_IV = float()
  250. up_val = float()
  251. up_val_count = int()
  252. underline = str()
  253. UpTicks = int()
  254. UDR_Strength = float()
  255. UDR_s = int()
  256. sro_ref = int()
  257.  
  258. VeryLargesneakRCount = int()
  259. VeryLargeFlowCount = int()
  260. VSR = float()
  261. VIX = float()
  262. VIX_List = []
  263. sumVSR = float()
  264. avgVSR = float()
  265. avgLFP = float()
  266.  
  267. QR = float()
  268. qratio = float()
  269. qratio_div_max = float()
  270.  
  271. writedatalist = []
  272. Weighted_Avg_DPrice = float()
  273. Weighted_Movement = float()
  274.  
  275. xratio = float()
  276. xString = ''
  277.  
  278.  
  279.  
  280.  
  281. datafile = '/Users/King/data.csv'
  282. historicaldir = '/Users/King/SPY_CSV_FULL/FULLFILES/'
  283. Liquidity_Data = str()
  284.  
  285.  
  286.  
  287. Resistance = float()
  288. Support = float()
  289. SketchDist = float()
  290. hidden_strength = float()
  291. hs_up = int()
  292. hs_down = int()
  293. mpricelist = []
  294. prevpricelist15 = []
  295. prevpricelist45 = []
  296. prevpricelist60 = []
  297. prevpricelist120 = []
  298. chg_15 = float()
  299. chg_45 = float()
  300. chg_60 = float()
  301. chg_120 = float()
  302. MIV_Value = float()
  303. runningValueIndex = float()
  304. avgMPrice = float()
  305. QRS_Index = float()
  306. menu_ans = input('What would you like to do? \n [1] Print Liquidity | [2] ComparisonChart | [3] Tcopy Ranges | [4] Show Est TA/TB Prices | [5] Analyze Scenarios | [6] Data Analysis\n')
  307. if menu_ans == '1':
  308. Liquidity_Data = input('Would you like to print liquidity data? [y/n]: ')
  309. PrintInfo = True
  310. if menu_ans == '2':
  311. import graphcomp
  312. if menu_ans == '3':
  313. option3 = True
  314. if menu_ans == 'oldfile':
  315. PrintInfo = True
  316. try_file = input('Enter Date [MM_DD_YYYY]: ')
  317. Liquidity_Data = input('Would you like to print liquidity data? [y/n]: ')
  318.  
  319.  
  320. # for file in glob.glob (historicaldir+'*csv'):
  321. # historicaldate = file[39:-8]
  322.  
  323. datafile = historicaldir+'SPY_'+try_file+'FULL.csv'
  324.  
  325.  
  326. with open(datafile, 'r') as csv_file:
  327. csv_reader = csv.reader(csv_file)
  328. header = next(csv_reader)
  329.  
  330.  
  331. ref = [] # Start off w/ empty list
  332. ref_Num = int(0) # First to go in list = ref # (390 cells in 1 day)(using ref+=1 for each row)
  333. data = [] # Not sure but I could rearrange for liquidity?
  334. Liquidity = float()
  335. found = int(0)
  336. Range = []
  337. Target = []
  338. filled = bool
  339. filled_Price = float()
  340. Range_List = {}
  341. Low_Range_Found = {}
  342. High_Range_Found = {}
  343. ht_filled = bool
  344. hr_filled = bool
  345. lr_filled = bool
  346. lt_filled = bool
  347. lastDPrice = float()
  348.  
  349. lows_found = int()
  350. highs_found = int()
  351. Tick = int()
  352. Range_Found = {}
  353. range_ref_String = ('')
  354. dTime = []
  355. PrintInfo = bool
  356. new_range = bool
  357. t = bool
  358. tLow = bool
  359. tHigh = bool
  360. Target = float()
  361. Range_Dict = {}
  362. TickString = str()
  363. Tick_String = ''
  364. Strength = int()
  365. StartTraceback = {}
  366. day_Count = int()
  367. tList = []
  368. Last = float()
  369. LT = float()
  370. HT = float()
  371. ATR = float()
  372. OC_ATR = float()
  373. Avg_ATR = float()
  374. TrendStrength = ''
  375. Previous = []
  376. allfoundallfilled = {}
  377. lowfilled = float()
  378. highfilled = float()
  379. rangefilled = bool
  380. low_Ranges_Filled = int()
  381. high_Ranges_Filled = int()
  382. high_Targets_Filled = int()
  383. low_Targets_Filled = int()
  384. prevVol = float(1)
  385. prevFlow = float(1)
  386. lastFlow = float(1)
  387. lastVol = float(1)
  388. prevIndexValue = float(1)
  389. prevPrice = float(1)
  390. lastLFPC = float(1)
  391. lastsneakR = float(1)
  392. lastmRatio = float(1)
  393.  
  394. Status = str('')
  395. RangeTarget = float()
  396. rFound = bool
  397. count = int(0)
  398. PCT_Range_Str = ''
  399.  
  400.  
  401.  
  402. sum_OHLC_Range = float()
  403. WarningString = ''
  404. sum_Liq = float()
  405. avg_Liq_change = float()
  406. HighRangeFlow = float()
  407. LowRangeFlow = float()
  408. LiqFlowPrice = float()
  409. LiqFlowPriceClone = float()
  410. EntryStr = str()
  411. OC_HL_RangePct = float()
  412. StrengthReference = float()
  413. AvgStrengthReference = float()
  414. counter = int()
  415.  
  416. liqList = []
  417. PULQ = bool
  418.  
  419. BuyVolume = float()
  420. BuyPower = float()
  421. ShortVolume = float()
  422. ShortPower = float()
  423. SellVolume = float()
  424. SellPower = float()
  425. BuySellRatio = float()
  426. HL_RangePct = float()
  427.  
  428. Price1 = float()
  429. prevPrice1 = float()
  430. gapDown = int()
  431. gapUp = int()
  432. gapUpDistance = float()
  433. gapDownDistance = float()
  434. prevMPrice = float()
  435. prevMPrice2 = float()
  436. prevPrice1 = float()
  437. lastMPrice = float()
  438. lastHPrice = float()
  439. lastLPrice = float()
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446. for row in csv_reader:
  447. range_ref_String = ''
  448. LRS = '$'
  449. LRT = '$'
  450. HRS = '$'
  451. HRT = '$'
  452. found_Price_String = '$'
  453. end_String = 'Price while found: $'
  454. # row = [Time, Open, Close, High, Low, realVol, Money_Flow]
  455. ref_Num += 1
  456. dTime = str(datetime.strptime(row[0], '%a %b %d %H:%M'))
  457. Time = dTime[-14:]
  458. Open_Price = float(row[1]) # Price Data Dictionary
  459. Close_Price = float(row[2]) # Price Data Dictionary
  460. High_Price = float(row[3]) # Price Data Dictionary
  461. Low_Price = float(row[4]) # Price Data Dictionary
  462. Money_Flow = float(row[6]) # Price Data Dictionary
  463. Vol = row[5] # Price Data Dictionary
  464. f_Vol = float(Vol[:-1]) # Price Data Dictionary
  465. m_Vol = str(Vol[-1:]) # Price Data Dictionary
  466. if m_Vol == "K": # Price Data Dictionary
  467. f_Vol = f_Vol * 1000 # Price Data Dictionary
  468. if m_Vol == "M": # Price Data Dictionary
  469. f_Vol = f_Vol * 1000000
  470. if m_Vol != "K" and m_Vol != "M":
  471. f_Vol = float(row[5]) # Price Data Dictionary
  472. if f_Vol < 1:
  473. M_Price = HLCC
  474. else:
  475. M_Price = round(float(Money_Flow) / f_Vol, 2)
  476. HLCC = float(High_Price + Low_Price + Close_Price + Close_Price)/4 # Price Data Dictionary & RangeReference Dictionary # Price Data Dictionary & RangeReference Dictionary
  477. Diff = round(HLCC - M_Price, 2)
  478. findDiff = round(M_Price - Close_Price, 2)
  479. TotalDiff += findDiff
  480. PivotPrice = round(Close_Price + TotalDiff, 2)
  481. PivotSpread += findDiff
  482. PVP = round(100*(PivotSpread / Close_Price), 3)
  483. if PivotPrice > Close_Price + .45:
  484. PivotStr = Fore.CYAN+str(PivotPrice)+Style.RESET_ALL
  485. if PivotPrice < Close_Price - .45:
  486. PivotStr = Fore.RED+str(PivotPrice)+Style.RESET_ALL
  487.  
  488. if abs(PivotPrice - Close_Price) < .15:
  489. PivotStr = Fore.WHITE+str(PivotPrice)+Style.RESET_ALL
  490.  
  491. if abs(PivotPrice - Close_Price) > .15 and abs(PivotPrice - Close_Price) < .45:
  492. PivotStr = Fore.YELLOW+str(PivotPrice)+Style.RESET_ALL # Price Data Dictionary & RangeReference Dictionary & Data Dictionary
  493.  
  494. if PivotPrice > Close_Price + .75:
  495. PivotStr = Fore.CYAN+Style.BRIGHT+str(PivotPrice)+Style.RESET_ALL
  496.  
  497. if PivotPrice < Close_Price - .75:
  498. PivotStr = Fore.RED+Style.BRIGHT+str(PivotPrice)+Style.RESET_ALL
  499. MMM = float(f_Vol * HLCC) # Price Data Dictionary & RangeReference Dictionary & Data Dictionary
  500. Liq_change = float(Money_Flow - MMM) # Price Data Dictionary & RangeReference Dictionary & Data Dictionary
  501. Liquidity += Liq_change # Price Data Dictionary & RangeReference Dictionary & Data Dictionary
  502. Date = str(Time[:5]) # Important
  503. military_time = str(Time[-8:])
  504. criteria = abs(.003*HLCC)
  505. hashTime = hashlib.md5(str.encode(military_time))
  506. Liq_Tick = int()
  507. Price_Tick = int()
  508. tREF = int()
  509. liqstr = '{:20,.2f}'.format(Liquidity)
  510. liqchgstr = '{:20,.2f}'.format(Liq_change)
  511. mf_Str = '{:20,.2f}'.format(Money_Flow)
  512.  
  513. rFound = False
  514.  
  515. OC_Range = abs(Close_Price - Open_Price)
  516. HL_Range = abs(High_Price - Low_Price)
  517. sum_OC_Range += OC_Range
  518. sum_HL_Range += HL_Range
  519. avg_HL_Range = round(sum_HL_Range / ref_Num, 2)
  520. avg_OC_Range = round(sum_OC_Range / ref_Num, 2)
  521.  
  522. sum_Liq += abs(Liq_change)
  523. liqList.append(sum_Liq)
  524.  
  525. abs_Liq = abs(Liq_change)
  526. prevLiq = float()
  527.  
  528. mticksymbol = ''
  529. ticksymbolc = ''
  530. ticksymbolo = ''
  531. M_Price_clone = M_Price
  532. mpricelist.append(M_Price)
  533. avgMPrice = statistics.mean(mpricelist)
  534. highlist.append(High_Price)
  535. lowlist.append(Low_Price)
  536.  
  537.  
  538. Weighted_Movement += (High_Price - Open_Price) + (Low_Price - Close_Price) + (Close_Price - Open_Price)
  539. Weighted_Movement = round(Weighted_Movement, 2)
  540. prevpricelist15.append(Close_Price)
  541. prevpricelist45.append(Close_Price)
  542. prevpricelist60.append(Close_Price)
  543. prevpricelist120.append(Close_Price)
  544.  
  545.  
  546. if hashTime.hexdigest() == CashOpenHash:
  547. CashOpen = Open_Price
  548. HOD = High_Price
  549. LOD = Low_Price
  550.  
  551. if ref_Num >= 1:
  552. CashOpen = CashOpen
  553. if ref_Num >= 16:
  554. if ref_Num < 374:
  555.  
  556. chg_15 = round(100*(Close_Price - prevpricelist15[0]) / prevpricelist15[0], 2)
  557. prevpricelist15.append(Close_Price)
  558. prevpricelist15.pop(0)
  559.  
  560. else:
  561. chg_15 = round(100*(Close_Price - prevpricelist15[0]) / prevpricelist15[0], 2)
  562. prevpricelist15.append(Close_Price)
  563.  
  564. if ref_Num >= 46:
  565. chg_45 = round(100*(Close_Price - prevpricelist45[0]) / prevpricelist45[0], 2)
  566. prevpricelist45.append(Close_Price)
  567.  
  568. if ref_Num < 344:
  569. prevpricelist45.pop(0)
  570.  
  571.  
  572. if ref_Num >= 61:
  573. chg_60 = round(100*(Close_Price - prevpricelist60[0]) / prevpricelist60[0], 2)
  574. prevpricelist60.append(Close_Price)
  575.  
  576. if ref_Num < 329:
  577. prevpricelist60.pop(0)
  578.  
  579.  
  580. if ref_Num >= 121:
  581. chg_120 = round(100*(Close_Price - prevpricelist120[0]) / prevpricelist120[0], 2)
  582. prevpricelist120.append(Close_Price)
  583.  
  584. if ref_Num < 269:
  585. prevpricelist120.pop(0)
  586.  
  587.  
  588.  
  589. chg_Open = round(100*(Close_Price - CashOpen) / CashOpen, 2)
  590.  
  591. if Close_Price > Open_Price:
  592. sum_up_move += abs(Close_Price - Open_Price)
  593. sum_up_count += 1
  594. if Close_Price < Open_Price:
  595. sum_down_move += abs(Close_Price - Open_Price)
  596. sum_down_count += 1
  597.  
  598.  
  599. if sum_up_count >= 1:
  600. avg_up_move_clone = round(sum_up_move / sum_up_count, 2)
  601. if sum_down_count >= 1:
  602. avg_down_move_clone = round(sum_down_move / sum_down_count, 2)
  603.  
  604.  
  605.  
  606.  
  607. if Money_Flow > 0:
  608. MIV_Index = round(100 * (f_Vol / prevVol) - 100 * ((Money_Flow * HLCC) / (prevFlow * prevPrice)), 3)
  609. runningValueIndex += MIV_Index
  610. prevPrice = Close_Price
  611. prevFlow = Money_Flow
  612. prevVol = f_Vol
  613. prevIndexValue = MIV_Index
  614. MIV_Index_String = str(MIV_Index)
  615. runningValueIndex_String = str(runningValueIndex)
  616. MIV_Index_String = str(round(MIV_Index, 2))
  617. if ref_Num >= 2:
  618. MIV_Value = round(MIV_Index + runningValueIndex / 2, 3)
  619.  
  620.  
  621. if ref_Num >= 10:
  622. highlist.pop(0)
  623. lowlist.pop(0)
  624.  
  625. avgHigh = statistics.mean(highlist)
  626. avgLow = statistics.mean(lowlist)
  627.  
  628.  
  629.  
  630. if ref_Num > 3 and High_Price > HOD:
  631. HOD = High_Price
  632. else:
  633. HOD = HOD
  634.  
  635. if ref_Num > 3 and Low_Price < LOD:
  636. LOD = Low_Price
  637. else:
  638. LOD = LOD
  639.  
  640.  
  641. if ref_Num >= 2:
  642. prevPrice1 = Close_Price
  643. prevMPrice = M_Price
  644.  
  645.  
  646. if ref_Num % 2 != 0:
  647. Price1 = Close_Price
  648. prevMPrice1 = M_Price
  649. prevVol1 = f_Vol
  650. prevFlow1 = Money_Flow
  651. HPrice1 = High_Price
  652. LPrice1 = Low_Price
  653.  
  654. if ref_Num % 2 == 0:
  655. Price2 = Close_Price
  656. prevMPrice2 = M_Price
  657. prevVol2 = f_Vol
  658. prevFlow2 = Money_Flow
  659. HPrice2 = High_Price
  660. LPrice2 = Low_Price
  661.  
  662.  
  663. if ref_Num % 2 != 0 and ref_Num > 2:
  664. Last = Price2
  665. lastMPrice = prevMPrice2
  666. lastVol = prevVol2
  667. lastFlow = prevFlow2
  668. lastHPrice = HPrice2
  669. lastLPrice = LPrice2
  670.  
  671.  
  672. if ref_Num % 2 == 0 and ref_Num >= 2:
  673. Last = Price1
  674. lastMPrice = prevMPrice1
  675. lastVol = prevVol1
  676. lastFlow = prevFlow1
  677. lastHPrice = HPrice1
  678. lastLPrice = LPrice1
  679.  
  680.  
  681.  
  682.  
  683. sumFlow += Money_Flow
  684. SumLiq += abs(Liq_change)
  685. sumVol += f_Vol
  686. sum_MRatio += mRatio
  687. sumVSR += VSR
  688. avgVSR = round(sumVSR / ref_Num, 2)
  689. sneakR_log.append(sneakR)
  690. if Money_Flow > 0 and OC_Range + HL_Range > 0:
  691. sneakR = round(.0000001*(Money_Flow / (OC_Range + HL_Range)), 2)
  692. new_sneakR = round(.0000001*(Money_Flow / (HL_Range)), 2)
  693. sneakR_Sum += round(sneakR, 2)
  694. avg_sneakR = round(sneakR_Sum / ref_Num, 2)
  695. day_left = 390 - ref_Num
  696. VSR = round(sumVol / sneakR_Sum, 2)
  697.  
  698. VIX = round((avgVSR / VSR) * (avgVSR / 1000), 2)
  699.  
  700. VIX_List.append(VIX)
  701. if ref_Num >= 30:
  702. VIX_List.pop(0)
  703. avgVIX = np.mean(VIX_List)
  704. VIX = round((VIX + avgVIX), 2)
  705.  
  706.  
  707. projected_ss_eod = round(day_left * avg_sneakR + sneakR_Sum + 200, 2)
  708.  
  709.  
  710.  
  711. if ref_Num >= 2:
  712. avgVol = round(sumVol / ref_Num, 2)
  713. avg_Flow = round(sumFlow / ref_Num, 2)
  714. avg_Liq_change = round(SumLiq / ref_Num, 2)
  715. xratio = round(100 * abs(Liq_change) / abs(Liquidity), 3)
  716. lastLFPC = LFPC
  717. lastmRatio = mRatio
  718. lastsneakR = sneakR
  719. avg_sneakR = round(sneakR_Sum / ref_Num, 2)
  720. avg_mRatio = round(sum_MRatio / ref_Num, 2)
  721. avgQR = round(sum_QR / ref_Num, 2)
  722. if abs(Money_Flow) > 0 and abs(Liq_change) > 0:
  723. mRatio = round(Money_Flow / avg_Flow, 3)
  724. QR = round(sneakR / mRatio, 2)
  725. sum_QR += QR
  726.  
  727. if ref_Num >= 2 and mRatio > 0:
  728. qratio_div_max = round(qratio / 468, 2)
  729.  
  730. if mRatio > 0:
  731. qratio = round(sneakR / mRatio, 2)
  732.  
  733. QRS_Index = round(sum_QR - sneakR_Sum, 2)
  734.  
  735.  
  736. analysis_list = [Date, military_time, Close_Price, M_Price, liqchgstr, liqstr, mf_Str, mRatio, sneakR]
  737.  
  738. if mRatio >= 1:
  739. LargeFlowCount += 1
  740. LargeFlowSum += mRatio
  741. analysis_log.append(analysis_list)
  742. if mRatio >= 2:
  743. VeryLargeFlowCount += 1
  744. if mRatio >= 5:
  745. ExtremelyLargeFlowCount += 1
  746. money_analysis_log.append(Money_Flow)
  747.  
  748. if sneakR >= 100:
  749. if analysis_list not in analysis_log:
  750. analysis_log.append(analysis_list)
  751. sneakR_analysis_log.append(sneakR)
  752. LargesneakRCount += 1
  753. if sneakR >= 200:
  754. VeryLargesneakRCount += 1
  755. if sneakR >= 300:
  756. ExtremelyLargesneakRCount += 1
  757.  
  758.  
  759. if UP_c >= 1 and DOWN_c >= 1:
  760. UDR = round((UP_c / DOWN_c) -.1, 3)
  761. UDV = UP_c - DOWN_c
  762.  
  763. if UpTicks >= 1 and DownTicks >= 1:
  764. UDR_Ticks = round(UpTicks - DownTicks, 3)
  765.  
  766. MACD = UDR_Ticks - UDV
  767.  
  768. if UDV > UDR_Ticks:
  769. price_tick_str = fg(191)+bg(52)+'Last Price: [$%s' % Close_Price+']'
  770.  
  771. if UDV <= UDR_Ticks:
  772. price_tick_str = fg(123)+bg(0)+'Last Price: [$%s' % Close_Price+']'
  773.  
  774.  
  775.  
  776.  
  777.  
  778. if abs(Liq_change) > 0:
  779. LFP = round(Money_Flow / abs(Liq_change) *.01, 3)
  780. LFPC = round(1000 * (abs(Liq_change) / Money_Flow) * .01, 4)
  781. sum_LFPC += LFPC
  782. if LFPC >= .001:
  783. LFPC_Count += 1
  784. if Liq_change > 0:
  785. sum_large_LFPC += LFPC
  786.  
  787. sumLFP += LFP
  788.  
  789.  
  790. if Liq_change < 0:
  791. sum_large_LFPC += (LFPC * -1)
  792.  
  793. if LFPC_Count >= 1:
  794.  
  795. avg_large_LFPC = round(100*(sum_large_LFPC / LFPC_Count), 2)
  796.  
  797. avg_LFPC = round(100*(sum_LFPC / ref_Num), 2)
  798. avgLFP = round(sumLFP / ref_Num, 3)
  799. if Close_Price < Last:
  800. down_val += abs(Close_Price - Last)
  801. down_val_count += 1
  802.  
  803. if Close_Price > Last:
  804. up_val += Close_Price - Last
  805. up_val_count += 1
  806. if up_val_count >= 1 and down_val_count >= 1:
  807. trend = round(up_val_count / down_val_count, 2)
  808.  
  809.  
  810. timecounter = .02
  811. if ref_Num >= 15:
  812. timecounter = .02-((ref_Num / 15) * .000669)
  813. pause = timecounter/.05
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821. if Close_Price >= Open_Price:
  822. PriceTickGauge += round(Close_Price - Open_Price, 3)
  823. MoneyTickGauge += round(M_Price - lastMPrice, 3)
  824.  
  825. if Close_Price <= Open_Price:
  826. PriceTickGauge += round(Close_Price - Open_Price, 3)
  827. MoneyTickGauge += round(M_Price - lastMPrice, 3)
  828.  
  829. if ref_Num >= 1:
  830. TickGauge = round(PriceTickGauge / MoneyTickGauge, 4)
  831.  
  832. if M_Price > High_Price or M_Price < Low_Price:
  833. if M_Price > High_Price:
  834. xString = 'TA'
  835. else:
  836. xString = 'TB'
  837.  
  838. else:
  839. xString = ''
  840.  
  841.  
  842.  
  843. ###############################################################################################
  844.  
  845. if abs(Liq_change) > 0 and Money_Flow > 0:
  846. if LFPC >= .0012:
  847. rawdatalist = [Date, military_time, Close_Price, liqchgstr, liqstr, mf_Str, M_Price, LFP, LFPC, est_price_x, mRatio, sneakR, qratio]
  848.  
  849. LFP = round(Money_Flow / abs(Liq_change) *.01, 3)
  850. est_diff_x = round(LFPC * Close_Price, 2)
  851. if qratio >= 80:
  852. est_diff_x = abs(est_diff_x) * -1
  853. if Liquidity < 0:
  854. if Liq_change < 0:
  855. est_price_x = round(est_diff_x + Close_Price, 2)
  856. TA = True
  857. TB = False
  858. if Liq_change > 0:
  859. est_price_x = round(Close_Price + (-1 * est_diff_x), 2)
  860. TA = False
  861. TB = True
  862.  
  863.  
  864. if Liquidity > 0:
  865. if Liq_change < 0:
  866. est_price_x = round(Close_Price + (-1 * est_diff_x), 2)
  867. TA = False
  868. TB = True
  869. if Liq_change > 0:
  870. est_price_x = round(est_diff_x + Close_Price, 2)
  871. TA = True
  872. TB = False
  873.  
  874. if TA == True:
  875. if Close_Price >= est_price_x:
  876. Status = 'FILLED'
  877. if Close_Price < est_price_x:
  878. if HOD >= est_price_x:
  879. Status = 'DUD'
  880. if HOD < est_price_x:
  881. Status = '[ NYF ]'
  882. unfilled_TA_price = est_price_x
  883.  
  884. if TB == True:
  885. if Close_Price <= est_price_x:
  886. Status = 'FILLED'
  887. if Close_Price > est_price_x:
  888. if LOD <= est_price_x:
  889. Status = 'DUD'
  890. if LOD > est_price_x:
  891. Status = '| NYF |'
  892. unfilled_TB_price = est_price_x
  893.  
  894.  
  895. # if LFPC >= .002:
  896. # if Liq_change < 0:
  897. # est_price_x = round(est_diff_x + Close_Price, 2)
  898. # if Liq_change > 0:
  899. # est_price_x = round(Close_Price + (-1 * est_diff_x), 2)
  900. #
  901. # if LFPC >= .01:
  902. # if Liq_change < 0:
  903. # est_price_x = round(Close_Price + (-1 * est_diff_x), 2)
  904. # if Liq_change > 0:
  905. # est_price_x = round(est_diff_x + Close_Price, 2)
  906. #
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926. ######### Changing status in opt 4 to show filled/unfilled est TA/TB prices
  927. #########################################################################
  928.  
  929. with open('/Users/King/liveplot_analysis.csv', 'a') as plotfile:
  930. variables = [ref_Num, Date, military_time, Close_Price, sneakR, qratio, LFPC, PivotSpread, MIV_Index, Liquidity, PainGauge, LFP, Liq_change]
  931. filereader = csv.reader(plotfile)
  932. wr = csv.writer(plotfile)
  933. wr.writerow(variables)
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.  
  941. percent_Strength = Strength / ref_Num
  942. allData = [ref_Num,Date, military_time, High_Price,Low_Price,Close_Price, HLCC, M_Price, f_Vol, Money_Flow,MMM, Liquidity,Liq_change]
  943. Data_Dict = {'REF#':[ref_Num],'Date':[Date],'Time':[military_time], 'Close_Price':[Close_Price], 'M_Price':[M_Price], 'Volume':[f_Vol]}
  944. '''USING THIS DATA
  945. [0]REFERENCE NUMBER
  946. [1]DATE
  947. [2]MILITARY_TIME
  948. [3]HIGH_PRICE
  949. [4]LOW_PRICE
  950. [5]CLOSE_PRICE
  951. [6]HLCC
  952. [7]M_Price
  953. [8]F_VOL
  954. [9]MONEY_FLOW
  955. [10]MARKETMAKERMOVE 'MMM'
  956. [11]LIQUIDITY
  957. [12]LIQ_CHANGE
  958. '''
  959.  
  960.  
  961.  
  962.  
  963.  
  964. if abs(allData[7]-allData[6]) >= criteria:
  965. diff = abs(M_Price - Close_Price)
  966. Range_Clause = True
  967. range_identifier_all = 'All'
  968. else:
  969. Range_Clause = False
  970. rFound = False
  971. rPVS += round(M_Price - Close_Price, 2)
  972.  
  973. if Range_Clause == True:
  974. rFound = True
  975. MLOD = False
  976. MHOD = False
  977. r_price = M_Price
  978. found_Price = HLCC
  979. Low_Range = round(HLCC - abs(float(M_Price - HLCC)), 2)
  980. High_Range = round(HLCC + abs(float(M_Price - HLCC)), 2)
  981. Low_Target = round(Low_Range - abs(float(M_Price - HLCC)), 2)
  982. High_Target = round(High_Range + abs(float(M_Price - HLCC)), 2)
  983. RT_Reference1 = [Low_Range, High_Range, Low_Target, High_Target]
  984. LRS = '$' + str(Low_Range)
  985. LRT = '$' + str(Low_Target)
  986. HRS = '$' + str(High_Range)
  987. HRT = '$' + str(High_Target)
  988. found_Price_String = '$' + str(found_Price)
  989. RT_Reference = [LRS, LRT, HRS, HRT]
  990. lows = [LRS, LRT]
  991. highs = [HRS, HRT]
  992. range_ref_String = range_ref_String
  993. target_String = range_ref_String + ': $'
  994. end_String = 'Price while found: $' + str(Close_Price)
  995. Target_String = '$' + str(Target)
  996.  
  997.  
  998.  
  999. if abs(Liq_change) > 0:
  1000. LiqFlowPrice = .01*round(Money_Flow / abs(Liq_change), 3)
  1001. VolLiqPrice = round(f_Vol / abs(Liq_change), 2)
  1002. LiqFlowPriceClone = round(1000 * (abs(Liq_change) / Money_Flow), 4) * .01
  1003.  
  1004.  
  1005. if M_Price >= High_Range:
  1006. found += 1
  1007. range_ref_String = "HIGH TARGET"
  1008. tHigh = True
  1009. RangeTarget = High_Target
  1010. Target = M_Price
  1011. range_identifier = 'High'
  1012. found_Price = HLCC
  1013. range_identifier_all = 'All'
  1014. thList = ['HIGH TARGET', High_Target, highfilled]
  1015. filled = False
  1016. tLow = False
  1017. ht_filled = False
  1018. hr_filled = False
  1019. highs_found += 1
  1020. HighRangeFlow += Money_Flow
  1021. elif M_Price<= Low_Range:
  1022. found += 1
  1023. range_ref_String = "LOW TARGET"
  1024. tLow = True
  1025. tHigh = False
  1026. RangeTarget = Low_Target
  1027. Target = M_Price
  1028. range_identifier = 'Low'
  1029. range_identifier_all = 'All'
  1030. found_Price = HLCC
  1031. tlList = ['LOW TARGET', Low_Target, lowfilled]
  1032. filled = False
  1033. lt_filled = False
  1034. lr_filled = False
  1035. lows_found += 1
  1036. LowRangeFlow += Money_Flow
  1037.  
  1038. if lows_found > 0:
  1039. AvgLowRangeFlow = LowRangeFlow / lows_found
  1040. if highs_found > 0:
  1041. AvgHighRangeFlow = HighRangeFlow / highs_found
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048. if M_Price == lastMPrice:
  1049. DRC += 1
  1050. Distribution_Price = M_Price
  1051. Cumulutive_DPrice += Distribution_Price
  1052. if M_Price == lastMPrice and qratio >= 30 and LFPC >= .001:
  1053. Resistance = M_Price
  1054. else:
  1055. Resistance = 0
  1056.  
  1057. if M_Price == lastMPrice and mRatio >= 1 and sneakR >= 20:
  1058. Support = M_Price
  1059. else:
  1060. Support = 0
  1061.  
  1062. if M_Price == lastMPrice and sneakR <= 10:
  1063. SketchDist = M_Price
  1064. else:
  1065. SketchDist = 0
  1066.  
  1067. if DRC == 0 and ref_Num >= 2:
  1068. lastDPrice = statistics.mean(mpricelist)
  1069. Weighted_Avg_DPrice = statistics.mean(mpricelist)
  1070.  
  1071. if ref_Num >= 3:
  1072. mpricelist.pop(0)
  1073.  
  1074.  
  1075. if DRC >= 1:
  1076. lastDPrice = Distribution_Price
  1077. if HLCC > Distribution_Price:
  1078. DP_Uptick += 1
  1079. DU += 1
  1080. DP_UptickList.append(DP_Uptick)
  1081.  
  1082. if HLCC < Distribution_Price:
  1083. DD += 1
  1084. DP_Downtick += 1
  1085. DP_DowntickList.append(DP_Uptick)
  1086.  
  1087. Avg_DPrice = round(Cumulutive_DPrice / DRC, 2)
  1088. if DRC < 2:
  1089. Weighted_Avg_DPrice = round(((lastDPrice + Avg_DPrice + avgMPrice) / 3), 2)
  1090.  
  1091. if DRC >= 2:
  1092. Weighted_Avg_DPrice = round(((lastDPrice + Avg_DPrice + avgMPrice) / 3), 2)
  1093.  
  1094.  
  1095.  
  1096.  
  1097. if ref_Num >= 2:
  1098. if Close_Price < Open_Price:
  1099. DOWN_c += .25
  1100. if OC_Range > avg_OC_Range:
  1101. pg_down_var += .25
  1102. if OC_Range >= avg_HL_Range:
  1103. pg_down_var += .5
  1104. if M_Price < lastMPrice and lastMPrice >= Last:
  1105. DOWN_c += .25
  1106. if Close_Price < Last:
  1107. DOWN_c += .25
  1108. if Close_Price < lastLPrice:
  1109. DOWN_c += .25
  1110. if Low_Price <= LOD:
  1111. pg_down_var += .25
  1112.  
  1113.  
  1114. if Close_Price < round((avgMPrice + Weighted_Avg_DPrice) / 2, 2):
  1115. pg_down_var += .25
  1116. if High_Price <= Weighted_Avg_DPrice:
  1117. pg_down_var += .25
  1118. if abs(Close_Price - Open_Price) < abs(M_Price - lastMPrice):
  1119. pg_down_var += .25
  1120.  
  1121.  
  1122. if Close_Price > Open_Price:
  1123. UP_c += .25
  1124. if OC_Range > avg_OC_Range:
  1125. pg_up_var += .25
  1126. if OC_Range >= avg_HL_Range:
  1127. pg_up_var += .5
  1128. if M_Price > lastMPrice and lastMPrice <= Last:
  1129. UP_c += .25
  1130. if Close_Price > Last:
  1131. UP_c += .25
  1132. if Close_Price > lastHPrice:
  1133. UP_c += .25
  1134.  
  1135.  
  1136. if Close_Price > round((avgMPrice + Weighted_Avg_DPrice) / 2, 2):
  1137. pg_up_var += .25
  1138. if High_Price >= HOD:
  1139. pg_up_var += .25
  1140. if Low_Price >= Weighted_Avg_DPrice:
  1141. pg_up_var += .25
  1142. if abs(Close_Price - Open_Price) > abs(M_Price - lastMPrice):
  1143. pg_up_var += .25
  1144.  
  1145.  
  1146.  
  1147.  
  1148. if HLCC < lastLPrice:
  1149. if High_Price <= lastHPrice:
  1150. DownTicks += 1
  1151. DownTicks += 1
  1152. DOWN_IV += round(round(Close_Price - Last, 2) - avg_HL_Range, 2)
  1153.  
  1154. if HLCC > lastHPrice:
  1155. if Low_Price >= lastLPrice:
  1156. UpTicks += 1
  1157. UpTicks += 1
  1158. UP_IV += round(round(Close_Price - Last, 2) + avg_HL_Range, 2)
  1159.  
  1160. if Low_Price <= lastLPrice and Close_Price >= Last:
  1161. hs_up += 1
  1162. if High_Price >= lastHPrice and Close_Price <= Last:
  1163. hs_down += 1
  1164. if hs_up > 0 and hs_down > 0:
  1165. hidden_strength = round(hs_up / hs_down, 2)
  1166.  
  1167. if DOWN_c > 0 and UP_c > 0:
  1168. PainGauge = round((DOWN_c + pg_down_var) / (UP_c + pg_up_var), 3)
  1169. if DOWN_c >= 1 and UP_c >= 1:
  1170. Avg_Up_Move = round(UP_IV / UP_c, 2)
  1171. Avg_Down_Move = round(DOWN_IV / DOWN_c, 2)
  1172. Avg_Move = round(100*(DOWN_IV + UP_IV) / Close_Price, 2)
  1173. # Avg_Move = round(Avg_Move1 * 100, 2)
  1174.  
  1175. PainGaugePct = round(100-100*abs(PainGauge - .637) / 1.529, 2)
  1176. # BB_Strength = round(DOWN_c / DOWN_IV, 2) + round(UP_c / UP_IV, 2)
  1177.  
  1178. else:
  1179. PainGauge = 1
  1180.  
  1181. PG = PainGauge
  1182.  
  1183.  
  1184. if DU >= 1 and DD >= 1:
  1185. DR = round(DU / DD, 2)
  1186.  
  1187.  
  1188. if M_Price > lastMPrice:
  1189. mticksymbol = Fore.GREEN+'∆'
  1190. MUTick += 1
  1191. MT += 1
  1192. if HLCC > Last:
  1193. MUTick += 1
  1194. MT += 1
  1195. if HLCC > M_Price:
  1196. MTR_copy += round(High_Price - Low_Price, 2)
  1197. if M_Price < lastMPrice:
  1198. mticksymbol = Fore.RED+'◊'
  1199. MDTick += 1
  1200. MT += 1
  1201. if HLCC < Last:
  1202. MDTick += 1
  1203. MT += 1
  1204. if HLCC < M_Price:
  1205. MTR_copy += round(Low_Price - High_Price, 2)
  1206. if M_Price == lastMPrice:
  1207. if DRC >= 2:
  1208. if M_Price > lastDPrice:
  1209. MUTick += 1
  1210. MT += 1
  1211. if M_Price < lastDPrice:
  1212. MDTick += 1
  1213. MT += 1
  1214.  
  1215. else:
  1216. pass
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223. if MUTick >= 1 and MDTick >= 1:
  1224. MTR = round(MUTick / MT, 3)
  1225.  
  1226. if MTR >= .5:
  1227. MTR_s += 1
  1228. if MTR <= .5:
  1229. MTR_s += -1
  1230.  
  1231.  
  1232.  
  1233. if abs(MTR_s) >= 1:
  1234. MTR_Strength = 100*round(MTR_s / ref_Num, 3)
  1235.  
  1236.  
  1237.  
  1238. if ref_Num >= 2:
  1239.  
  1240. if Open_Price > Last:
  1241. gapUp += 1
  1242. gapUpDistance += round(Open_Price - Last, 2)
  1243.  
  1244. elif Open_Price < Last:
  1245. gapDown += 1
  1246. gapDownDistance += round(abs(Open_Price - Last), 2)
  1247.  
  1248. if gapUp >= 1 and gapDown >= 1:
  1249. gapRatio = round(gapUp / gapDown, 3)
  1250. gapDistanceRatio = round(gapUpDistance / gapDownDistance, 2)
  1251. if ref_Num < 390:
  1252. volatility_index = round((gapUpDistance + gapDownDistance + gapUp + gapDown) / abs(390-ref_Num), 2)
  1253. else:
  1254. volatility_index = round((gapUpDistance + gapDownDistance + gapUp + gapDown) / 390, 2)
  1255.  
  1256. if M_Price > High_Price:
  1257. TradingAbove_Count += 1
  1258. TradingAbove_Diff += round(abs(M_Price - High_Price), 2)
  1259.  
  1260. if M_Price < Low_Price:
  1261. TradingBelow_Count += 1
  1262. TradingBelow_Diff += round(abs(M_Price - Low_Price), 2)
  1263.  
  1264. if TradingAbove_Count >= 1 or TradingBelow_Count >= 1:
  1265. TATBR_Sum = round(100*(TradingAbove_Diff - TradingBelow_Diff) / Close_Price, 2)
  1266.  
  1267.  
  1268. if abs(MIV_Index) >= .25 and ref_Num > 1:
  1269. MIV_Spike += abs(MIV_Index)
  1270. MIV_Spike_Count += 1
  1271. MIV_Spike_List.append(abs(MIV_Index))
  1272. Avg_MIV_Spike = round(MIV_Spike / MIV_Spike_Count, 3)
  1273. if abs(MIV_Index) >= .25 and ref_Num > 1:
  1274. Avg_MIV_Spike_String = str(Avg_MIV_Spike)
  1275.  
  1276.  
  1277. newratio = round(10*(LFP * LFPC), 3)
  1278.  
  1279.  
  1280. if Close_Price >= Open_Price and Liq_change > 0:
  1281. UpTicks += 1
  1282. Price_Tick = 1
  1283. Liq_Tick = 1
  1284. BuyVolume += f_Vol
  1285. BuyPower += Liq_change
  1286. ShortPower += Liq_change * -1
  1287.  
  1288.  
  1289.  
  1290.  
  1291. PULQ = False
  1292. elif Close_Price >= Open_Price and Liq_change < 0:
  1293. Price_Tick = 0
  1294. Liq_Tick = -1
  1295. ShortVolume += f_Vol
  1296. BuyVolume += Liq_change * -1
  1297. ShortPower += Liq_change * -1
  1298. ShortVolumeTotal += f_Vol
  1299. ShortMoney += Money_Flow
  1300. ShortCount += 1
  1301. ShortLiquidity += abs(Liq_change)
  1302. S_Price += HLCC
  1303.  
  1304. PULQ = True
  1305. elif Close_Price <= Open_Price and Liq_change > 0:
  1306. Price_Tick = -1
  1307. Liq_Tick = 0
  1308. ShortPower += Liq_change
  1309. # BuyPower += Liq_change
  1310. SellPower += Liq_change
  1311. CoverVolumeTotal += f_Vol
  1312. CoverMoney += Money_Flow
  1313. CoverCount += 1
  1314. CoverLiquidity += Liq_change
  1315. C_Price += HLCC
  1316.  
  1317.  
  1318. PULQ = False
  1319. elif Close_Price <= Open_Price and Liq_change < 0:
  1320. Price_Tick = -1
  1321. Liq_Tick = -1
  1322. SellVolume += f_Vol
  1323. SellPower += abs(Liq_change)
  1324. DownTicks += 1
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330. PULQ = False
  1331. Price_Tick_Total += Price_Tick
  1332. Liq_Tick_Total += Liq_Tick
  1333. if abs(Price_Tick_Total) >= 1 and abs(Liq_Tick_Total) >= 1:
  1334. PTLT_Ratio = round(abs(Price_Tick_Total) / abs(Liq_Tick_Total), 2)
  1335.  
  1336. if UpTicks >= 1 and DownTicks >= 1:
  1337. UDR = round((UpTicks / DownTicks) - .1, 3)
  1338.  
  1339. if UDR >= 1:
  1340. UDR_s += 1
  1341. if UDR <= 1:
  1342. UDR_s += -1
  1343.  
  1344. if abs(UDR_s) >= 1:
  1345. UDR_Strength = 100 * round(UDR_s / ref_Num, 3)
  1346.  
  1347.  
  1348. Tick = Liq_Tick + Price_Tick
  1349. Strength += Tick
  1350. percent_Strength = round(Strength / ref_Num, 4)
  1351. step1 = -210 * ref_Num
  1352. step2 = step1 / 390
  1353. step3 = Strength / 390
  1354. step4 = round(100*(step3 / step2), 4)
  1355. new_Strength = round(100 - (step4 * 100), 2)
  1356. # new_Strength = round(100-(100*abs(percent_Strength- -.3153) / .8794), 2)
  1357. # new_Strength = round(100-(100*abs(percent_Strength - -.305128) / .93333), 2)
  1358. Intraday_Strength = round(100-(100*abs(percent_Strength- -.3333) / .8974), 2)
  1359. adj_Strength = round(100-(100*abs(percent_Strength - -.3053) / .9512), 2)
  1360.  
  1361. LQP_Match = bool
  1362.  
  1363.  
  1364. if qratio < 30 and sneakR < 10 and LFPC >= .001:
  1365. if Liq_change < 0:
  1366. EstimatedPrice = round(Close_Price + (Close_Price * LFPC), 2)
  1367.  
  1368. if Liq_change > 0:
  1369. EstimatedPrice = round(Close_Price - (Close_Price * LFPC), 2)
  1370.  
  1371.  
  1372.  
  1373. if qratio >= 35 and sneakR >= 15 and LFPC >= .001:
  1374. if Liq_change > 0:
  1375. EstimatedPrice = round(Close_Price - (Close_Price * LFPC), 2)
  1376.  
  1377. if Liq_change < 0:
  1378. EstimatedPrice = round(Close_Price + (Close_Price * LFPC), 2)
  1379.  
  1380. if qratio < 20 and sneakR > qratio and LFPC >= .001:
  1381. if Liq_change < 0:
  1382. EstimatedPrice = round(Close_Price - (Close_Price * LFPC), 2)
  1383. if Liq_change > 0:
  1384. EstimatedPrice = round(Close_Price + (Close_Price * LFPC), 2)
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392. if Liquidity < 0 and Liq_change < 0:
  1393. LQP_Match = True
  1394.  
  1395. if Liquidity > 0 and Liq_change > 0:
  1396. LQP_Match = True
  1397.  
  1398.  
  1399. if Liquidity > 0 and Liq_change < 0:
  1400. LQP_Match = False
  1401.  
  1402. if Liquidity < 0 and Liq_change > 0:
  1403. LQP_Match = False
  1404.  
  1405.  
  1406. with open('/Users/King/Spy_var_analysis.csv', 'a') as csv_file3:
  1407. reader3 = csv.reader(csv_file3)
  1408. wr3 = csv.writer(csv_file3)
  1409.  
  1410. vardatalist = [Date, military_time, ref_Num, Close_Price, chg_Open, PG, MTR, DR, gapRatio, gapDistanceRatio, PivotSpread, avgVol, Intraday_Strength, new_Strength, sneakR_Sum, avgQR, avg_Liq_change, UDR, VSR, QRS_Index, avgVSR, DRC, CashOpen, Liquidity, MTR_Strength, UDR_Strength, avgLFP, chg_45, chg_60, chg_120]
  1411. wr3.writerow(vardatalist)
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423. if menu_ans == '1' or menu_ans == 'oldfile':
  1424. if Liquidity_Data == 'y':
  1425. PrintInfo = True
  1426. est_diff = round(.01*(100 - LFP), 2)
  1427. est_diff1 = round(LFPC * Close_Price, 2)
  1428. if Liquidity < 0:
  1429. if Liq_change < 0:
  1430. est_price = round(est_diff + Close_Price, 2)
  1431. est_price1 = round(est_diff1 + Close_Price, 2)
  1432. if Liq_change > 0:
  1433. est_price = round(Close_Price - est_diff, 2)
  1434. est_price1 = round(Close_Price + (-1 * est_diff1), 2)
  1435. if Liquidity > 0:
  1436. if Liq_change < 0:
  1437. est_price = round(Close_Price - est_diff, 2)
  1438. est_price1 = round(Close_Price + (-1 * est_diff1), 2)
  1439. if Liq_change > 0:
  1440. est_price = round(est_diff + Close_Price, 2)
  1441. est_price1 = round(est_diff1 + Close_Price, 2)
  1442.  
  1443.  
  1444. sum_Flow += Money_Flow
  1445.  
  1446.  
  1447. avg_HL_Range = sum_HL_Range / ref_Num
  1448. avg_OC_Range = sum_OC_Range / ref_Num
  1449. avg_Liq_change = sum_Liq / ref_Num
  1450.  
  1451.  
  1452. if DRC < 2:
  1453. if Close_Price > Open_Price:
  1454. ticksymbolo = Fore.GREEN+Style.BRIGHT+'ˆ'+Style.RESET_ALL
  1455. if Close_Price < Open_Price:
  1456. ticksymbolo = Fore.RED+Style.BRIGHT+'ˇ'+Style.RESET_ALL
  1457.  
  1458. if DRC >= 2:
  1459. if HLCC >= Weighted_Avg_DPrice:
  1460. ticksymbolo = fg(14)+'ˆ'+rs.all
  1461. if HLCC <= Weighted_Avg_DPrice:
  1462. ticksymbolo = fg(227)+'ˇ'+rs.all
  1463.  
  1464.  
  1465. if (M_Price + lastMPrice) / 2 < (Last + Close_Price) / 2 - (.1 * avg_OC_Range):
  1466. if lastMPrice >= lastLPrice and lastMPrice <= lastHPrice:
  1467. ticksymbolc = Fore.GREEN+Style.BRIGHT+'ˆ '+Style.RESET_ALL
  1468. elif lastMPrice >= lastHPrice and lastMPrice <= lastHPrice + avg_OC_Range:
  1469. ticksymbolc = Fore.YELLOW+Style.BRIGHT+'∞ '+Style.RESET_ALL
  1470.  
  1471.  
  1472.  
  1473.  
  1474. if (M_Price + lastMPrice) / 2 > (Last + Close_Price) / 2 + (.1 * avg_OC_Range):
  1475. if lastMPrice >= lastLPrice and lastMPrice <= lastHPrice:
  1476. ticksymbolc = Fore.RED+Style.BRIGHT+'ˇ '+Style.RESET_ALL
  1477.  
  1478. elif lastMPrice <= lastLPrice and lastMPrice >= lastLPrice - avg_OC_Range:
  1479. ticksymbolc = Fore.YELLOW+Style.BRIGHT+'• '+Style.RESET_ALL
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485. if abs(MIV_Index) >= .25 and ref_Num > 1:
  1486. MIV_Spike += abs(MIV_Index)
  1487. MIV_Spike_Count += 1
  1488. MIV_Spike_List.append(abs(MIV_Index))
  1489. Avg_MIV_Spike = round(MIV_Spike / MIV_Spike_Count, 3)
  1490. if abs(MIV_Index) >= .25 and ref_Num > 1:
  1491. Avg_MIV_Spike_String = str(Avg_MIV_Spike)
  1492. if MIV_Index > 0:
  1493. MIV_Index_String = str(round(MIV_Index, 2))
  1494. 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)
  1495.  
  1496. elif MIV_Index < 0:
  1497. MIV_Index_String = str(round(MIV_Index, 2))
  1498. 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)
  1499.  
  1500.  
  1501.  
  1502.  
  1503. if abs(Liq_change) > 0:
  1504. LFP = round(Money_Flow / abs(Liq_change) *.01, 3)
  1505. LFPC = round(1000 * (abs(Liq_change) / Money_Flow) * .01, 4)
  1506.  
  1507. if LFP < 13 and LFPC < .085:
  1508. LFP_WarningStr = 'FKN SELL THIS SHIT SON %s' % LFP
  1509. LFP_WarningStr_clr = colored(LFP_WarningStr, 'red', attrs=['bold','blink'])
  1510. # print(LFP_WarningStr_clr)
  1511.  
  1512. if LFP < 20 and LFP > 13:
  1513. LFP_WarningStr = 'FKN BUY THIS SHIT SON %s' % LFP
  1514. LFP_WarningStr_clr = colored(LFP_WarningStr, 'cyan', attrs=['bold','blink'])
  1515. # print(LFP_WarningStr_clr)
  1516.  
  1517.  
  1518. # if Money_Flow > 0 and lastFlow > 0:
  1519. # if f_Vol > 0 and lastVol > 0:
  1520. # M_index = round(100*(Money_Flow / lastFlow), 3)
  1521. # V_index = round(100*(f_Vol / lastVol), 3)
  1522. # new_MIV = round(M_index - V_index, 3)
  1523. # avgVol = sumVol / ref_Num
  1524.  
  1525. #
  1526. # if new_MIV >= .15 and OC_Range < avg_HL_Range:
  1527. # WarningString = Fore.CYAN+'BULLISH MV'
  1528. # print(WarningString)
  1529. #
  1530. # if new_MIV <= -.15 and OC_Range < avg_HL_Range:
  1531. # WarningString = Fore.RED+'BEARISH MV'
  1532. # print(WarningString)
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540. SS = str(new_Strength)
  1541. abs_Liq = abs(Liq_change)
  1542. counter += 1
  1543.  
  1544.  
  1545.  
  1546. if ShortCount >= 1:
  1547. ShortPrice = round(S_Price / ShortCount, 2)
  1548.  
  1549. if CoverCount >= 1:
  1550. CoverPrice = round(C_Price / CoverCount, 2)
  1551.  
  1552.  
  1553. if ref_Num < 10:
  1554. AvgStrengthReference += new_Strength
  1555. if ref_Num == 20:
  1556. AvgStrengthReference = StrengthReference / ref_Num
  1557. StrengthReference = AvgStrengthReference
  1558. counter = 1
  1559. if ref_Num >= 20:
  1560. counter += 1
  1561. AvgStrengthReference = AvgStrengthReference + new_Strength
  1562.  
  1563. if counter < 20 and counter >= 1:
  1564. AvgStrengthReference = AvgStrengthReference / counter
  1565. StrengthReference = (AvgStrengthReference + new_Strength) / counter
  1566.  
  1567. if counter == 20:
  1568. counter = counter * 0
  1569. AvgStrengthReference = AvgStrengthReference * 0 + StrengthReference
  1570. StrengthReference = StrengthReference
  1571.  
  1572.  
  1573.  
  1574.  
  1575. if M_Price == lastMPrice:
  1576. WarningString = '!!!'
  1577. if M_Price < Low_Price:
  1578. WarningString = Fore.RED+'!!!'
  1579. mticksymbol = Fore.RED+'x ≈ x'
  1580. nTS = True
  1581. Tick_String = fg(185)+bg(235)+'BULLSHIT STOPS HERE'+rs.all+WarningString+' '
  1582. if M_Price > High_Price:
  1583. WarningString = Fore.RED+'!!!'
  1584. mticksymbol = Fore.RED+'x ≈ x'
  1585. nTS = True
  1586. Tick_String = fg(185)+bg(235)+'BULLSHIT STOPS HERE'+rs.all+WarningString+' '
  1587.  
  1588.  
  1589. else:
  1590. mticksymbol = Fore.YELLOW+'≈'
  1591. else:
  1592. WarningString = ''
  1593. if OC_Range >= avg_HL_Range:
  1594. if abs(Liq_change) > avg_Liq_change:
  1595. if Close_Price > Open_Price:
  1596. WarningString = Fore.CYAN+'[xxx]'+Style.RESET_ALL
  1597. if Close_Price < Open_Price:
  1598. WarningString = Fore.RED+'[xxx]'+Style.RESET_ALL
  1599. else:
  1600. WarningString = Fore.YELLOW+'[xxx]'
  1601.  
  1602. else:
  1603. WarningString = ''
  1604.  
  1605.  
  1606. if PULQ == True and OC_Range <= avg_OC_Range *.3:
  1607. if abs(Liq_change) < 500 and Liq_change < 0:
  1608. if abs(Liq_change) < avg_Liq_change * .05:
  1609. WarningString = '[*]'
  1610. else:
  1611. WarningString = ''
  1612.  
  1613.  
  1614. if mRatio >= 1:
  1615. WarningString = Fore.WHITE+' $'
  1616. if mRatio > 2:
  1617. WarningString = Style.RESET_ALL+Style.BRIGHT+' $'
  1618. if mRatio >= 3:
  1619. WarningString = Style.RESET_ALL+ef.u+' $$$'+rs.all
  1620. if ref_Num >= 5:
  1621. OC_RangePct = round(OC_Range / avg_OC_Range * 100, 2)
  1622. HL_RangePct = round(HL_Range / avg_HL_Range * 100, 2)
  1623.  
  1624. if abs(OC_Range) > 0 and abs(HL_Range) > 0:
  1625. RangePct = round(OC_Range / (HL_Range / avg_HL_Range) * 1000, 4)
  1626. OCHL_RangePct = round(OC_Range / HL_Range * 100, 4)
  1627. OC_HL_RangePctStr = str(OC_HL_RangePct)+'%'
  1628. OCHL_RangePctStr = str(OC_HL_RangePct)+'%'
  1629. else:
  1630. OCHL_RangePctStr = ''
  1631. OC_HL_RangePctStr = ''
  1632.  
  1633.  
  1634. Tick_String = ''
  1635. # if LFP < 100 and LFPC >= .001:
  1636. # est_diff = round(.01*(100 - LFP), 2)
  1637. # if Liq_change > 0:
  1638. # est_price = round(est_diff + Close_Price, 2)
  1639. # if Liq_change < 0:
  1640. # est_price = round(Close_Price - est_diff, 2)
  1641.  
  1642. if LFPC > 0:
  1643. est_diff = round(LFPC * Close_Price, 2)
  1644. if Liq_change > 0 and Liquidity > 0:
  1645. est_price = round(est_diff + Close_Price, 2)
  1646. if Liq_change < 0 and Liquidity < 0:
  1647. est_price = round(est_diff + Close_Price, 2)
  1648. if Liquidity > 0 and Liq_change < 0:
  1649. est_price = round(Close_Price - est_diff, 2)
  1650.  
  1651. else:
  1652. est_price = M_Price
  1653.  
  1654.  
  1655. if M_Price < lastMPrice and Close_Price < Last:
  1656. if M_Price - lastMPrice < Close_Price - Last and abs(Close_Price - Last) >= avg_OC_Range:
  1657. Tick_String = fg(35)+bg(233)+'BULL STRENGTH'+rs.all+WarningString+' '
  1658. if M_Price < lastLPrice and M_Price < LOD:
  1659. Tick_String = fg(159)+bg(233)+'HELLA BULL STRENGTH'+rs.all+WarningString+' '
  1660.  
  1661.  
  1662.  
  1663. if M_Price - lastMPrice > abs(Close_Price - Last) and Liq_change > 0:
  1664. Tick_String = fg(0)+bg(226)+ef.u+ef.b+'REVERSAL'+rs.all+WarningString+' '
  1665.  
  1666.  
  1667. elif M_Price > lastMPrice and Close_Price > Last:
  1668. if M_Price - lastMPrice < (Close_Price - Last)*.5 and abs(Close_Price - Last) >= avg_OC_Range:
  1669. Tick_String = fg(188)+bg(21)+ef.b+'BULL ACCELLERATION'+rs.all+WarningString+' '
  1670.  
  1671.  
  1672. if M_Price > lastMPrice and Close_Price < Last:
  1673. Tick_String = fg(158)+bg(124)+'BEARISH REVERSAL'+rs.all+WarningString+' '
  1674.  
  1675. if Liq_change > 0:
  1676. if M_Price < Close_Price:
  1677. if LFPC >= .001:
  1678. Tick_String = fg(220)+bg(0)+'SKETCH AF ALGO UPTICK'+rs.all+WarningString+' '
  1679. else:
  1680. Tick_String = fg(50)+bg(100)+'ALGO UPTICK'+rs.all+WarningString+' '
  1681.  
  1682. if M_Price >= Close_Price and M_Price < High_Price + .01:
  1683. if Close_Price >= Open_Price:
  1684. Tick_String = Fore.BLUE+Back.GREEN+'UPTICK'+Style.RESET_ALL+WarningString+' '
  1685.  
  1686. if M_Price == High_Price or M_Price == lastHPrice:
  1687. Tick_String = colored('SHORTING HIGH', 'yellow', attrs=['blink'])+Style.RESET_ALL+WarningString+' '
  1688.  
  1689. if Liq_change < 0:
  1690.  
  1691. if Close_Price > Open_Price and M_Price < Close_Price:
  1692. if M_Price < lastMPrice:
  1693. if abs(M_Price - lastMPrice) >= .5 * avg_OC_Range:
  1694. Tick_String = colored('FAKEY IMPULSE', 'blue')+Style.RESET_ALL+WarningString+' '
  1695. else:
  1696.  
  1697. Tick_String = colored('EXTENDO SHORT', 'blue')+Style.RESET_ALL+WarningString+' '
  1698. else:
  1699.  
  1700. if OC_Range > avg_HL_Range:
  1701. Tick_String = fg(11)+bg(60)+'PRICE UP LIQ DOWN'+rs.all+' '
  1702.  
  1703. if Close_Price > lastHPrice:
  1704. if MTR >= .5:
  1705. Tick_String = fg(232)+bg(32)+'PRICE UP LIQ DOWN'+rs.all+WarningString+' '
  1706. else:
  1707. pass
  1708.  
  1709. else:
  1710. Tick_String = Fore.WHITE+'PRICE UP LIQ DOWN'+WarningString+' '
  1711. else:
  1712. pass
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720. if mRatio < .20 and sneakR < 9: ############## THIS IS GOOD
  1721. if M_Price > High_Price or M_Price >= lastHPrice: ##################### THIS IS GOOD
  1722. Tick_String = colored('DUMP COMING', 'yellow', 'on_red') ####################### THIS IS GOOD
  1723. bearTS = True
  1724.  
  1725. if mRatio < .16 and sneakR < 8:
  1726. Tick_String = colored('MAX VOLATILITY PUMP & DUMP', 'red', attrs=['bold', 'blink'])
  1727. bearTS = True
  1728.  
  1729. else:
  1730. pass
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736. else:
  1737. bearTS = False
  1738. pass
  1739.  
  1740.  
  1741. if M_Price > High_Price and M_Price > lastHPrice:
  1742. ta_price = round((Close_Price * LFPC) + Close_Price, 2)
  1743. if LFPC >= .0013 and LFPC < .002:
  1744.  
  1745.  
  1746. bullTS = False
  1747. Tick_String = colored('TRADING ABOVE', 'cyan', 'on_grey')+WarningString+' ($%s) ' % ta_price
  1748. if LFPC >= .002:
  1749. bullTS = False
  1750. Tick_String = colored('TRADING ABOVE', 'grey', 'on_cyan')+WarningString+' ($%s) ' % ta_price
  1751. else:
  1752. pass
  1753. if M_Price < Low_Price and M_Price < lastLPrice:
  1754. tb_price = round(Close_Price - (LFPC * Close_Price), 2)
  1755.  
  1756. # tb_price = round((Close_Price * (LFPC * -1) + Close_Price), 2)
  1757. if LFPC >= .0013 and LFPC < .002:
  1758. Tick_String = colored('TRADING BELOW', 'red', 'on_grey')+WarningString+' ($%s) ' % tb_price
  1759. if LFPC >= .002:
  1760. Tick_String = colored('TRADING BELOW', 'grey', 'on_red')+WarningString+' ($%s) ' % tb_price
  1761. else:
  1762. pass
  1763.  
  1764.  
  1765. if mRatio >= 2 and Range_Clause == False:
  1766. if mRatio >= 5:
  1767. if MIV_Index < 0 and abs(MIV_Index) > Avg_MIV_Spike:
  1768. if Liq_change > 0:
  1769. if Liquidity < 0:
  1770. Tick_String = Fore.WHITE+Style.BRIGHT+'MASSIVE FKN DUMPING'+Style.RESET_ALL+WarningString+' '
  1771. elif Liquidity > 0:
  1772. Tick_String = Fore.CYAN+Style.BRIGHT+'MASSIVE FKN BUYING'+Style.RESET_ALL+WarningString+' '
  1773. if Liq_change < 0:
  1774. Tick_String = Fore.WHITE+Style.BRIGHT+Back.RED+'MASSIVE FKN DUMPING'+Style.RESET_ALL+WarningString+' '
  1775. bearTS = True
  1776.  
  1777. else:
  1778. bearTS = False
  1779. pass
  1780.  
  1781.  
  1782. if MIV_Index > 0 and MIV_Index > Avg_MIV_Spike:
  1783. if Liq_change < 0:
  1784. Tick_String = Fore.WHITE+Style.BRIGHT+'MASSIVE FKN DUMPING'+Style.RESET_ALL+WarningString+' '
  1785. bearTS = True
  1786. else:
  1787. bearTS = False
  1788. pass
  1789.  
  1790.  
  1791. if abs(MIV_Index) < Avg_MIV_Spike and abs(MIV_Index) < .25:
  1792. Tick_String = Style.BRIGHT+'MASSIVE FLOW NO MIV'+Style.RESET_ALL+WarningString+' '
  1793.  
  1794. else:
  1795. Tick_String = Style.BRIGHT+Back.YELLOW+Fore.WHITE+'MASSIVE FLOW'+Style.RESET_ALL+WarningString+' '
  1796.  
  1797.  
  1798.  
  1799. pass
  1800.  
  1801.  
  1802. if abs(Liq_change) < .05 * avg_Liq_change:
  1803. if Open_Price > Last:
  1804. Tick_String = fg(150)+bg(52)+'ALGOS DOING SOME BEARSHIT'+rs.all
  1805.  
  1806. # Tick_String = Fore.RED+Style.BRIGHT+Back.WHITE+'ALGOS DOIN SUMBEARSHIT'+Style.RESET_ALL+WarningString+' '
  1807.  
  1808.  
  1809. if Close_Price < lastDPrice:
  1810. if M_Price > lastMPrice and Liq_change < 0:
  1811. Tick_String = fg(233)+bg(184)+'ALGOS DOIN SOME BULLSHIT'+rs.all
  1812.  
  1813. # Tick_String = Fore.CYAN+Style.BRIGHT+'ALGOS DOIN SUMBULLSHIT'+Style.RESET_ALL+WarningString+' '
  1814.  
  1815. else:
  1816. pass
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825. if Liq_change > 0:
  1826. if Liq_change > avg_Liq_change * 2 and M_Price >= Close_Price + (.75 * avg_HL_Range):
  1827. if sneakR < 10:
  1828. bullTS = True
  1829. if MIV_Index < -.25:
  1830. Tick_String = colored('BULL EXHAUSTION SETUP', 'cyan', 'on_red')
  1831. bearTS = True
  1832.  
  1833. else:
  1834. Tick_String = colored('BEAR EXHAUSTION SETUP', 'red', 'on_cyan')
  1835. else:
  1836. pass
  1837. else:
  1838. bullTS = False
  1839. pass
  1840.  
  1841. if Open_Price - Last >= .1 and ref_Num > 2:
  1842. Tick_String = Fore.BLUE+Style.BRIGHT+'BREAKOUT'+Style.RESET_ALL+WarningString+' '
  1843. bullTS = True
  1844.  
  1845.  
  1846.  
  1847. if mRatio >= 1 and sneakR > 100:
  1848. if M_Price > lastMPrice and Close_Price < Last:
  1849. Tick_String = colored('LARGE DUMPING', 'white', 'on_red')+WarningString+' '
  1850.  
  1851. if mRatio < .25 and sneakR < 5:
  1852. if mRatio < .2 and LFP < 100:
  1853. if Liq_change > 0:
  1854. Tick_String = Fore.BLUE+Style.BRIGHT+'BREAKOUT'+Style.RESET_ALL+WarningString+' '
  1855. bullTS = True
  1856.  
  1857. if Liq_change < 0:
  1858. Tick_String = Fore.YELLOW+Style.BRIGHT+'BREAKDOWN'+Style.RESET_ALL+WarningString+' '
  1859. bearTS = True
  1860. else:
  1861. Tick_String = Fore.RED+Back.YELLOW+Style.BRIGHT+'VOLATILITY COMING'+Style.RESET_ALL+WarningString+' '
  1862. nTS = True
  1863.  
  1864.  
  1865. else:
  1866. bearTS = False
  1867. bullTS = False
  1868. nTS = False
  1869. pass
  1870.  
  1871. else:
  1872. nTS = False
  1873. bearTS = False
  1874. bullTS = False
  1875. pass
  1876.  
  1877.  
  1878. if OC_Range > avg_OC_Range and f_Vol < avgVol * .3 and HL_Range > avg_HL_Range:
  1879. if Close_Price < Open_Price and Close_Price < M_Price:
  1880. Tick_String = Fore.RED+Style.BRIGHT+'SKETCHY SELLING'+Style.RESET_ALL+WarningString+' '
  1881.  
  1882. if Close_Price > Open_Price and Close_Price > M_Price:
  1883. Tick_String = Fore.GREEN+Style.BRIGHT+'SKETCHY BUYING'+Style.RESET_ALL+WarningString+' '
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890. # if Open_Price > Last and mRatio < .15:
  1891. # Tick_String = colored('PUMP N DUMP V2', 'yellow', attrs=['blink'])
  1892. # bearTS = True
  1893. #
  1894. # else:
  1895. # pass
  1896.  
  1897. if sneakR >= 20 and mRatio < 1:
  1898. if Liq_change < 0 and mRatio >= .6:
  1899. if LFP < 500:
  1900. if est_price < Close_Price:
  1901. price_str = str(est_price)
  1902. Tick_String = 'PROBABLY TRADING BELOW'+' ($%s)' % price_str
  1903. if est_price > Close_Price:
  1904. price_str = str(est_price)
  1905. Tick_String = 'PROBABLY TRADING ABOVE'+' ($%s)' % price_str
  1906.  
  1907.  
  1908. else:
  1909. pass
  1910. else:
  1911. pass
  1912.  
  1913.  
  1914.  
  1915. if mRatio < .18 and sneakR < 10:
  1916. if LFPC >= .001:
  1917. if Liquidity < 0:
  1918. if Liq_change < 0:
  1919. est_price = round(est_diff + Close_Price, 2)
  1920. est_price1 = round(est_diff1 + Close_Price, 2)
  1921.  
  1922. if Liq_change > 0:
  1923. est_price = round(Close_Price - est_diff, 2)
  1924. est_price1 = round(Close_Price + (-1 * est_diff1), 2)
  1925.  
  1926. if Liquidity > 0:
  1927. if Liq_change < 0:
  1928. est_price = round(Close_Price - est_diff, 2)
  1929. est_price1 = round(Close_Price + (-1 * est_diff1), 2)
  1930.  
  1931. if Liq_change > 0:
  1932. est_price = round(est_diff + Close_Price, 2)
  1933. est_price1 = round(est_diff1 + Close_Price, 2)
  1934.  
  1935.  
  1936. if est_price1 > Close_Price:
  1937. if M_Price > High_Price:
  1938. if Liq_change < avg_Liq_change and abs(Liq_change) > 500:
  1939. Tick_String = fg(117)+bg(240)+'RELENTLESS BEAR TRAP'+rs.all+WarningString+' '
  1940. if Liq_change >= avg_Liq_change:
  1941. Tick_String = fg(52)+bg(240)+'RELENTLESS BULL TRAP'+rs.all+WarningString+' '
  1942. if est_price1 < Close_Price:
  1943. Tick_String = fg(52)+bg(240)+'RELENTLESS BULL TRAP'+rs.all+WarningString+' '
  1944. nTS = True
  1945. else:
  1946. nTS = False
  1947. pass
  1948. else:
  1949. nTS = False
  1950. pass
  1951.  
  1952. if mRatio < .15 and sneakR < 8:
  1953. if M_Price > High_Price:
  1954. if Liq_change > avg_Liq_change:
  1955. est_price = round(-1*(LFPC * Close_Price) + Close_Price, 2)
  1956. est_price_str = str(est_price)
  1957. Tick_String = Fore.YELLOW+'GET THE FUCK OUT ($%s)' % est_price_str
  1958. bearTS = True
  1959.  
  1960. if M_Price < Low_Price:
  1961. if abs(Liq_change) > avg_Liq_change:
  1962. est_price = round(1*(LFPC * Close_Price) + Close_Price, 2)
  1963. est_price_str = str(est_price)
  1964. Tick_String = Fore.YELLOW+'MONEY MOVING ($%s)' % est_price_str
  1965. bullTS = True
  1966.  
  1967. else:
  1968. bearTS = False
  1969. bullTS = False
  1970. pass
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976. if Liq_change < 0 and M_Price > Close_Price:
  1977. if mRatio < .5 and sneakR < 10:
  1978. Tick_String = colored('MAJOR DOWNTICK', 'yellow', 'on_red', attrs=['bold'])
  1979. bearTS = True
  1980.  
  1981. else:
  1982. pass
  1983.  
  1984. else:
  1985. bearTS = False
  1986.  
  1987. if sneakR >= 200:
  1988. Tick_String = fg(184)+bg(17)+'HUGE sneakR (%s)' % sneakR
  1989.  
  1990.  
  1991. if sneakR >= 100 and mRatio >= 3:
  1992. Tick_String = colored('SERIOUSLY BULLISH', 'white', 'on_blue', attrs=['bold'])
  1993. bullTS = True
  1994.  
  1995. if mRatio >= 5:
  1996.  
  1997.  
  1998. if sneakR / mRatio >= 35 and sneakR > 200:
  1999. Tick_String = colored('EXTREMELY FKN BULLISH', 'grey', 'on_cyan', attrs=['bold', 'blink'])
  2000. bullTS = True
  2001. bearTS = False
  2002. if sneakR / mRatio <= 15 and Liq_change < 0:
  2003. Tick_String = bg(100)+bg(153)+fg(95)+fg(160)+'MASSIVE DUMPING <LONG TERM CONFIDENCE (3-5DAYS) ONLY>'+rs.all+WarningString+' '
  2004. bearTS = True
  2005. bullTS = False
  2006.  
  2007. else:
  2008. bullTS = False
  2009. bearTS = False
  2010. pass
  2011. else:
  2012. bullTS = False
  2013. bearTS = False
  2014. pass
  2015.  
  2016.  
  2017. else:
  2018. bullTS = False
  2019. bearTS = False
  2020. pass
  2021.  
  2022. if sneakR < 50 and mRatio >= 5:
  2023. if Close_Price > lastMPrice + avg_HL_Range:
  2024. Tick_String = colored('TOP CALLA', 'red', 'on_white', attrs=['bold'])
  2025. bearTS = True
  2026. if Close_Price < lastMPrice - avg_HL_Range:
  2027. Tick_String = colored('FOUND THE BOTTOM', 'blue', 'on_cyan')
  2028. bullTS = True
  2029. else:
  2030. bullTS = False
  2031. bearTS = False
  2032.  
  2033.  
  2034.  
  2035. if mRatio >= 1 and mRatio < 1.5:
  2036. if sneakR >= 60 and Liq_change >= avg_Liq_change:
  2037. Tick_String = fg(117)+bg(244)+'BUY ENTRY'+rs.all+WarningString+' '
  2038. bullTS = True
  2039.  
  2040. else:
  2041. pass
  2042.  
  2043. if Open_Price > Last:
  2044. if mRatio < .175 and sneakR < 10:
  2045. if Liq_change > 0:
  2046. est_price = round(1*(LFPC * Close_Price) + Close_Price, 2)
  2047. Tick_String = fg(0)+bg(118)+'ALGOS WANT IT HIGHER ($'+str(est_price)+')'+fg.rs
  2048. if Liq_change < 0:
  2049. est_price = round(-1*(LFPC * Close_Price) + Close_Price, 2)
  2050. Tick_String = fg(0)+bg(94)+'ALGOS WANT IT LOWER ($'+str(est_price)+')'+rs.all
  2051. else:
  2052. pass
  2053.  
  2054. if sneakR >= 20 and mRatio < .35:
  2055. if ref_Num >= 2 and lastmRatio < 1:
  2056. Tick_String = fg(197)+bg(235)+'$ BEING PUT TO WORK $'+rs.all+WarningString+' '
  2057. bullTS = True
  2058. else:
  2059. bullTS = False
  2060. pass
  2061.  
  2062.  
  2063.  
  2064.  
  2065. if mRatio >= 3 and sneakR / mRatio <= 10:
  2066. if mRatio >= qratio:
  2067. if Liquidity > 0:
  2068. Tick_String = fg(16)+bg(213)+'MASSIVE BUYING <LONG TERM CONFIDENCE ONLY>'+rs.all+WarningString+' '
  2069. bullTS = True
  2070. bearTS = False
  2071. if Liquidity < 0 or Liquidity - Liq_change < 0:
  2072. Tick_String = bg(100)+bg(153)+fg(95)+fg(160)+'MASSIVE SHORT COVERING <LONG TERM CONFIDENCE ONLY>'+rs.all+WarningString+' '
  2073. bearTS = True
  2074. bullTS = False
  2075. else:
  2076. bearTS1 = False
  2077. bullTS = False
  2078. bearTS = False
  2079.  
  2080.  
  2081. else:
  2082. bearTS1 = False
  2083.  
  2084. if Liquidity < 0:
  2085. if Liq_change <= avg_Liq_change and Liq_change > 0: #################
  2086. Tick_String = fg(169)+bg(0)+'PIRANAHS BITING'+rs.all+WarningString+' ' #################
  2087. if Liq_change > avg_Liq_change * 2 and Liq_change > 0:
  2088. if mRatio >= 1 and mRatio < 3:
  2089. Tick_String = fg(153)+bg(88)+ef.u+'MASSIVE SHORT COVERING RALLY'+rs.all+WarningString+' '
  2090. bullTS = True
  2091. bearTS1 = False
  2092. if mRatio >= 3:
  2093. Tick_String = fg(158)+bg(235)+'DANGEROUS SHORT COVERING'+rs.all+WarningString+' ' ##############
  2094. bearTS1 = True
  2095. bullTS = False
  2096.  
  2097. else:
  2098. bullTS = False
  2099. bearTS1 = False
  2100. pass
  2101.  
  2102. if sneakR >= 25 and new_sneakR / sneakR < 1.1:
  2103. if mRatio < .5:
  2104. if Liquidity > 0:
  2105. Tick_String = fg(118)+bg(234)+'BULLISH ACCUMULATION'+rs.all+WarningString+' '
  2106. if Liquidity < 0:
  2107. Tick_String = fg(96)+fg(17)+bg(103)+bg(141)+'BEARISH ACCUMULATION'+rs.all+WarningString+' '
  2108. if Liq_change < 0 and Close_Price < Open_Price:
  2109. if Close_Price < lastLPrice and abs(Liq_change) > avg_Liq_change + (avg_Liq_change * .2):
  2110. if Intraday_Strength >= new_Strength:
  2111. Tick_String = fg(50)+bg(243)+'REDBULL RALLY'+rs.all+WarningString+' '
  2112. bullTS = True
  2113. if new_Strength < Intraday_Strength:
  2114. Tick_String = fg(255)+bg(52)+'BEARS RUN IT'+rs.all+WarningString+' '
  2115. bullTS = False
  2116. bearTS = True
  2117.  
  2118.  
  2119.  
  2120.  
  2121.  
  2122. else:
  2123. bullTS = False
  2124. bearTS = False
  2125. pass
  2126.  
  2127.  
  2128. if DR >= 4:
  2129. extremeDR = True
  2130. else:
  2131. extremeDR = False
  2132.  
  2133. if gapRatio >= 5:
  2134. extremeGR = True
  2135. else:
  2136. extremeGR = False
  2137.  
  2138.  
  2139. if LFPC >= .002 and Range_Clause == False:
  2140. if mRatio >= .2 and sneakR < 10:
  2141. if Liq_change > 0 and M_Price > lastMPrice:
  2142. bullTS = True
  2143. bearTS = False
  2144. est_diff = LFPC * Close_Price
  2145. est_price = round(est_diff + Close_Price, 2)
  2146. Tick_String = fg(159)+'MASSIVE BUYING '+str(est_price)+rs.all+WarningString+' '+str(M_Price_clone)
  2147.  
  2148.  
  2149. if Liq_change < 0 and M_Price < lastMPrice:
  2150. bearTS = True
  2151. bullTS = False
  2152. est_diff = (LFPC * -1) * Close_Price
  2153. est_price = round(est_diff + Close_Price, 2)
  2154. Tick_String = fg(154)+'MASSIVE SELLING '+str(est_price)+rs.all+WarningString+' '
  2155.  
  2156. else:
  2157. bearTS = False
  2158. bullTS = False
  2159.  
  2160. else:
  2161. bearTS = False
  2162. bullTS = False
  2163.  
  2164.  
  2165. if LFPC >= .01:
  2166. if newratio >= 1 and qratio < 10:
  2167. if Liq_change > 0:
  2168. Tick_String = fg(167)+fg(134)+bg(59)+'ALGOS BIGLY SELLERS'+rs.all+WarningString+' '
  2169. if Liq_change < 0:
  2170. Tick_String = fg(156)+fg(84)+'ALGOS BIGLY BUYERS'+rs.all+WarningString+' '
  2171.  
  2172.  
  2173. if qratio < 10:
  2174. if Liq_change > 0 or MIV_Index > 0:
  2175. Tick_String = fg(9)+bg(235)+'QRATIO = '+str(qratio)+rs.all+WarningString+' '
  2176.  
  2177. if Liq_change < 0 or MIV_Index < 0:
  2178. Tick_String = fg(51)+bg(234)+'QRATIO = '+str(qratio)+rs.all+WarningString+' '
  2179.  
  2180. if qratio >= 80 and Liq_change > 0:
  2181. Tick_String = fg(9)+bg(235)+'QRATIO = '+str(qratio)+rs.all+WarningString+' '
  2182. bearTS = True
  2183. bullTS = False
  2184.  
  2185. elif qratio >= 150:
  2186. Tick_String = fg(214)+bg(234)+'MASSIVE QRATIO ['+str(qratio)+']'+rs.all+WarningString+' '
  2187. bearTS = True
  2188. bullTS = False
  2189.  
  2190.  
  2191. if sneakR < 10 and LFPC >= .0015 and qratio < 20:
  2192. Tick_String = fg(191)+bg(232)+'BIG MOVE COMING'+rs.all+WarningString+' '
  2193.  
  2194. if sneakR < 5 and LFPC >= .0015:
  2195. Tick_String = fg(191)+bg(232)+'BIG MOVE COMING'+rs.all+WarningString+' '
  2196.  
  2197. if LFPC >= .003:
  2198. Tick_String = fg(191)+bg(232)+'LARGE LFPC '+str(LFPC)+rs.all+WarningString+' '
  2199.  
  2200.  
  2201.  
  2202. if sneakR < 5 and qratio < 11 and mRatio < 1:
  2203. if Liq_change > 0:
  2204. bearTS = True
  2205. Tick_String = fg(233)+bg(1)+ef.b+'*BEAR MOVE COMING*'+rs.all+WarningString+' '
  2206.  
  2207. if sneakR >= 350:
  2208. Tick_String = fg(227)+bg(55)+'MASSIVE sneakR ['+str(sneakR)+']'+rs.all+WarningString+' '
  2209. nTS = True
  2210. bearTS = False
  2211. bullTS = False
  2212.  
  2213.  
  2214. ######################################################################################################################################################
  2215.  
  2216.  
  2217. if sneakR < 5 and qratio < 20 and LFPC == 0:
  2218. extremeBullTS = True
  2219. Tick_String = fg(192)+bg(17)+'BULL SIGNAL (VOLATILITY COMING)'+rs.all+WarningString+' '
  2220.  
  2221. if mRatio > 1.5 and LFP < 100:
  2222. if LQP_Match == False and Liq_change < 0:
  2223. if qratio < 10 and sneakR < 30:
  2224. if sneakR > 10 and mRatio >= 2:
  2225. if BAMS == False:
  2226. extremeBullTS = False
  2227. extremeBearTS = True
  2228. Tick_String = fg(197)+bg(0)+ef.b+ef.u+'*SELL* MAX * CONFIDENCE *'+rs.all+WarningString+' '
  2229. if sneakR < 10:
  2230. if SAMS == False:
  2231. extremeBullTS = True
  2232. extremeBearTS = False
  2233. Tick_String = fg(129)+bg(16)+ef.u+'RIDE THE FKN SKETCH WAVE'+rs.all+WarningString+' '
  2234.  
  2235. if SAMS == True:
  2236. extremeBullTS = False
  2237. extremeBearTS = True
  2238. Tick_String = fg(129)+bg(16)+ef.u+'BUY SIGNAL (1) - TOO RISKY (SAMS)'
  2239.  
  2240.  
  2241. if qratio > sneakR and qratio < 10:
  2242. if LFPC >= .0015:
  2243. extremeBullTS = False
  2244. extremeBearTS = True
  2245. Tick_String = fg(197)+bg(0)+ef.b+ef.u+'*DUMB SELLING*SMART BUYING* (1)'+rs.all+WarningString+' '
  2246.  
  2247.  
  2248. if qratio <= 4 and Liq_change > 0 and LFPC >= .001 and ref_Num >= 3:
  2249. extremeBullTS = False
  2250. extremeBearTS = True
  2251. Tick_String = fg(197)+bg(0)+ef.b+ef.u+'*SELL THE RALLY* (2)'+rs.all+WarningString+' '
  2252.  
  2253. if qratio >= 100 and LFPC >= .001:
  2254. if M_Price > High_Price:
  2255. if SAMS == True:
  2256. FMC = False
  2257. extremeBearTS = False
  2258. FMC = True
  2259. extremeBullTS = False
  2260. MHOD = False
  2261. MLOD = False
  2262. nTS = False
  2263.  
  2264. Tick_String = fg(191)+bg(236)+ef.b+ef.u+'FAT MOVE COMING (TA)'+rs.all+WarningString+' '
  2265.  
  2266. if M_Price < Low_Price:
  2267. extremeBearTS = True
  2268. extremeBullTS = False
  2269. MHOD = False
  2270. MLOD = False
  2271. nTS = False
  2272. Tick_String = fg(191)+bg(236)+ef.b+ef.u+'FAT MOVE COMING (TB)'+rs.all+WarningString+' '
  2273.  
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279. if sneakR > 100 and LFPC >= .0015:
  2280. if Range_Clause == False:
  2281. if qratio >= 35:
  2282. if SAMS == False:
  2283. extremeBullTS = True
  2284. extremeBearTS = False
  2285. Tick_String = fg(129)+bg(16)+ef.u+'RIDE THE FKN SKETCH WAVE'+rs.all+WarningString+' '
  2286.  
  2287. if SAMS == True:
  2288. extremeBullTS = False
  2289. extremeBearTS = True
  2290. Tick_String = fg(129)+bg(16)+ef.u+'BUY SIGNAL (2) - TOO RISKY (SAMS)'
  2291. # if qratio < 35:
  2292. # if Liq_change < 0:
  2293. # extremeBullTS = False
  2294. # extremeBearTS = True
  2295. # Tick_String = fg(197)+bg(0)+ef.b+ef.u+'*SELL* MAX * CONFIDENCE *'+rs.all+WarningString+' '
  2296. # if Liq_change > 0:
  2297. # extremeBearTS = False
  2298. # extremeBullTS = True
  2299. # Tick_String = fg(129)+bg(16)+ef.u+'RIDE THE FKN SKETCH WAVE'+rs.all+WarningString+' '
  2300.  
  2301.  
  2302. if LFPC < .001:
  2303. if sneakR > qratio and sneakR < 10 and mRatio >= 1:
  2304. bearTS = True
  2305. bullTS = False
  2306. Tick_String = Fore.RED+'BIG FKN SELLOFF COMING'+Style.RESET_ALL
  2307. extremeBullTS = False
  2308. if sneakR < 10 and sneakR >= qratio:
  2309.  
  2310.  
  2311.  
  2312.  
  2313. if mRatio >= 1 and LFPC >= .001:
  2314.  
  2315. if SAMS == True:
  2316. extremeBullTS = False
  2317. extremeBearTS = True
  2318. Tick_String = 'BUY SIGNAL - TOO RISKY (SAMS)'
  2319.  
  2320. if SAMS == False:
  2321. extremeBullTS = True
  2322. extremeBearTS = False
  2323. Tick_String = fg(129)+bg(16)+ef.u+'STUPID RIP COMING'+rs.all+WarningString+' '
  2324.  
  2325. if mRatio + qratio < sneakR and LFP < 200:
  2326. if LFPC < .001 and MIV_Index < 0:
  2327. if LQP_Match == True:
  2328. extremeBearTS = True
  2329. extremeBullTS = False
  2330. Tick_String = fg(197)+bg(0)+ef.b+ef.u+'*EXTREME BEAR SIGNAL*'+rs.all+WarningString+' '
  2331.  
  2332. if LQP_Match == False:
  2333. extremeBearTS = False
  2334. extremeBullTS = True
  2335. Tick_String = fg(156)+bg(232)+ef.b+ef.u+'*POTENTIAL BULL SIGNAL*'+rs.all+WarningString+' '
  2336.  
  2337.  
  2338.  
  2339.  
  2340.  
  2341.  
  2342.  
  2343.  
  2344.  
  2345. BAMS = False
  2346.  
  2347.  
  2348. if LFPC >= .0019 and sneakR < 10 and qratio < sneakR:
  2349. if SAMS == False:
  2350. extremeBullTS = True
  2351. extremeBearTS = False
  2352. Tick_String = fg(156)+bg(234)+ef.b+'*BUY* MAX * CONFIDENCE *'+rs.all+WarningString+' '
  2353.  
  2354. if SAMS == True:
  2355. extremeBullTS = False
  2356. extremeBearTS = True
  2357. Tick_String = 'BUY SIGNAL - TOO RISKY (SAMS)'
  2358.  
  2359.  
  2360.  
  2361. if Liq_change < 0 and qratio > 50 and MIV_Index > 2:
  2362. Tick_String = fg(197)+bg(0)+ef.b+ef.u+'*! SELL * ABSOLUTE * MAX * CONFIDENCE !*'+rs.all+WarningString+' '
  2363. extremeBullTS = False
  2364. SAMS = True
  2365. extremeBearTS = True
  2366. nTS = False
  2367.  
  2368.  
  2369. if sneakR < 1:
  2370. Tick_String = fg(197)+bg(0)+ef.b+ef.u+'*! SELL * ABSOLUTE * MAX * CONFIDENCE !*'+rs.all+WarningString+' '
  2371. extremeBullTS = False
  2372. SAMS = True
  2373. extremeBearTS = True
  2374.  
  2375. if sneakR < 10 and sneakR >= qratio:
  2376. if mRatio >= 1.25 or LFPC >= .0015:
  2377. if Liq_change < 0:
  2378. extremeBearTS = False
  2379. extremeBullTS = True
  2380. # extremeBullTS1 = True
  2381. Tick_String = fg(129)+bg(16)+ef.u+'STUPID RIP COMING'+rs.all+WarningString+' '
  2382.  
  2383.  
  2384.  
  2385. if Liq_change > 0:
  2386. extremeBearTS = False
  2387. extremeBullTS = False
  2388. extremeBullTS1 = True
  2389. Tick_String = fg(217)+bg(237)+'IFFY FKN RIP COMING'+rs.all+WarningString+' '
  2390. if ref_Num >= 3:
  2391.  
  2392. if lastMPrice > HOD and Range_Clause == False:
  2393. MHOD = True
  2394. FMC = False
  2395. MHOD_Price = lastMPrice
  2396. Tick_String = fg(129)+bg(16)+ef.u+'MONEY ABOVE HOD'+rs.all+WarningString+' '
  2397.  
  2398. if lastMPrice < LOD and Range_Clause == False:
  2399. MLOD = True
  2400. FMC = False
  2401. MLOD_Price = lastMPrice
  2402. Tick_String = fg(129)+bg(16)+ef.u+'MONEY BELOW LOD'+rs.all+WarningString+' '
  2403.  
  2404.  
  2405. if MHOD == True:
  2406. if High_Price < MHOD_Price:
  2407. extremeBearTS = False
  2408. extremeBullTS = True
  2409. # extremeBullTS1 = True
  2410. if High_Price >= MHOD_Price:
  2411. MHOD = False
  2412. extremeBearTS = False
  2413. extremeBullTS = False
  2414. # extremeBullTS1 = True
  2415. Tick_String = fg(129)+bg(16)+ef.u+'MHOD PRICE FILLED'+rs.all+WarningString+' '
  2416.  
  2417. if MLOD == True:
  2418. if Low_Price > MLOD_Price:
  2419.  
  2420. extremeBearTS = True
  2421. extremeBullTS = False
  2422. # extremeBullTS1 = True
  2423. if Low_Price <= MLOD_Price:
  2424. MLOD = False
  2425. extremeBearTS = False
  2426. extremeBullTS = False
  2427. # extremeBullTS1 = True
  2428. Tick_String = fg(129)+bg(16)+ef.u+'MLOD PRICE FILLED'+rs.all+WarningString+' '
  2429.  
  2430. if sneakR < 10 and MIV_Index >= 3 and lastVol != 0:
  2431. lastVol = f_Vol
  2432. BAMS = True
  2433. countbam += 1
  2434. Tick_String = fg(51)+bg(234)+ef.u+Style.BRIGHT+'BUY * ABSOLUTE * MAX * CONFIDENCE *'+rs.all+WarningString+' '
  2435.  
  2436.  
  2437. if BAMS == True:
  2438. countbam += 1
  2439. if countbam >= 2:
  2440. SAMS = False
  2441. randfg = random.randint(1, 390)
  2442. randbg = random.randint(1, 390)
  2443. extremeBearTS = False
  2444. bullTS = False
  2445. bearTS = False
  2446. SAMS = False
  2447. Range_Clause = False
  2448. rFound = False
  2449. extremeBullTS = False
  2450. extremeBearTS = False
  2451. nTS = False
  2452. bearTS1 = False
  2453. Tick_String = fg(randfg)+bg(randbg)+'BUY * ABSOLUTE * MAX * CONFIDENCE *'
  2454.  
  2455. # if qratio < 10 and mRatio >= 2 and LFPC >= .0014 and sneakR < 20 and sneakR >= 10 and Liquidity < 0 and LQP_Match == True:
  2456. # YOU NEED TO ADD THIS FOR BULLISH EXTREME SIGNALS^^^^^^^
  2457.  
  2458.  
  2459. # #
  2460. #
  2461.  
  2462.  
  2463.  
  2464. if sneakR < 5 and qratio >= 50:
  2465. SAMS = True
  2466. Tick_String = fg(197)+bg(0)+ef.b+ef.u+'*SHORT TERM SAMS*'+rs.all+WarningString+' '
  2467. bearTS1 = False
  2468. extremeBearTS = True
  2469. extremeBullTS = False
  2470. bearTS = False
  2471. bullTS = False
  2472.  
  2473. if SAMS == True:
  2474. MHOD = False
  2475. extremeBullTS = False
  2476. FMC = False
  2477. BAMS = False
  2478. extremeBearTS = True
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504. Range_List[ref_Num] = Range_Found
  2505. # else:
  2506. # Tick_String = Fore.WHITE+'PRICE UP LIQ DOWN'+Style.RESET_ALL+WarningString+' '+Fore.WHITE+str(Strength)
  2507.  
  2508.  
  2509. # if abs(Liq_change) <= avg_Liq_change:
  2510. # Tick_String = Fore.RED+'SHORT RALLY'+Style.RESET_ALL+WarningString+' '+Fore.RED+str(Strength)
  2511. # # else:
  2512. # Tick_String = Fore.WHITE+'PRICE UP LIQ DOWN'+Style.RESET_ALL+WarningString+' '+Fore.WHITE+str(Strength)
  2513.  
  2514. # if Tick == -1 and Liq_Tick == 0:
  2515. # if Liquidity < 0:
  2516. # if abs(Liq_change) > avg_Liq_change*2:
  2517. # Tick_String = Fore.RED+'MM\'s BEARISH'+Style.RESET_ALL+WarningString+' '+Fore.YELLOW+str(Strength)
  2518. # else:
  2519. # Tick_String = Fore.RED+'SHORT COVERING'+Style.RESET_ALL+WarningString+' '+Fore.YELLOW+Back.BLUE+Style.BRIGHT+str(Strength)
  2520.  
  2521. Range_List[ref_Num] = Range_Found
  2522. else:
  2523.  
  2524. # if Range_Clause == True:
  2525. # if range_ref_String == "HIGH TARGET" and Money_Flow < 300000000:
  2526. # if Liq_change > 1000000:
  2527. # print("MARKET MAKER HIGH TARGET")
  2528. # if range_ref_String == "LOW TARGET" and Money_Flow > 300000000:
  2529. # if Liq_change < 1000000:
  2530. # print("MARKET MAKER LOW TARGET")
  2531.  
  2532. if lr_filled == False:
  2533. if filled == False:
  2534. if range_ref_String == "LOW TARGET" and Low_Price <= Low_Range:
  2535. filled_Price = Low_Price
  2536. time.sleep(pause)
  2537. print(Fore.WHITE + Back.RED + "LOW RANGE FILLED" + Style.RESET_ALL)
  2538. time.sleep(1)
  2539. lr_filled = True
  2540. lt_filled = False
  2541. lrf = 1
  2542. low_Ranges_Filled += lrf
  2543. if lt_filled == False and lr_filled == True:
  2544. if Close_Price <= Low_Target:
  2545. filled_target_price = Close_Price
  2546. time.sleep(pause)
  2547. print(Fore.RED + Back.YELLOW + 'LOW TARGET FILLED' + Style.RESET_ALL)
  2548. time.sleep(1)
  2549. lt_filled = True
  2550. filled = True
  2551. low_Targets_Filled += 1
  2552. if hr_filled == False:
  2553. if filled == False:
  2554. if range_ref_String == "HIGH TARGET" and High_Price >= High_Range:
  2555. filled_range_price = High_Price
  2556. time.sleep(pause)
  2557. print(Fore.CYAN + "HIGH RANGE FILLED" + Style.RESET_ALL)
  2558. time.sleep(1)
  2559. hr_filled = True
  2560. ht_filled = False
  2561. hrf = 1
  2562. high_Ranges_Filled += hrf
  2563. if ht_filled == False and hr_filled == True:
  2564. if Close_Price >= High_Target:
  2565. filled_target_price = High_Price
  2566. print(Fore.CYAN + "HIGH TARGET FILLED")
  2567. time.sleep(1)
  2568. ht_filled = True
  2569. filled = True
  2570. high_Targets_Filled += 1
  2571.  
  2572.  
  2573. if menu_ans == 'oldfile' or menu_ans == '1':
  2574. if Liquidity_Data == 'y':
  2575.  
  2576. if rFound == True:
  2577. if tHigh == True:
  2578. HRS = str(High_Range)
  2579. HRT = str(High_Target)
  2580. LRS = str(Low_Range)
  2581. LRT = str(Low_Target)
  2582. MIV_Index_String = str(MIV_Index)
  2583.  
  2584. 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,price_tick_str+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))
  2585. time.sleep(1)
  2586.  
  2587.  
  2588. else:
  2589. tHigh = False
  2590. else:
  2591. rFound = False
  2592.  
  2593. if rFound == True:
  2594. if tLow == True:
  2595. HRS = str(High_Range)
  2596. HRT = str(High_Target)
  2597. LRS = str(Low_Range)
  2598. LRT = str(Low_Target)
  2599. lowFlow = str(AvgLowRangeFlow)
  2600. flow = str(Money_Flow)
  2601. MIV_Index_String = str(MIV_Index)
  2602.  
  2603. Low_Prices = {'LOW RANGE: $': Low_Range, 'LOW TARGET: $': Low_Target} ##### May not need this line
  2604. 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,price_tick_str+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))
  2605. time.sleep(1)
  2606.  
  2607. else:
  2608. tLow = False
  2609. else:
  2610. rFound = False
  2611.  
  2612.  
  2613.  
  2614. if bullTS == True:
  2615. 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+Style.RESET_ALL+' '+price_tick_str+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)
  2616. time.sleep(pause)
  2617.  
  2618.  
  2619. if bearTS == True:
  2620. 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+Style.RESET_ALL+' '+price_tick_str+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)
  2621. time.sleep(pause)
  2622.  
  2623. if nTS == True:
  2624. 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+price_tick_str + ']'+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: $',EstimatedPrice,rs.all, M_Price)
  2625. time.sleep(pause)
  2626.  
  2627. if bearTS1 == True:
  2628. 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+price_tick_str + ']'+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)
  2629. time.sleep(pause)
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635. if bearTS == False and bullTS == False:
  2636. if nTS == False and bearTS1 == False and Range_Clause == False:
  2637. if extremeBearTS == True:
  2638. print(Fore.YELLOW+Style.BRIGHT+bg(233)+fg(88)+ '[' + Date + ']', military_time,PCT_Range_Str, Fore.YELLOW + Style.BRIGHT+fg(233)+fg(88)+'Current Liquidity:' + '{:20,.2f}'.format(Liquidity), Fore.YELLOW + Style.BRIGHT+bg(233)+fg(88)+' Liq Change: ' + '{:20,.2f}'.format(Liq_change)+ Fore.YELLOW + Style.BRIGHT+bg(233)+fg(88)+' Last Price: '+ef.u+'[$' +str(Close_Price) +']'+rs.all+ticksymbolo+mticksymbol+ticksymbolc+ ' '+Tick_String+ Fore.YELLOW + Back.RED + Style.BRIGHT + Style.RESET_ALL, M_Price)
  2639. time.sleep(timecounter)
  2640.  
  2641. elif extremeBullTS == True:
  2642. print(Fore.YELLOW+fg(46)+bg(234)+ '[' + Date + ']', military_time,PCT_Range_Str, Fore.YELLOW +fg(46)+bg(234)+'Current Liquidity:' + '{:20,.2f}'.format(Liquidity), Fore.YELLOW +fg(46)+bg(234)+' Liq Change: ' + '{:20,.2f}'.format(Liq_change)+ Fore.YELLOW +fg(46)+bg(234)+' Last Price: [$' + str(Close_Price) + ']'+ticksymbolo+mticksymbol+ticksymbolc+ ' '+Tick_String+ Fore.YELLOW + Back.RED + Style.RESET_ALL, M_Price)
  2643. time.sleep(timecounter)
  2644.  
  2645. elif extremeBullTS1 == True:
  2646. print(Fore.YELLOW+fg(215)+bg(233)+ '[' + Date + ']', military_time,PCT_Range_Str, Fore.YELLOW +fg(215)+bg(233)+'Current Liquidity:' + '{:20,.2f}'.format(Liquidity), Fore.YELLOW +fg(215)+bg(233)+' Liq Change: ' + '{:20,.2f}'.format(Liq_change)+ Fore.YELLOW +fg(215)+bg(233)+' Last Price: [$' + str(Close_Price) + ']'+ticksymbolo+mticksymbol+ticksymbolc+ ' '+Tick_String+ Fore.YELLOW + Back.RED + Style.RESET_ALL, M_Price)
  2647. time.sleep(timecounter)
  2648.  
  2649. elif FMC == True:
  2650. print(Fore.YELLOW+fg(154)+bg(61)+ '[' + Date + ']', military_time,PCT_Range_Str, Fore.YELLOW +fg(154)+bg(61)+'Current Liquidity:' + '{:20,.2f}'.format(Liquidity), Fore.YELLOW +fg(154)+bg(61)+' Liq Change: ' + '{:20,.2f}'.format(Liq_change)+ Fore.YELLOW +fg(154)+bg(61)+' Last Price: [$' + str(Close_Price) + ']'+ticksymbolo+mticksymbol+ticksymbolc+ ' '+Tick_String+ Fore.YELLOW + Back.RED + Style.RESET_ALL, M_Price)
  2651. time.sleep(timecounter)
  2652.  
  2653. elif BAMS == True:
  2654. bullTS = False
  2655. bearTS = False
  2656. SAMS = False
  2657. Range_Clause = False
  2658. rFound = False
  2659. nTS = False
  2660. bearTS1 = False
  2661. extremeBullTS = False
  2662. extremeBearTS = False
  2663. MHOD = False
  2664. MLOD = False
  2665. print(fg(157)+bg(235)+ '[' + Date + ']', military_time,PCT_Range_Str,Style.RESET_ALL + Fore.YELLOW+fg(157)+bg(235)+'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL + Fore.YELLOW +fg(157)+bg(235)+' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + Style.RESET_ALL, Fore.YELLOW +fg(157)+bg(235)+price_tick_str + ']'+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+ Style.RESET_ALL + ' '+ef.u+Tick_String + Style.RESET_ALL + Fore.YELLOW + Back.RED + Style.BRIGHT + Style.RESET_ALL, M_Price)
  2666.  
  2667.  
  2668.  
  2669.  
  2670. else:
  2671.  
  2672.  
  2673.  
  2674. if mRatio >= .45 and LFPC >= .001:
  2675. bg_color_code = bg(57)+bg(236)
  2676. bullish_price_str = fg(190)+fg(40)
  2677. bearish_price_str = fg(88)+fg(226)
  2678. if Liquidity + Liq_change > 0:
  2679. if Liq_change > 0:
  2680. time.sleep(timecounter)
  2681. print(Fore.YELLOW +bg_color_code+fg(191)+'[' + Date + ']', military_time,PCT_Range_Str,fg(94)+fg(154) + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) +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)
  2682.  
  2683. if Liq_change < 0:
  2684. time.sleep(timecounter)
  2685. print(Fore.YELLOW +bg_color_code+fg(191)+'[' + Date + ']', military_time,PCT_Range_Str,fg(88)+fg(196) + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) +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)
  2686.  
  2687.  
  2688.  
  2689. if Liquidity + Liq_change < 0 and Liquidity < 0:
  2690. if Liq_change > 0:
  2691. time.sleep(timecounter)
  2692. print(bg_color_code+fg(191)+'[' + Date + ']', military_time,PCT_Range_Str,fg(88)+fg(196) + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) +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)
  2693.  
  2694. if Liq_change < 0:
  2695. time.sleep(timecounter)
  2696. print(bg_color_code+fg(191)+'[' + Date + ']', military_time,PCT_Range_Str,fg(94)+fg(154) + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + 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)
  2697.  
  2698. else:
  2699. if Liq_change < -1000000:
  2700. 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,price_tick_str +']'+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)
  2701. time.sleep(1)
  2702. if abs(Liq_change) > 500000:
  2703. time.sleep(timecounter)
  2704. 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) + ' ' +Style.RESET_ALL+price_tick_str+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+ ' '+ Tick_String + Style.RESET_ALL + ' ' + Fore.WHITE+SS+'%'+Style.RESET_ALL, M_Price, ' | ', est_price1)
  2705.  
  2706. if Liquidity < 0:
  2707. if Liq_change > 0:
  2708. if extremeDR == True:
  2709. time.sleep(timecounter)
  2710. print(fg(129)+bg(233)+'[' + 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+price_tick_str+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+Style.RESET_ALL +' '+Tick_String + Style.RESET_ALL + ' ' + Fore.WHITE+SS+'%'+Style.RESET_ALL, M_Price, ' | ', est_price1)
  2711. elif extremeGR == True:
  2712. time.sleep(timecounter)
  2713. print(fg(234)+bg(124)+'[' + 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+price_tick_str+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+Style.RESET_ALL +' '+Tick_String + Style.RESET_ALL + ' ' + Fore.WHITE+SS+'%'+Style.RESET_ALL, M_Price, ' | ', est_price1)
  2714. else:
  2715. time.sleep(timecounter)
  2716. 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+price_tick_str+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+Style.RESET_ALL +' '+Tick_String + Style.RESET_ALL + ' ' + Fore.WHITE+SS+'%'+Style.RESET_ALL, M_Price, ' | ', est_price1)
  2717. if Liq_change < 0:
  2718. if extremeDR == True:
  2719. time.sleep(timecounter)
  2720. print(fg(129)+bg(233)+'[' + 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+price_tick_str+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+Style.RESET_ALL +' '+Tick_String + Style.RESET_ALL + ' ' + Fore.WHITE+SS+'%'+Style.RESET_ALL, M_Price, ' | ', est_price1)
  2721. elif extremeGR == True:
  2722. time.sleep(timecounter)
  2723. print(fg(234)+bg(124)+'[' + 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+price_tick_str+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+Style.RESET_ALL +' '+Tick_String + Style.RESET_ALL + ' ' + Fore.WHITE+SS+'%'+Style.RESET_ALL, M_Price, ' | ', est_price1)
  2724. else:
  2725. time.sleep(timecounter)
  2726. 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+price_tick_str+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+Style.RESET_ALL +' '+Tick_String + Style.RESET_ALL + ' ' + Fore.WHITE+SS+'%'+Style.RESET_ALL, M_Price, ' | ', est_price1)
  2727.  
  2728.  
  2729. if Liquidity > 0:
  2730. if Liq_change > 0:
  2731. if extremeDR == True:
  2732. time.sleep(timecounter)
  2733. print(fg(129)+bg(233)+'[' + Date + ']', military_time,PCT_Range_Str,Fore.GREEN + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Fore.GREEN + ' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + ' '+Style.RESET_ALL+price_tick_str+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+ Style.RESET_ALL+ ' '+Tick_String + Style.RESET_ALL+Fore.WHITE+' '+SS+'%'+Style.RESET_ALL, M_Price, ' | ', est_price1)
  2734.  
  2735. else:
  2736. time.sleep(timecounter)
  2737. print(Fore.YELLOW + '[' + Date + ']', military_time,PCT_Range_Str,Fore.GREEN + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Fore.GREEN + ' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + ' '+Style.RESET_ALL+price_tick_str+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+ Style.RESET_ALL+ ' '+Tick_String + Style.RESET_ALL+Fore.WHITE+' '+SS+'%'+Style.RESET_ALL, M_Price, ' | ', est_price1)
  2738.  
  2739. if Liq_change < 0:
  2740. if extremeDR == True:
  2741. time.sleep(timecounter)
  2742. print(fg(129)+bg(233)+'[' + Date + ']', military_time,PCT_Range_Str,Fore.GREEN + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL + Fore.RED + ' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + Style.RESET_ALL + ' '+price_tick_str+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+ Style.RESET_ALL+ ' '+Tick_String + Style.RESET_ALL+Fore.WHITE+' '+SS+'%'+Style.RESET_ALL, M_Price, ' | ', est_price1)
  2743.  
  2744. else:
  2745. time.sleep(timecounter)
  2746. print(Fore.YELLOW + '[' + Date + ']', military_time,PCT_Range_Str,Fore.GREEN + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL + Fore.RED + ' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + Style.RESET_ALL + ' '+price_tick_str+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+ Style.RESET_ALL+ ' '+Tick_String + Style.RESET_ALL+Fore.WHITE+' '+SS+'%'+Style.RESET_ALL, M_Price, ' | ', est_price1)
  2747.  
  2748.  
  2749.  
  2750. # elif Liq_change > 0:
  2751. # time.sleep(timecounter)
  2752. # 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,price_tick_str+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+Style.RESET_ALL + ' '+Tick_String + Style.RESET_ALL + ' ' + Fore.WHITE+SS+'%'+Style.RESET_ALL, M_Price, ' | ', est_price1)
  2753. # elif Liq_change < 0:
  2754. # time.sleep(timecounter)
  2755. # 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+price_tick_str+Style.RESET_ALL+ticksymbolo+mticksymbol+ticksymbolc+Style.RESET_ALL + ' '+Tick_String+ Style.RESET_ALL + ' ' + Fore.WHITE+SS+'%'+Style.RESET_ALL, M_Price, ' | ', est_price1)
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761. if menu_ans == '5' or Liquidity_Data == 'n5':
  2762. import analyze8
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.  
  2769. if menu_ans == '4' or Liquidity_Data == 'n4':
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775. labels = ' Date Time Last LiqChange Liquidity $Flow | $Price | LFP | LFPC |EstPrice| Status | mRatio | sneakR | qratio'
  2776. underline = '-------------------------------------------------------------------------------------------------------------------------------------------------------------------------'
  2777. # if M_Price > High_Price or M_Price < Low_Price:
  2778.  
  2779. # if Money_Flow > 0 and abs(Liq_change) > 0:
  2780. # if qratio >= 35:
  2781. # if Liq_change > 0:
  2782. # EstimatedPrice = round(Close_Price + (Close_Price * LFPC), 2)
  2783. # if Liq_change < 0:
  2784. # EstimatedPrice = round(Close_Price - (Close_Price * LFPC), 2)
  2785. #
  2786. # else:
  2787. # EstimatedPrice = est_price_x
  2788.  
  2789. if M_Price > High_Price or M_Price < Low_Price:
  2790. if LFPC >= .001 and Range_Clause == False:
  2791. if sneakR >= 15 and qratio >= 35:
  2792. if EstimatedPrice >= HOD or EstimatedPrice <= LOD:
  2793. rawdatalist = [Date, military_time, Close_Price, liqchgstr, liqstr, mf_Str, M_Price, LFP, LFPC, EstimatedPrice, mRatio, sneakR, qratio]
  2794. rawdatalist.insert(10, Status)
  2795. rawdatalist1.append(rawdatalist)
  2796. if qratio < 25:
  2797. if EstimatedPrice >= HOD or EstimatedPrice <= LOD:
  2798. if sneakR < 10 or sneakR > qratio:
  2799. if Liq_change < 0:
  2800. EstimatedPrice = round(Close_Price + (Close_Price * LFPC), 2)
  2801. if Liq_change < 0:
  2802. EstimatedPrice = round(Close_Price - (Close_Price * LFPC), 2)
  2803. rawdatalist = [Date, military_time, Close_Price, liqchgstr, liqstr, mf_Str, M_Price, LFP, LFPC, EstimatedPrice, mRatio, sneakR, qratio]
  2804. rawdatalist.insert(10, Status)
  2805. rawdatalist1.append(rawdatalist)
  2806.  
  2807. else:
  2808.  
  2809. pass
  2810. if sneakR > 100 and qratio >= 35:
  2811. if rawdatalist in rawdatalist1:
  2812. pass
  2813. else:
  2814.  
  2815. rawdatalist1.append(rawdatalist)
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821. if menu_ans == '6' or menu_ans == 'x' or Liquidity_Data == 'n6' or Liquidity_Data == 'nx':
  2822.  
  2823. newratio = round(10*(LFP * LFPC), 3)
  2824. if abs(Liq_change) > 0:
  2825. LFP = round(Money_Flow / abs(Liq_change) *.01, 3)
  2826. LFPC = round(1000 * (abs(Liq_change) / Money_Flow) * .01, 4)
  2827. est_diff = round(.01*(100 - LFP), 2)
  2828. est_diff1 = round(LFPC * Close_Price, 2)
  2829. if Liquidity < 0:
  2830. if Liq_change < 0:
  2831. est_price = round(Close_Price - est_diff1, 2)
  2832. est_price1 = round(est_diff1 + Close_Price, 2)
  2833. if Liq_change > 0:
  2834. est_price = round(Close_Price + est_diff1, 2)
  2835. est_price1 = round(Close_Price + (-1 * est_diff1), 2)
  2836. if Liquidity > 0:
  2837. if Liq_change < 0:
  2838. est_price = round(Close_Price - est_diff1, 2)
  2839. est_price1 = round(Close_Price + (-1 * est_diff1), 2)
  2840. if Liq_change > 0:
  2841. est_price = round(est_diff1 + Close_Price, 2)
  2842. est_price1 = round(est_diff1 + Close_Price, 2)
  2843.  
  2844.  
  2845.  
  2846.  
  2847. # sneakR2_div_sneakR = round(new_sneakR / sneakR, 2)
  2848.  
  2849. mf_Str = '{:20,.2f}'.format(Money_Flow)
  2850.  
  2851. liqstr = '{:20,.2f}'.format(Liquidity)
  2852. liqchgstr = '{:20,.2f}'.format(Liq_change)
  2853. OC_Range = round(OC_Range, 2)
  2854. HL_Range = round(HL_Range, 2)
  2855. sneakR_Sum = round(sneakR_Sum, 2)
  2856.  
  2857. x_desc = ' Time Date Price LiqChg Liquidity $Price WA|DP PG | MTR | DR ITD_BP%/AdjBP% sneakR_Sum avgQR TickGauge'
  2858. if M_Price > High_Price or M_Price < Low_Price and EstimatedPrice != est_price_x:
  2859. if EstimatedPrice > HOD or EstimatedPrice < LOD:
  2860. EstimatedPrice = EstimatedPrice
  2861. else:
  2862. EstimatedPrice = 0
  2863. else:
  2864. EstimatedPrice = 0
  2865.  
  2866.  
  2867.  
  2868.  
  2869. rawdatalist = [Date, military_time, Close_Price, liqchgstr, liqstr, mf_Str, M_Price, LFP, LFPC, est_price1, mRatio, sneakR, qratio, EstimatedPrice, QRS_Index]
  2870.  
  2871. # if M_Price > High_Price or M_Price < Low_Price and LFPC >= .001:
  2872. # if EstimatedPrice > HOD or EstimatedPrice < LOD:
  2873. # EstimatedPrice = EstimatedPrice
  2874. # else:
  2875. # EstimatedPrice = 0
  2876. # else:
  2877. # EstimatedPrice = 0
  2878. # if sneakR < 10 and qratio < 30:
  2879. # if Liq_change < 0:
  2880. # EstimatedPrice_try = round(Close_Price + (Close_Price * LFPC), 2)
  2881. # if Liq_change > 0:
  2882. # EstimatedPrice_try = round(Close_Price - (Close_Price * LFPC), 2)
  2883. #
  2884. # if EstimatedPrice_try > HOD or EstimatedPrice_try < LOD:
  2885. # EstimatedPrice = EstimatedPrice_try
  2886.  
  2887. # if sneakR >= 15 and LFPC >= .001 and qratio >= 35:
  2888. # if EstimatedPrice > HOD or EstimatedPrice < LOD:
  2889. # EstimatedPrice = EstimatedPrice
  2890. # else:
  2891. # EstimatedPrice = 0
  2892. #
  2893. # else:
  2894. # EstimatedPrice = 0
  2895. #
  2896. #
  2897. # else:
  2898. # EstimatedPrice = 0
  2899.  
  2900. ta_tb_diff = round((TradingAbove_Diff - TradingBelow_Diff), 2)
  2901.  
  2902.  
  2903.  
  2904.  
  2905. writedatalist = [ref_Num, Date, military_time[:-3], Close_Price, M_Price, xString, qratio_div_max, EstimatedPrice, est_price1, MTR, PainGauge, DR, Intraday_Strength, new_Strength, LFP, LFPC, mRatio, sneakR, qratio, sneakR_Sum, avg_sneakR, avgQR, MIV_Spike_Count, avg_Liq_change, lastDPrice, Weighted_Avg_DPrice, Weighted_Movement, UDV, UDR_Ticks, MACD, sneakR_Sum, avg_sneakR, gapRatio, Resistance, Support, chg_Open, Open_Price, High_Price, Low_Price, Liq_change, Liquidity, f_Vol, Money_Flow, MIV_Index, avgVol, MTR_copy, PTLT_Ratio, gapRatio, gapDistanceRatio, PivotSpread, VSR, UDR, SketchDist, runningValueIndex, VIX]
  2906. with open('/Users/King/Spy_data_analysis.csv', 'a') as csv_file2:
  2907. reader2 = csv.reader(csv_file2)
  2908. wr = csv.writer(csv_file2)
  2909. wr.writerow(writedatalist)
  2910. info_datalist = [Date, military_time, Close_Price,'{:10,.2f}'.format(Liq_change), '{:10,.2f}'.format(Liquidity), M_Price, PainGauge, MTR, DR, DRC, gapRatio, gapDistanceRatio, Intraday_Strength, new_Strength, sneakR_Sum, avgQR, '{:2,.2f}'.format(avg_Liq_change), '{:2,.2f}'.format(avgVol), UDR, round(PivotSpread, 2), chg_Open, VIX]
  2911.  
  2912. rawdatalist3.append(info_datalist)
  2913. rawdatalist2.append(rawdatalist)
  2914. # if LFPC >= .0013 and LFP < 60:
  2915. # rawdatalist2.append(rawdatalist)
  2916. print(labels)
  2917. print(underline)
  2918.  
  2919. for i in rawdatalist1:
  2920. countitems += 1
  2921. print(i)
  2922.  
  2923. if menu_ans == '6' or Liquidity_Data == 'n6':
  2924. for i in rawdatalist2:
  2925. print(i)
  2926. import dprice
  2927. import dprice1
  2928.  
  2929. if menu_ans == 'x' or Liquidity_Data == 'nx':
  2930. print(x_desc)
  2931. for i in rawdatalist3:
  2932. print(i)
  2933.  
  2934.  
  2935. if menu_ans == '7' or Liquidity_Data == 'n7':
  2936.  
  2937.  
  2938. bigFlowbigMovepct = round(100*(LargeFlowCount / (DOWN_c + UP_c)), 2)
  2939. sum_large_LFPC = round((100*sum_large_LFPC) / 2, 3)
  2940.  
  2941. if TradingAbove_Count >= 1:
  2942. TATBR_A = round(TradingAbove_Diff / TradingAbove_Count, 2)
  2943.  
  2944. if TradingBelow_Count >= 1:
  2945. TATBR_B = round(TradingBelow_Diff / TradingBelow_Count, 2)
  2946.  
  2947. if TradingAbove_Count >= 1 and TradingBelow_Count >= 1:
  2948. if TradingAbove_Count >= TradingBelow_Count:
  2949. TATBR = round(TradingAbove_Count / TradingBelow_Count, 2)
  2950. TATBR_diff = round((TradingAbove_Diff / TradingAbove_Count) / (TradingBelow_Diff / TradingBelow_Count), 2)
  2951. if TradingAbove_Count < TradingBelow_Count:
  2952. TATBR = round(TradingBelow_Count / TradingAbove_Count, 2)
  2953. TATBR_diff = round((TradingBelow_Diff / TradingBelow_Count) / (TradingAbove_Diff / TradingAbove_Count), 2)
  2954.  
  2955. print(ef.u+Date, military_time,rs.all+'\n')
  2956.  
  2957.  
  2958.  
  2959. if new_Strength <= Intraday_Strength:
  2960. print(fg(233)+fg(0)+bg(2)+'Adj BP%: ',adj_Strength,'%',' BP%: ',new_Strength,'%'+rs.all)
  2961. print('PTLT Ratio: ',PTLT_Ratio)
  2962. print('U/D Ratio: ',UD_Ratio)
  2963. print('Price Tick Total: ',Price_Tick_Total)
  2964. print('Liq Tick Total: ',Liq_Tick_Total)
  2965. print('Bullish Percentile: ',new_Strength,'%')
  2966. print('IntraDay BP%: ',Intraday_Strength,'%')
  2967. print('Adj BP%: ',adj_Strength,'%')
  2968.  
  2969. sneakR_Sum = round(sneakR_Sum, 2)
  2970. TradingBelow_Diff = round(TradingBelow_Diff, 2)
  2971. TradingAbove_Diff = round(TradingAbove_Diff, 2)
  2972. sneakR_lgst_avg_ratio = round(max(sneakR_log) / avg_sneakR, 3)
  2973. if UpTicks > DownTicks:
  2974. print('Downticks: '+str(DOWN_c)+' | '+str(DownTicks)+'\n'+fg(39)+bg(238)+'Upticks: '+str(UP_c)+' | '+str(UpTicks)+rs.all)
  2975. else:
  2976. print(fg(9)+bg(16)+'Downticks: '+str(DOWN_c)+' | '+str(DownTicks),rs.all+'\n'+'Upticks: '+str(UP_c)+' | '+str(UpTicks)+rs.all)
  2977.  
  2978. if Avg_Up_Move > abs(Avg_Down_Move):
  2979. print(fg(39)+'Avg Up Move: $'+str(avg_up_move_clone)+rs.all,'\n'+'Avg Down Move: $'+str(avg_down_move_clone))
  2980. else:
  2981. if abs(Avg_Down_Move) > Avg_Up_Move:
  2982. print('Avg Up Move: $'+str(avg_up_move_clone)+rs.all,'\n'+fg(9)+'Avg Down Move: $'+str(avg_down_move_clone)+rs.all)
  2983. else:
  2984. print('Avg Up Move: $'+str(avg_up_move_clone)+'\n'+'Avg Down Move: $'+str(avg_down_move_clone))
  2985.  
  2986.  
  2987. print('Avg HL Range: $'+str(avg_HL_Range))
  2988. print('Large Flow Count: ', LargeFlowCount,' (%s' % bigFlowbigMovepct+'%) Of Up/DownTicks')
  2989. if MTR >= .5:
  2990. if MTR >= .55:
  2991. if MTR >= .6:
  2992. print(fg(39)+bg(238)+'MoneyTickRatio: '+str(MTR)+rs.all)
  2993.  
  2994.  
  2995. else:
  2996. print(fg(38)+'MoneyTickRatio: '+str(MTR)+rs.all)
  2997. else:
  2998. print(fg(79)+'MoneyTickRatio: '+str(MTR)+rs.all)
  2999.  
  3000.  
  3001. else:
  3002. print(fg(9)+'MoneyTickRatio: ',MTR,rs.all)
  3003. if DR >= 1:
  3004. if DR > 2:
  3005. print(fg(39)+bg(238)+'$ Strength: '+str(DR)+rs.all)
  3006. else:
  3007. print(fg(50)+'$ Strength: '+str(DR)+rs.all)
  3008.  
  3009.  
  3010.  
  3011. if DR < 1:
  3012. print(fg(9)+'$ Strength: '+str(DR)+rs.all)
  3013.  
  3014. if PainGauge < 1:
  3015. if PainGauge < .8:
  3016. print(fg(39)+bg(238)+'PainGauge: %s (%s' % (PainGauge, PainGaugePct)+'%)',rs.all)
  3017. else:
  3018. print(fg(117)+bg(238)+'PainGauge: %s (%s' % (PainGauge, PainGaugePct)+'%)',rs.all)
  3019.  
  3020. if PainGauge >= 1:
  3021. print(fg(9)+'PainGauge: %s (%s' % (PainGauge, PainGaugePct)+'%)',rs.all)
  3022.  
  3023.  
  3024. avg_sneakr_avg_m = round(avg_sneakR / avg_mRatio, 3)
  3025.  
  3026. if avg_sneakr_avg_m >= avg_sneakR:
  3027. if avg_sneakr_avg_m < 25 and avg_sneakR < 20:
  3028. 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)
  3029. else:
  3030.  
  3031. 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)
  3032.  
  3033. # print(ef.dim+'Avg sneakR1: ',avg_sneakR,rs.all+'\n'+fg(50)+ef.u+'Avg sneakR / avg mRatio',avg_sneakr_avg_m,rs.all)
  3034. else:
  3035. 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)
  3036.  
  3037. if sneakR_lgst_avg_ratio >= 7:
  3038. print('sneakR lgst:avg: '+fg(9)+str(sneakR_lgst_avg_ratio)+rs.all)
  3039. else:
  3040. print(fg(123)+bg(90)+ef.u+'sneakR lgst:avg: '+str(sneakR_lgst_avg_ratio)+rs.all)
  3041.  
  3042. print('Implied Vol: ',Avg_Move,'%')
  3043. print('LFPC Volatility %: ',sum_large_LFPC,'%')
  3044.  
  3045. print('TATBR Sum As % Of Price: ',str(TATBR_Sum)+'%')
  3046. print('Largest Sneak Ratio: ', max(sneakR_log))
  3047.  
  3048. print(ef.u+'Trading Above Count: ', TradingAbove_Count, 'Trading Above $ Total: $', TradingAbove_Diff,rs.all)
  3049. print(ef.u+'Trading Below Count: ', TradingBelow_Count, 'Trading Below $ Total: $', TradingBelow_Diff,rs.all)
  3050. if TradingAbove_Count >= 1 and TradingBelow_Count >= 1:
  3051. if TradingAbove_Count > TradingBelow_Count:
  3052. if TATBR > TATBR_diff:
  3053. print(ef.dim+'TATBR: ',TATBR,rs.all,'\n'+fg(172)+ef.u+'TATBR Diff: ',TATBR_diff,rs.all)
  3054.  
  3055. if TATBR_diff > TATBR:
  3056. print(ef.dim+'TATBR: ',TATBR,rs.all,'\n'+fg(39)+ef.u+'TATBR Diff: ',TATBR_diff,rs.all)
  3057.  
  3058. if TradingBelow_Count > TradingAbove_Count:
  3059. if TATBR > TATBR_diff:
  3060. print(fg(154)+'TATBR: ',TATBR,rs.all,'\n'+fg(17)+bg(154)+ef.u+'TATBR Diff: ',TATBR_diff,rs.all)
  3061.  
  3062. if TATBR_diff > TATBR:
  3063. print(fg(154)+'TATBR: ',TATBR,rs.all,'\n'+fg(157)+bg(17)+ef.u+'TATBR Diff: ',TATBR_diff,rs.all,)
  3064.  
  3065.  
  3066. print('TATBR_A: ',TATBR_A)
  3067. print('TATBR_B: ',TATBR_B)
  3068. print('GapUps: ',gapUp)
  3069. print('GapDowns: ',gapDown)
  3070. print('UpCount: ',UP_c)
  3071. print('DownCount: ',DOWN_c)
  3072.  
  3073.  
  3074.  
  3075. if gapRatio >= 1:
  3076. if gapRatio >= 1.5:
  3077. print(bg(123)+fg(4)+ef.u+ef.b+'GapRatio: ',gapRatio,rs.all)
  3078. else:
  3079. print(fg(39)+'GapRatio: ',gapRatio,rs.all)
  3080.  
  3081. if gapRatio < 1:
  3082. print(fg(9)+'GapRatio: ',gapRatio,rs.all)
  3083. print('MIV Spike Count: ',MIV_Spike_Count)
  3084. print('Avg MIV Spike',Avg_MIV_Spike,'%')
  3085. print('sneakR_Sum: ',sneakR_Sum)
  3086. if avg_mRatio >= 1:
  3087. print(fg(159)+bg(52)+'Avg mRatio: ',avg_mRatio,rs.all)
  3088. else:
  3089. print('Avg mRatio: ',avg_mRatio)
  3090.  
  3091. print('Avg Liq Change: $','{:5,.2f}'.format(avg_Liq_change))
  3092. if chg_Open > 0:
  3093. print(fg(51)+'% Chg Open: ',chg_Open,'%',rs.all)
  3094. else:
  3095. print(fg(9)+'% Chg Open: ',chg_Open,'%',rs.all)
  3096.  
  3097. liqstr = '{:5,.2f}'.format(Liquidity)
  3098. avg_pct_liq_chg = round(100*(avg_Liq_change / abs(Liquidity)), 3)
  3099. print('Liquidity: $',liqstr)
  3100. print('Avg Liq Change % Liquidity: ',avg_pct_liq_chg,'%')
  3101. if avgQR < 25:
  3102. print(fg(11)+bg(59)+'Avg QR: ',avgQR,rs.all)
  3103. else:
  3104. print(fg(20)+bg(59)+'Avg QR: ',avgQR,rs.all)
  3105. print('PivotPrice: '+PivotStr)
  3106. sum_LFPC = round(sum_LFPC, 4)
  3107.  
  3108.  
  3109. print('SUM LFPC | AVG LFPC: %s | %s' % (sum_LFPC, avg_LFPC))
  3110.  
  3111. print('GapUpDistance: %s' % gapUpDistance)
  3112. print('GapDownDistance: %s' % gapDownDistance)
  3113. print('GDR: %s' % gapDistanceRatio)
  3114. # print('Volatility Index: %s' % volatility_index)
  3115. print('Avg Vol: %s' % avgVol)
  3116. print('VSR: %s' % VSR)
  3117. print('QRS Index: %s' % QRS_Index)
  3118. print('UDR Strength: %s' % UDR_Strength)
  3119. print('MTR Strength %s' % MTR_Strength)
  3120. print('Avg LFP: %s' % avgLFP)
  3121. if VIX < avgVIX:
  3122. print(Fore.CYAN+'VIX: ˇ $%s' % VIX,rs.all)
  3123. if VIX >= avgVIX:
  3124. print(Fore.RED+'VIX: $%s' % VIX, rs.all)
  3125.  
  3126. print(rPVS)
  3127.  
  3128.  
  3129.  
  3130. if menu_ans == '3':
  3131. import tcopy
  3132.  
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138.  
  3139.  
  3140. if PrintInfo == True:
  3141.  
  3142.  
  3143. print('MIV Spike Count: ',MIV_Spike_Count)
  3144. print('Avg MIV Spike',Avg_MIV_Spike,'%')
  3145. print(Fore.CYAN + 'REF#:', ref_Num)
  3146. time.sleep(.25)
  3147. print(Fore.WHITE + Time)
  3148. time.sleep(.25)
  3149. print('Adj BP%: ',adj_Strength,'%')
  3150.  
  3151. print("Last:", "$" + str(Close_Price))
  3152. time.sleep(.25)
  3153. print("HLCC:", "$" + str(HLCC))
  3154. time.sleep(.25)
  3155. if HLCC >= M_Price:
  3156. print(Fore.CYAN+"Money Price: "+" $" + str(round(M_Price, 2))+Style.RESET_ALL)
  3157. time.sleep(.25)
  3158. print(Fore.CYAN+'Price Diff: ' + '$' + str(Diff)+Style.RESET_ALL)
  3159.  
  3160. if HLCC < M_Price:
  3161. print(Fore.RED+"Money Price: "+Fore.RED+" $" + str(round(M_Price, 2))+Style.RESET_ALL)
  3162. time.sleep(.25)
  3163. print(Fore.RED+'Price Diff: ' + '$' + str(Diff)+Style.RESET_ALL)
  3164.  
  3165. time.sleep(.25)
  3166. if f_Vol > 1000000:
  3167. print(Fore.YELLOW + 'Volume:' + '{:20,.2f}'.format(f_Vol))
  3168. else:
  3169. print(Fore.WHITE + 'Volume:' + '{:20,.2f}'.format(f_Vol))
  3170. time.sleep(.25)
  3171. if Money_Flow > 350000000:
  3172. print(Fore.YELLOW + '$Flow:' + '{:20,.2f}'.format(Money_Flow))
  3173. else:
  3174. print(Fore.WHITE + '$Flow:' + '{:20,.2f}'.format(Money_Flow))
  3175. time.sleep(.25)
  3176. if Liq_change < 0:
  3177. print(Fore.RED + 'Liq Change:', '{:20,.2f}'.format(Liq_change), Style.RESET_ALL)
  3178. else:
  3179. print(Fore.CYAN + 'Liq Change:', '{:20,.2f}'.format(Liq_change))
  3180. time.sleep(.25)
  3181. if Liquidity < 0:
  3182. print(Fore.RED + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity), Style.RESET_ALL)
  3183. else:
  3184. print(Fore.CYAN + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity), Style.RESET_ALL)
  3185. time.sleep(.25)
  3186. print('Avg MIV Spike: ',Avg_MIV_Spike,'%')
  3187. print('Gap Ratio: ',gapRatio)
  3188. if percent_Strength >= -.68:
  3189. percent_Strength_String = Fore.GREEN+'Current Strength: '+str(percent_Strength)+'%'+Style.RESET_ALL
  3190. print(percent_Strength_String)
  3191. if percent_Strength <-.68:
  3192. percent_Strength_String = Fore.RED+'Current Strength: '+str(percent_Strength)+'%'+Style.RESET_ALL
  3193. print(percent_Strength_String)
  3194.  
  3195. # new_Strength = 100-(100*abs(percent_Strength- -.3153) / .8719)
  3196. if new_Strength > 70:
  3197. if Intraday_Strength >= new_Strength:
  3198. print(ef.u+'Adj BP%: ',adj_Strength,'%',rs.all,'\n'+'Bullishness Percentile: '+str(round(new_Strength, 2)))
  3199. else:
  3200. new_Strength_String = Fore.CYAN+'Bullishness Percentile: '+str(round(new_Strength, 2))+'%'+Style.RESET_ALL
  3201.  
  3202. else:
  3203. print('Adj BP%: ',adj_Strength,'%')
  3204. new_Strength_String = Fore.RED+'Bullishness Percentile: '+str(round(new_Strength, 2))+'%'+Style.RESET_ALL
  3205.  
  3206. if PainGauge > 1 or PainGauge < .6:
  3207. if PainGauge >= 1:
  3208. print(fg(232)+bg(196)+'PainGauge: ',PainGauge,rs.all)
  3209. if PainGauge < .6:
  3210. print(fg(87)+bg(4)+'PainGauge: ', PainGauge,rs.all)
  3211.  
  3212.  
  3213. else:
  3214. print('PainGauge: ',PainGauge)
  3215.  
  3216. if Intraday_Strength < 55 or Intraday_Strength > 85:
  3217. if Intraday_Strength > 85:
  3218. print(Fore.CYAN+'IntraDay Strength: ',Intraday_Strength,'%', Style.RESET_ALL)
  3219.  
  3220. if Intraday_Strength < 55:
  3221. print(fg(232)+bg(196)+'IntraDay Strength: ',Intraday_Strength,'%',rs.all)
  3222.  
  3223. else:
  3224. print('IntraDay Strength: ',Intraday_Strength,'%')
  3225.  
  3226. # print('NEWVIX ', newvix)
  3227.  
  3228.  
  3229.  
  3230. if BuyPower > 0 and ShortPower > 0 and SellPower > 0 and SellPower > 0:
  3231. pctShortBuying = round(BuyPower / ShortPower, 4)*100
  3232. pctNetSelling = round(SellPower / ShortPower, 4)*100
  3233. pctNetBuying = round(BuyPower / SellPower, 4)*100
  3234. pctNetBuyingStr = str(pctNetBuying)
  3235. pctNetSellingStr = str(pctNetSelling)
  3236. pctShortBuyingStr = str(pctShortBuying)
  3237. print('Buy Power', '{:5,.2f}'.format(BuyPower), 'Short Power:','{:5,.2f}'.format(ShortPower))
  3238. print('Buy Power as % of Short Selling: ['+pctShortBuyingStr+'%]')
  3239. print('Sell Power as % of Short Selling: ['+pctNetSellingStr+'%]')
  3240. print('Net Buying as % of Net Selling: ['+pctNetBuyingStr+'%]')
  3241. BullBearRatio = abs(round(float(pctShortBuying / pctNetSelling), 4))
  3242. print('Bull Bear Ratio: ',BullBearRatio)
  3243. if UDR < 1:
  3244. print(fg(227)+bg(196)+ef.u+'UpTick/DownTick Ratio: ',UDR,rs.all)
  3245. else:
  3246. print('UpTick/DownTick Ratio: ',UDR)
  3247. if Close_Price >= avgMPrice:
  3248.  
  3249. print(fg(192)+bg(17)+'Money Tick Ratio: '+rs.all+str(MTR)+Fore.GREEN+' ∆'+Style.RESET_ALL)
  3250. else:
  3251. print(fg(16)+bg(220)+'Money Tick Ratio: '+rs.all+str(MTR)+Fore.RED+' ◊'+Style.RESET_ALL)
  3252. if DRC >= 1:
  3253. print('DRC: ', DRC)
  3254. print('Avg Distribution Price: $'+str(Avg_DPrice))
  3255. print('Weighted Avg DPrice: $'+str(Weighted_Avg_DPrice))
  3256.  
  3257. print('Last Distribution Price: $'+str(lastDPrice))
  3258. # print('Resistance: $',max(DP_list))
  3259. # print('Support: $',min(DP_list))
  3260. print('$ Strength: '+str(DR))
  3261.  
  3262.  
  3263. if lows_found >= 1 or highs_found >= 1:
  3264. print('\nLow Ranges/Targets Found|Filled:',lows_found, '| ', low_Ranges_Filled)
  3265. print('\nHigh Ranges/Targets Found|Filled: ',highs_found, '| ', high_Ranges_Filled)
  3266. print('Total found: ',found)
  3267. if hidden_strength > 0:
  3268. print('Hidden Strength: %s' % hidden_strength)
  3269. print('Avg sneakR: %s' % avg_sneakR)
  3270. print('Projected sneakR_Sum EOD: %s' % '{:2,.2f}'.format(projected_ss_eod))
  3271. print('Pivot Spread: $%s' % PivotSpread)
  3272. print('Avg QR: %s' % avgQR)
  3273. print('PVP: ', PVP,'%')
  3274. avgPrice = round(sumFlow / sumVol, 2)
  3275. print('Avg Price: $',avgPrice)
  3276.  
  3277. Style.RESET_ALL
  3278.  
  3279.  
  3280.  
  3281.  
  3282. ### OTHER COLORS - 45, 94
  3283. ### 52, 87 (bullish maybe)
  3284. ### 220, 0 (bearish/volatile maybe
  3285. ### 236, 16, dope color combo
  3286. ###197, 232, like a pink on black looks dope
  3287. ### 171,232
  3288. ### 122, 53
  3289. ### 190, 16
  3290. ### 159, 235
  3291. ###118, 234
  3292. ### 246, 237
  3293. ### 152, 233
  3294. ### I like 213 and 113 fg
  3295. ### 15, 161
  3296. ### 21, 85
  3297. ### 130, 120, like a pink on green, bullish
  3298. ### fg 152 is super nice
  3299. ###122 IDK 234
  3300. ###51 IDK 16
  3301. ### 0 IDK 155
  3302. ### 16 IDK 40
  3303. # 209 IDK 233
  3304. # 191 IDK 16 < Straight Yellow
  3305. # 119 IDK 232 < Straight green
  3306. # 143 IDK 246 <-- LIKE A DOPE YELLOW ON DARK GRAY/BLACK
  3307. # 236 IDK 160 <-- HELLA BEARISH BLACK ON RED
  3308. # 12 IDK 16 < ----- JUST STRAIGHT BLUE, MODEST, BULLISH BLUE
  3309.  
  3310. ### ABSOLUTE MAX CONFIDENCE , sneakR < 5, qratio <= 10, LFPC >= .002
  3311. ### QRATIO >= 150
  3312. ############## 11 / 06 /
  3313. ######09-20 13:03:00 | 0.093 12.28 132.043 -0.034 0.0034 1,240.75 | -0.66% | -0.55% | -0.43% | -0.32% | -0.7%
  3314.  
  3315. # 08-21 12:41:00 | 0.044 0.66 15.0 -0.006 0.0094 1,184.37 | 0.08% | 0.07% | 0.0% | -0.1% | 0.15%
Add Comment
Please, Sign In to add comment