Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/bash python
- import csv
- import datetime
- from datetime import datetime
- from colorama import Back, Fore, Style
- import sys
- from termcolor import colored, cprint
- from colorama import init
- import numbers
- import time
- import itertools
- from itertools import zip_longest
- from time import sleep
- import hashlib
- import statistics
- MIV_Spike_List = []
- MIV_Spike_Count = int()
- MIV_Spike = float()
- Avg_MIV_Spike = float()
- ShortPrice = float()
- LongPrice = float()
- ShortVolumeTotal = float()
- C_Price = float()
- S_Price = float()
- CoverLiquidity = float()
- ShortLiquidity = float()
- CoverCount = int()
- ShortCount = int()
- log = []
- lastFPrice = float()
- MP_List = []
- V_List = []
- count_M_items = int()
- count_V_items = int()
- V_Stdev = float()
- MP_Stdev = float()
- MV_Stdev = float()
- findPrice = float()
- CoverPrice = float()
- CoverVolumeTotal = float()
- CoverMoney = float()
- ShortMoney = float()
- TotalDiff = float()
- with open('/Users/King/data.csv', 'r') as csv_file:
- csv_reader = csv.reader(csv_file)
- header = next(csv_reader)
- ref = [] # Start off w/ empty list
- ref_Num = int(0) # First to go in list = ref # (390 cells in 1 day)(using ref+=1 for each row)
- data = [] # Not sure but I could rearrange for liquidity?
- Liquidity = float()
- found = int(0)
- Range = []
- Target = []
- filled = bool
- filled_Price = float()
- Range_List = {}
- Low_Range_Found = {}
- High_Range_Found = {}
- ht_filled = bool
- hr_filled = bool
- lr_filled = bool
- lt_filled = bool
- lows_found = int()
- highs_found = int()
- Tick = int()
- Range_Found = {}
- range_ref_String = ('')
- dTime = []
- printRanges = str()
- range_identifier_low = 'Low'
- range_identifier_high = 'High'
- range_identifier_all = 'All'
- All_Range_References = []
- All_Referenced_Prices = []
- menu_ans = input('What would you like to do? \n [1] Print Liquidity Data | [2] See previous ranges | [3] RangeTargets File | [4] No-Stop-Data-Add [5] Current Info\n')
- if menu_ans == '1':
- Liquidity_Data = input('Would you like to print liquidity data? [y/n]: ')
- if menu_ans == '2':
- printRanges = input('Which ranges would you like to see?: [High/Low/All]\n')
- if menu_ans == '4':
- NoStop = True
- CandleDur = input('Candle Duration: ')
- else:
- NoStop = False
- if menu_ans == '3':
- option3 = True
- range_identifier = ''
- new_range = bool
- t = bool
- tLow = bool
- tHigh = bool
- Target = float()
- Range_Dict = {}
- TickString = str()
- Tick_String = ''
- Strength = int()
- StartTraceback = {}
- day_Count = int()
- tList = []
- last = float()
- LT = float()
- HT = float()
- last = float()
- ATR = float()
- OC_ATR = float()
- Avg_ATR = float()
- TrendStrength = ''
- Previous = []
- allfoundallfilled = {}
- lowfilled = float()
- highfilled = float()
- rangefilled = bool
- low_Ranges_Filled = int()
- high_Ranges_Filled = int()
- high_Targets_Filled = int()
- low_Targets_Filled = int()
- prevVol = float(1)
- prevFlow = float(1)
- prevIndexValue = float(1)
- prevPrice = float(1)
- Status = str('')
- RangeTarget = float()
- rFound = bool
- count = int(0)
- PCT_Range_Str = ''
- sum_OC_Range = float()
- sum_HL_Range = float()
- sum_OHLC_Range = float()
- WarningString = ''
- sum_Liq = float()
- avg_Liq_change = float()
- HighRangeFlow = float()
- LowRangeFlow = float()
- LiqFlowPrice = float()
- LiqFlowPriceClone = float()
- EntryStr = str()
- OC_HL_RangePct = float()
- StrengthReference = float()
- AvgStrengthReference = float()
- counter = int()
- liqList = []
- PULQ = bool
- BuyVolume = float()
- BuyPower = float()
- ShortVolume = float()
- ShortPower = float()
- SellVolume = float()
- SellPower = float()
- BuySellRatio = float()
- Price1 = float()
- prevPrice1 = float()
- Last = float()
- gapDown = int()
- gapUp = int()
- prevMPrice = float()
- prevMPrice2 = float()
- prevPrice1 = float()
- lastMPrice = float()
- for row in csv_reader:
- range_ref_String = ''
- LRS = '$'
- LRT = '$'
- HRS = '$'
- HRT = '$'
- found_Price_String = '$'
- end_String = 'Price while found: $'
- # row = [Time, Open, Close, High, Low, realVol, Money_Flow]
- ref_Num += 1 # Starting at 0
- dTime = str(datetime.strptime(row[0], '%a %b %d %H:%M'))
- Time = dTime[-14:]
- Open_Price = float(row[1]) # Price Data Dictionary
- Close_Price = float(row[2]) # Price Data Dictionary
- High_Price = float(row[3]) # Price Data Dictionary
- Low_Price = float(row[4]) # Price Data Dictionary
- Money_Flow = float(row[6]) # Price Data Dictionary
- Vol = row[5] # Price Data Dictionary
- f_Vol = float(Vol[:-1]) # Price Data Dictionary
- m_Vol = str(Vol[-1:]) # Price Data Dictionary
- if m_Vol == "K": # Price Data Dictionary
- f_Vol = f_Vol * 1000 # Price Data Dictionary
- if m_Vol == "M": # Price Data Dictionary
- f_Vol = f_Vol * 1000000
- if m_Vol != "K" and m_Vol != "M":
- f_Vol = float(row[5]) # Price Data Dictionary
- if f_Vol < 1:
- M_Price = HLCC
- else:
- M_Price = round(float(Money_Flow) / f_Vol, 2)
- HLCC = float(High_Price + Low_Price + Close_Price + Close_Price)/4 # Price Data Dictionary & RangeReference Dictionary # Price Data Dictionary & RangeReference Dictionary
- Diff = round(HLCC - M_Price, 2)
- findDiff = round(M_Price - Close_Price, 2)
- TotalDiff += findDiff
- PivotPrice = round(Close_Price + TotalDiff, 2)
- if PivotPrice > Close_Price + .35:
- PivotStr = Fore.CYAN+str(PivotPrice)
- if PivotPrice < Close_Price - .35:
- PivotStr = Fore.RED+str(PivotPrice)
- if abs(PivotPrice - Close_Price) < .35:
- PivotStr = Fore.YELLOW+str(PivotPrice) # Price Data Dictionary & RangeReference Dictionary & Data Dictionary
- MMM = float(f_Vol * HLCC) # Price Data Dictionary & RangeReference Dictionary & Data Dictionary
- Liq_change = float(Money_Flow - MMM) # Price Data Dictionary & RangeReference Dictionary & Data Dictionary
- Liquidity += Liq_change # Price Data Dictionary & RangeReference Dictionary & Data Dictionary
- Date = str(Time[:5]) # Important
- military_time = str(Time[-8:])
- criteria = abs(.003*HLCC)
- hashTime = hashlib.md5(str.encode(military_time))
- Liq_Tick = int()
- Price_Tick = int()
- tREF = int()
- rFound = False
- OC_Range = abs(Close_Price - Open_Price)
- HL_Range = abs(High_Price - Low_Price)
- sum_OC_Range += OC_Range
- sum_HL_Range += HL_Range
- sum_Liq += abs(Liq_change)
- liqList.append(sum_Liq)
- avg_HL_Range = float()
- avg_OC_Range = float()
- abs_Liq = abs(Liq_change)
- prevLiq = float()
- MP_List.append(Money_Flow)
- V_List.append(f_Vol)
- for i in MP_List:
- count_M_items += 1
- for i in V_List:
- count_V_items += 1
- if count_M_items >= 2:
- MP_Stdev = statistics.stdev(MP_List[-2:])
- MP_List.pop(0)
- if count_V_items >= 2:
- V_Stdev = statistics.stdev(V_List[-2:])
- V_List.pop(0)
- if count_M_items >= 1 and count_M_items >= 1:
- if V_Stdev >= 1:
- MV_Stdev = 100*round(MP_Stdev / V_Stdev, 2)
- findPrice = MV_Stdev / 100
- if ref_Num >=2:
- prevPrice1 = Close_Price
- prevMPrice = M_Price
- prevFPrice = findPrice
- if ref_Num % 2 != 0:
- Price1 = Close_Price
- prevMPrice1 = M_Price
- prevFPrice1 = findPrice
- if ref_Num % 2 == 0:
- Price2 = Close_Price
- prevMPrice2 = M_Price
- prevFPrice2 = findPrice
- if ref_Num % 2 != 0 and ref_Num > 2:
- Last = Price2
- lastMPrice = prevMPrice2
- lastFPrice = prevFPrice2
- if ref_Num % 2 == 0 and ref_Num >= 2:
- Last = Price1
- lastMPrice = prevMPrice1
- lastFPrice = prevFPrice1
- percent_Strength = Strength / ref_Num
- allData = [ref_Num,Date, military_time, High_Price,Low_Price,Close_Price, HLCC, M_Price, f_Vol, Money_Flow,MMM, Liquidity,Liq_change]
- Data_Dict = {'REF#':[ref_Num],'Date':[Date],'Time':[military_time], 'Close_Price':[Close_Price], 'M_Price':[M_Price], 'Volume':[f_Vol]}
- '''USING THIS DATA
- [0]REFERENCE NUMBER
- [1]DATE
- [2]MILITARY_TIME
- [3]HIGH_PRICE
- [4]LOW_PRICE
- [5]CLOSE_PRICE
- [6]HLCC
- [7]M_Price
- [8]F_VOL
- [9]MONEY_FLOW
- [10]MARKETMAKERMOVE 'MMM'
- [11]LIQUIDITY
- [12]LIQ_CHANGE
- '''
- if abs(allData[7]-allData[6]) >= criteria:
- diff = abs(M_Price - Close_Price)
- Range_Clause = True
- range_identifier_all = 'All'
- else:
- Range_Clause = False
- if Range_Clause == True:
- r_price = M_Price
- found_Price = HLCC
- Low_Range = round(HLCC - abs(float(M_Price - HLCC)), 2)
- High_Range = round(HLCC + abs(float(M_Price - HLCC)), 2)
- Low_Target = round(Low_Range - abs(float(M_Price - HLCC)), 2)
- High_Target = round(High_Range + abs(float(M_Price - HLCC)), 2)
- RT_Reference1 = [Low_Range, High_Range, Low_Target, High_Target]
- LRS = '$' + str(Low_Range)
- LRT = '$' + str(Low_Target)
- HRS = '$' + str(High_Range)
- HRT = '$' + str(High_Target)
- found_Price_String = '$' + str(found_Price)
- RT_Reference = [LRS, LRT, HRS, HRT]
- lows = [LRS, LRT]
- highs = [HRS, HRT]
- range_ref_String = range_ref_String
- target_String = range_ref_String + ': $'
- end_String = 'Price while found: $' + str(Close_Price)
- Target_String = '$' + str(Target)
- LiqFlowPrice = .01*round(Money_Flow / abs(Liq_change), 3)
- VolLiqPrice = round(f_Vol / abs(Liq_change), 2)
- LiqFlowPriceClone = round(1000 * (abs(Liq_change) / Money_Flow), 4) * .01
- if M_Price >= High_Range:
- found += 1
- range_ref_String = "HIGH TARGET"
- tHigh = True
- RangeTarget = High_Target
- Target = M_Price
- range_identifier = 'High'
- found_Price = HLCC
- range_identifier_all = 'All'
- thList = ['HIGH TARGET', High_Target, highfilled]
- filled = False
- ht_filled = False
- hr_filled = False
- highs_found += 1
- rFound = True
- HighRangeFlow += Money_Flow
- elif M_Price<= Low_Range:
- found += 1
- range_ref_String = "LOW TARGET"
- tLow = True
- RangeTarget = Low_Target
- Target = M_Price
- range_identifier = 'Low'
- range_identifier_all = 'All'
- found_Price = HLCC
- tlList = ['LOW TARGET', Low_Target, lowfilled]
- filled = False
- lt_filled = False
- lr_filled = False
- lows_found += 1
- rFound = True
- LowRangeFlow += Money_Flow
- if lows_found > 0:
- AvgLowRangeFlow = LowRangeFlow / lows_found
- if highs_found > 0:
- AvgHighRangeFlow = HighRangeFlow / highs_found
- if printRanges == range_identifier and range_identifier == range_identifier_low:
- Low_Range_Reference = [Date, military_time, range_ref_String, Target_String, end_String]
- Low_Range_Found = {'\nData Found':Low_Range_Reference, 'Watch for: $':lows, 'Potential Resistance: ':highs}
- Low_Range = Low_Range_Found
- for k, v in dict.items(Low_Range):
- print(Fore.RED, k, v)
- if printRanges == range_identifier and range_identifier == range_identifier_high:
- High_Range_Reference = [Date, military_time, range_ref_String, end_String]
- High_Range_Found = {'\nData Found': High_Range_Reference, 'Watch for: $':highs, 'Potential Support: ':lows}
- High_Range = High_Range_Found
- for k, v in dict.items(High_Range):
- print(Fore.CYAN, k, v)
- elif printRanges == range_identifier_all:
- if range_ref_String == 'LOW TARGET' or range_ref_String == 'HIGH TARGET':
- money_string = '$'
- Target_String = '$' + str(Target)
- Close_Price_String = money_string+str(Close_Price)
- Range_Reference = [Date, military_time, Close_Price_String, range_ref_String, Target_String]
- Low_Ranges = [LRS, LRT]
- High_Ranges = [HRS, HRT]
- Range_Found = {'<-- Reference':Range_Reference, 'Low Ranges':Low_Ranges, 'High Ranges':High_Ranges, 'REF#':ref_Num}
- Range_List[ref_Num] = Range_Found
- text = colored(str(found)+' '+str(Range_Found), 'cyan', 'on_grey', attrs=['reverse'])
- cprint(text)
- '''if Range_Clause == True:
- if range_ref_String == "HIGH TARGET" and Money_Flow < 300000000:
- print("MARKET MAKER HIGH TARGET")
- if range_ref_String == "LOW TARGET" and Money_Flow > 300000000:
- print("MARKET MAKER LOW TARGET")'''
- else:
- Range_Clause = False
- tHigh = False
- tLow = False
- rFound = False
- if menu_ans == '1' and Liquidity_Data == 'y':
- avg_HL_Range = sum_HL_Range / ref_Num
- avg_OC_Range = sum_OC_Range / ref_Num
- avg_Liq_change = sum_Liq / ref_Num
- if Money_Flow > 0:
- MIV_Index = round(100 * (f_Vol / prevVol) - 100 * ((Money_Flow * HLCC) / (prevFlow * prevPrice)), 3)
- runningValueIndex = round(MIV_Index + prevIndexValue, 3)
- prevPrice = Close_Price
- prevFlow = Money_Flow
- prevVol = f_Vol
- prevIndexValue = MIV_Index
- MIV_Index_String = str(MIV_Index)
- runningValueIndex_String = str(runningValueIndex)
- MIV_Index_String = str(round(MIV_Index, 2))
- if abs(Liq_change) > 0:
- LFP = round(Money_Flow / abs(Liq_change) *.01, 3)
- LFPC = round(10000 * (abs(Liq_change) / Money_Flow) * .01, 4)
- if LFP < 13 and LFPC < .085:
- LFP_WarningStr = 'FKN SELL THIS SHIT SON %s' % LFP
- LFP_WarningStr_clr = colored(LFP_WarningStr, 'red', attrs=['bold','blink'])
- # print(LFP_WarningStr_clr)
- if LFP < 20 and LFP > 13:
- LFP_WarningStr = 'FKN BUY THIS SHIT SON %s' % LFP
- LFP_WarningStr_clr = colored(LFP_WarningStr, 'cyan', attrs=['bold','blink'])
- # print(LFP_WarningStr_clr)
- if abs(MIV_Index) >= .25 and ref_Num > 1:
- MIV_Spike += abs(MIV_Index)
- MIV_Spike_Count += 1
- MIV_Spike_List.append(abs(MIV_Index))
- Avg_MIV_Spike = round(MIV_Spike / MIV_Spike_Count, 3)
- if abs(MIV_Index) >= .25 and ref_Num > 1:
- Avg_MIV_Spike_String = str(Avg_MIV_Spike)
- if MIV_Index > 0:
- MIV_Index_String = str(round(MIV_Index, 2))
- 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)
- elif MIV_Index < 0:
- MIV_Index_String = str(round(MIV_Index, 2))
- 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)
- if Close_Price >= Open_Price and Liq_change > 0:
- Price_Tick = 1
- Liq_Tick = 1
- BuyVolume += f_Vol
- BuyPower += Liq_change
- SellPower += Liq_change * -1
- if Liquidity < 0:
- ShortPower += Liq_change*-1
- PULQ = False
- elif Close_Price >= Open_Price and Liq_change < 0:
- Price_Tick = 0
- Liq_Tick = -1
- ShortVolume += f_Vol
- BuyVolume += Liq_change * -1
- ShortPower += Liq_change * -1
- ShortVolumeTotal += f_Vol
- ShortMoney += Money_Flow
- ShortCount += 1
- ShortLiquidity += abs(Liq_change)
- S_Price += HLCC
- PULQ = True
- elif Close_Price <= Open_Price and Liq_change > 0:
- Price_Tick = -1
- Liq_Tick = 0
- ShortPower += Liq_change
- BuyPower += Liq_change
- SellPower += Liq_change
- CoverVolumeTotal += f_Vol
- CoverMoney += Money_Flow
- CoverCount += 1
- CoverLiquidity += Liq_change
- C_Price += HLCC
- PULQ = False
- elif Close_Price <= Open_Price and Liq_change < 0:
- Price_Tick = -1
- Liq_Tick = -1
- SellVolume += f_Vol
- SellPower += abs(Liq_change)
- BuyPower += Liq_change
- PULQ = False
- Tick = Liq_Tick + Price_Tick
- Strength += Tick
- percent_Strength = round(Strength / ref_Num, 4)
- new_Strength = round(100-(100*abs(percent_Strength- -.3153) / .8794), 2)
- SS = str(new_Strength)
- abs_Liq = abs(Liq_change)
- counter += 1
- if ShortCount >= 1:
- ShortPrice = round(S_Price / ShortCount, 2)
- if CoverCount >= 1:
- CoverPrice = round(C_Price / CoverCount, 2)
- if ref_Num < 10:
- AvgStrengthReference += new_Strength
- if ref_Num == 20:
- AvgStrengthReference = StrengthReference / ref_Num
- StrengthReference = AvgStrengthReference
- counter = 1
- if ref_Num >= 20:
- counter += 1
- AvgStrengthReference = AvgStrengthReference + new_Strength
- if counter < 20 and counter >= 1:
- AvgStrengthReference = AvgStrengthReference / counter
- StrengthReference = (AvgStrengthReference + new_Strength) / counter
- if counter == 20:
- counter = counter * 0
- AvgStrengthReference = AvgStrengthReference * 0 + StrengthReference
- StrengthReference = StrengthReference
- if M_Price == lastMPrice:
- WarningString = '!!!'
- if OC_Range >= avg_HL_Range:
- if Liq_change > avg_Liq_change:
- if Close_Price > Open_Price:
- WarningString = Fore.CYAN+'[xxx]'+Style.RESET_ALL
- if Close_Price < Open_Price:
- WarningString = Fore.RED+'[xxx]'+Style.RESET_ALL
- else:
- WarningString = Fore.YELLOW+'[xxx]'
- else:
- WarningString = ''
- if PULQ == True and OC_Range <= avg_OC_Range *.3:
- if abs(Liq_change) < 500 and Liq_change < 0:
- if abs(Liq_change) < avg_Liq_change * .05:
- WarningString = '[*]'
- else:
- WarningString = ''
- OC_RangePct = round(OC_Range / avg_OC_Range * 100, 2)
- HL_RangePct = round(HL_Range / avg_HL_Range * 100, 2)
- if abs(OC_Range) > 0 and abs(HL_Range) > 0:
- RangePct = round(OC_Range / (HL_Range / avg_HL_Range) * 1000, 4)
- OCHL_RangePct = round(OC_Range / HL_Range * 100, 4)
- OC_HL_RangePctStr = str(OC_HL_RangePct)+'%'
- OCHL_RangePctStr = str(OC_HL_RangePct)+'%'
- else:
- OCHL_RangePctStr = ''
- OC_HL_RangePctStr = ''
- if M_Price == lastMPrice and OC_Range < avg_OC_Range:
- if abs(Liq_change) > avg_Liq_change * .5 or abs(Liq_change) > 1000:
- if Liquidity > 0:
- if OC_HL_RangePct < 10:
- if Close_Price < M_Price and last < lastMPrice:
- Tick_String = Fore.BLUE+Style.BRIGHT+Back.WHITE+'BULLISH ACCUMULATION'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
- if Close_Price >= M_Price:
- if lastMPrice >= lastMPrice or Close_Price == last:
- Tick_String = Fore.YELLOW+Style.BRIGHT+'BEARISH INV SHIFT'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
- elif OC_HL_RangePct > 30:
- if Liq_change > 0 and Liq_change < 1000:
- Tick_String = Fore.YELLOW+Style.BRIGHT+Back.BLUE+'BREAKDOWN POTENTIAL'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
- elif Liq_change < 0:
- Tick_String = Style.BRIGHT+Back.CYAN+'BREAKOUT POTENTIAL'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
- if Liquidity < 0:
- Tick_String = Fore.RED+'SHORT COVERING (TOP)'+Style.RESET_ALL+WarningString+' '
- elif OC_HL_RangePct < 10:
- if Liq_change > 100:
- Tick_String = Style.BRIGHT+Fore.BLUE+Back.YELLOW+'BOTTOM FEEDERS'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
- if abs(Liq_change) < 100:
- if HL_RangePct < 50:
- Tick_String = Fore.YELLOW+Style.BRIGHT+Back.RED+'LARGE DISTRIBUTION'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
- if HL_RangePct > 50:
- Tick_String = Fore.BLUE+Style.BRIGHT+Back.CYAN+'MASSIVE ACCUMULATION'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
- elif abs(Liq_change) < avg_Liq_change * .2 and abs(Liq_change) < 1000:
- if HL_RangePct >= 100 and OC_RangePct < 10:
- if OC_HL_RangePct > 50:
- if Close_Price == Last:
- Tick_String = Fore.RED+Style.BRIGHT+Back.YELLOW+'LARGE DISTRIBUTION'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
- elif HL_Range >= 100 and Close_Price > lastMPrice:
- Tick_String = Fore.BLUE+Style.BRIGHT+Back.WHITE+'LARGE ACCUMULATION'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
- elif HL_RangePct > 50 and OC_RangePct > 50:
- if Liquidity < 0:
- Tick_String = Fore.WHITE+Back.RED+'POTENTIAL SQUEEZE'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
- if Liquidity > 0:
- if Close_Price < lastMPrice:
- Tick_String = Fore.CYAN+Back.BLUE+'HIDDEN BUYERS'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
- if Close_Price > lastMPrice:
- Tick_String = Fore.BLUE+Back.WHITE+Style.DIM+'HIDDEN SELLERS'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
- else:
- if Close_Price >= M_Price and last >= lastMPrice:
- Tick_String = Fore.RED+Back.WHITE+Style.BRIGHT+'BEARS RUN IT'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
- if Close_Price < M_Price and last < lastMPrice:
- Tick_String = Fore.CYAN+Back.BLUE+'BULLS RUN IT'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
- if M_Price == lastMPrice and Tick == -1:
- if OC_Range >= avg_HL_Range and Liq_Tick == -1:
- Tick_String = Fore.RED+Back.YELLOW+Style.BRIGHT+'GET THE FUCK OUT'+Style.RESET_ALL+WarningString+' OC / HL [%s] HL PCTile[%s] ' % (OCHL_RangePctStr, HL_RangePct)
- elif M_Price == lastMPrice:
- if LFP <= 10:
- if LFP < 1:
- Tick_String = 'DIP COMING'+Style.RESET_ALL+WarningString+' %s' % LFP
- elif LFP > 1:
- Tick_String = Style.BRIGHT+'BUY THE SHIT'+Style.RESET_ALL+WarningString+' %s' % LFP
- elif LFP > 70:
- Tick_String = Fore.WHITE+Style.BRIGHT+'REVERSAL'+Style.RESET_ALL+WarningString+' %s' % LFP
- elif LFP <= 20 and LFP >= 10:
- Tick_String = Fore.RED+Style.BRIGHT+'SELL THE SHIT'+Style.RESET_ALL+WarningString+' %s' % LFP
- else:
- if Liq_change > 0:
- Tick_String = Fore.RED+Style.BRIGHT+Back.WHITE+'BEARISH DISTRIBUTION'+Style.RESET_ALL+WarningString+' %s' % LFP
- if Liq_change < 0:
- Tick_String = Fore.BLUE+Style.BRIGHT+Back.WHITE+'BULLISH DISTRIBUTION'+Style.RESET_ALL+WarningString+' %s' % LFP
- else:
- if Tick == 2:
- if abs_Liq >= avg_Liq_change*1.5:
- if Liquidity > 0:
- Tick_String = Fore.GREEN+Style.BRIGHT+'AGGRESSIVE BUYERS'+Style.RESET_ALL+WarningString+' '
- else:
- Tick_String = Fore.GREEN+Back.RED+Style.BRIGHT+'BEARISH BUYING'+Style.RESET_ALL+WarningString+' '
- elif abs_Liq >= avg_Liq_change:
- Tick_String = Fore.GREEN+Style.BRIGHT+'STRONG BUYERS'+Style.RESET_ALL+WarningString+' '
- else:
- Tick_String = Fore.BLUE+Back.GREEN+'UPTICK'+Style.RESET_ALL+WarningString+' '
- if Tick == -1 and Price_Tick == 0:
- if Liq_Tick == -1:
- if abs(Liq_change) < 300 and OC_Range <= avg_OC_Range *.3:
- if WarningString == '[*]':
- if new_Strength < 60:
- Tick_String = Fore.RED+Style.BRIGHT+Back.YELLOW+'<SELL ENTRY>'+Style.RESET_ALL+WarningString+' '
- if new_Strength > 60 or StrengthReference >= 65:
- Tick_String = Fore.BLUE+Style.BRIGHT+Back.YELLOW+'<BUY ENTRY>'+Style.RESET_ALL+WarningString+' '
- # if WarningString == '':
- # Tick_String = Fore.BLUE+Style.BRIGHT+Back.YELLOW+'<BUY ENTRY>'+Style.RESET_ALL+WarningString+' '
- #
- elif WarningString == '':
- if new_Strength < 50 and new_Strength > 20:
- Tick_String = Fore.YELLOW+Style.BRIGHT+'BREAKDOWN'+Style.RESET_ALL+WarningString+' '
- elif new_Strength < StrengthReference and StrengthReference < 65:
- Tick_String = Fore.YELLOW+Style.BRIGHT+'BREAKDOWN'+Style.RESET_ALL+WarningString+' '
- elif new_Strength > 90:
- Tick_String = Fore.YELLOW+Style.BRIGHT+'BREAKDOWN'+Style.RESET_ALL+WarningString+' '
- elif new_Strength >= StrengthReference or StrengthReference >= 65:
- Tick_String = Fore.CYAN+Style.BRIGHT+'BREAKOUT'+Style.RESET_ALL+WarningString+' '
- elif new_Strength <= 20:
- Tick_String = Fore.CYAN+Style.BRIGHT+'BREAKOUT'+Style.RESET_ALL+WarningString+' '
- elif abs(Liq_change) < 300 and avg_Liq_change * .05:
- if WarningString == '[*]':
- if new_Strength > StrengthReference:
- Tick_String = Fore.WHITE+Style.BRIGHT+Back.BLUE+'<VOLATILITY COMING (UPSIDE)>'+Style.RESET_ALL+WarningString+' '
- if new_Strength < StrengthReference:
- Tick_String = Fore.WHITE+Style.BRIGHT+Back.RED+'<VOLATILITY COMING (DOWNSIDE)>'+Style.RESET_ALL+WarningString+' '
- else:
- Tick_String = Fore.RED+Style.BRIGHT+Back.YELLOW+'<VOLATILITY COMING>'+Style.RESET_ALL+WarningString+' '
- else:
- Tick_String = Fore.WHITE+'PRICE UP LIQ DOWN'+Style.RESET_ALL+WarningString+' '
- if Tick == -2:
- if abs_Liq < avg_Liq_change:
- Tick_String = Fore.BLUE+'PROFIT TAKING'+Style.RESET_ALL+WarningString+' '
- if abs_Liq > avg_Liq_change*.75:
- Tick_String = Fore.RED+Style.BRIGHT+'STRONG SELLERS'+Style.RESET_ALL+WarningString+' '
- if Tick == -1 and Liq_Tick == 0:
- prevLiq = Liquidity - Liq_change
- if abs_Liq >= avg_Liq_change*.8 and prevLiq < 0:
- Tick_String = Fore.RED+Style.BRIGHT+'AGGRESSIVE COVERING'+Style.RESET_ALL+WarningString+' '
- if OC_Range >= avg_HL_Range*.9 and abs_Liq < avg_Liq_change*.75:
- Tick_String = Fore.RED+Style.BRIGHT+'MM\'s BEARISH'+WarningString+' '
- elif abs_Liq < avg_Liq_change*.25 and OC_Range < avg_HL_Range:
- Tick_String = Fore.YELLOW+'DIP BUYERS'+Style.RESET_ALL+WarningString+' '
- else:
- Tick_String = Fore.CYAN+'PRICE DOWN LIQ UP'+Style.RESET_ALL+WarningString+' '
- Range_List[ref_Num] = Range_Found
- # else:
- # Tick_String = Fore.WHITE+'PRICE UP LIQ DOWN'+Style.RESET_ALL+WarningString+' '+Fore.WHITE+str(Strength)
- # if abs(Liq_change) <= avg_Liq_change:
- # Tick_String = Fore.RED+'SHORT RALLY'+Style.RESET_ALL+WarningString+' '+Fore.RED+str(Strength)
- # # else:
- # Tick_String = Fore.WHITE+'PRICE UP LIQ DOWN'+Style.RESET_ALL+WarningString+' '+Fore.WHITE+str(Strength)
- # if Tick == -1 and Liq_Tick == 0:
- # if Liquidity < 0:
- # if abs(Liq_change) > avg_Liq_change*2:
- # Tick_String = Fore.RED+'MM\'s BEARISH'+Style.RESET_ALL+WarningString+' '+Fore.YELLOW+str(Strength)
- # else:
- # Tick_String = Fore.RED+'SHORT COVERING'+Style.RESET_ALL+WarningString+' '+Fore.YELLOW+Back.BLUE+Style.BRIGHT+str(Strength)
- Range_List[ref_Num] = Range_Found
- else:
- if Range_Clause == True:
- if range_ref_String == "HIGH TARGET" and Money_Flow < 300000000:
- if Liq_change > 1000000:
- print("MARKET MAKER HIGH TARGET")
- if range_ref_String == "LOW TARGET" and Money_Flow > 300000000:
- if Liq_change < 1000000:
- print("MARKET MAKER LOW TARGET")
- if lr_filled == False:
- if filled == False:
- if range_ref_String == "LOW TARGET" and Low_Price <= Low_Range:
- filled_Price = Low_Price
- time.sleep(.5)
- print(Fore.WHITE + Back.RED + "LOW RANGE FILLED" + Style.RESET_ALL)
- time.sleep(1)
- lr_filled = True
- lt_filled = False
- lrf = 1
- low_Ranges_Filled += lrf
- if lt_filled == False and lr_filled == True:
- if Close_Price <= Low_Target:
- filled_target_price = Close_Price
- time.sleep(.5)
- print(Fore.RED + Back.YELLOW + 'LOW TARGET FILLED' + Style.RESET_ALL)
- time.sleep(1)
- lt_filled = True
- filled = True
- low_Targets_Filled += 1
- if hr_filled == False:
- if filled == False:
- if range_ref_String == "HIGH TARGET" and High_Price >= High_Range:
- filled_range_price = High_Price
- time.sleep(.5)
- print(Fore.CYAN + "HIGH RANGE FILLED" + Style.RESET_ALL)
- time.sleep(1)
- hr_filled = True
- ht_filled = False
- hrf = 1
- high_Ranges_Filled += hrf
- if ht_filled == False and hr_filled == True:
- if Close_Price >= High_Target:
- filled_target_price = High_Price
- print(Fore.CYAN + "HIGH TARGET FILLED")
- time.sleep(1)
- ht_filled = True
- filled = True
- high_Targets_Filled += 1
- if menu_ans == '4' or menu_ans == '1':
- if rFound == True:
- if tHigh == True:
- HRS = str(High_Range)
- HRT = str(High_Target)
- LRS = str(Low_Range)
- LRT = str(Low_Target)
- MIV_Index_String = str(MIV_Index)
- print(Fore.YELLOW+'['+Date+']',military_time,Style.RESET_ALL+Fore.BLUE+Back.YELLOW+Style.BRIGHT+'Current Liquidity:'+'{:20,.2f}'.format(Liquidity)+Style.RESET_ALL+Fore.BLUE+Back.YELLOW+Style.BRIGHT+' Liq Change: '+'{:20,.2f}'.format(Liq_change)+Style.RESET_ALL, Fore.YELLOW+Back.BLUE+Style.BRIGHT,'Last Price: [$'+str(Close_Price)+'] '+Style.RESET_ALL+Tick_String+Style.RESET_ALL+Fore.GREEN+Back.BLUE+Style.BRIGHT+' NEW HIGH RANGE FOUND:[$'+HRS+']'+' NEW HIGH TARGET FOUND: [$'+HRT+']'+Fore.WHITE+' '+MIV_Index_String+'%'+Style.RESET_ALL+Fore.CYAN+' Avg High Flow: $'+'{:20,.2f}'.format(AvgHighRangeFlow), 'MoneyFlow: $','{:20,.2f}'.format(Money_Flow)+Style.RESET_ALL+Fore.WHITE+'Volume: '+'{:20,.2f}'.format(f_Vol))
- time.sleep(2)
- else:
- tHigh = False
- else:
- rFound = False
- Close_Price = Close_Price
- if rFound == True:
- if tLow == True:
- HRS = str(High_Range)
- HRT = str(High_Target)
- LRS = str(Low_Range)
- LRT = str(Low_Target)
- lowFlow = str(AvgLowRangeFlow)
- flow = str(Money_Flow)
- MIV_Index_String = str(MIV_Index)
- Low_Prices = {'LOW RANGE: $': Low_Range, 'LOW TARGET: $': Low_Target} ##### May not need this line
- print(Fore.YELLOW+'['+Date+']',military_time,Style.RESET_ALL+Fore.CYAN+Back.RED+Style.BRIGHT+'Current Liquidity:'+'{:20,.2f}'.format(Liquidity)+Style.RESET_ALL+Fore.CYAN+Back.RED+Style.BRIGHT+' Liq Change: '+'{:20,.2f}'.format(Liq_change)+Style.RESET_ALL, Fore.YELLOW+Back.BLUE+Style.BRIGHT,'Last Price: [$'+str(Close_Price)+'] '+Style.RESET_ALL+Tick_String+Style.RESET_ALL+Fore.CYAN+Back.RED+Style.BRIGHT+' NEW LOW RANGE FOUND:[$'+LRS+']'+' NEW LOW TARGET FOUND: [$'+LRT+']'+Fore.WHITE+' '+MIV_Index_String+'%'+Style.RESET_ALL+Fore.RED+' Avg Low Flow: $','{:20,.2f}'.format(AvgLowRangeFlow),'MoneyFlow: $','{:20,.2f}'.format(Money_Flow)+Style.RESET_ALL+Fore.WHITE+'Volume: '+'{:20,.2f}'.format(f_Vol))
- time.sleep(2)
- else:
- tLow = False
- else:
- rFound = False
- if Liq_change < -1000000:
- print(Fore.YELLOW + '[' + Date + ']', military_time,PCT_Range_Str,Style.RESET_ALL + Fore.CYAN + Back.RED + Style.BRIGHT + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL + Fore.YELLOW + Back.RED + Style.BRIGHT + ' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + Style.RESET_ALL, Fore.YELLOW + Back.RED + Style.BRIGHT,'Last Price: [$' + str(Close_Price) + '] ' + Style.RESET_ALL + Tick_String + Style.RESET_ALL + Fore.YELLOW + Back.RED + Style.BRIGHT + '**SELL SIGNAL**' + Style.RESET_ALL, M_Price)
- time.sleep(1)
- if abs(Liq_change) > 500000:
- time.sleep(.005)
- print(Fore.CYAN + '[' + Date + ']', military_time,PCT_Range_Str,Fore.CYAN + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL + Fore.YELLOW + Back.BLUE + Style.BRIGHT + ' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + ' ' + Fore.YELLOW + Back.BLUE,'Last Price [$' + str(Close_Price) + '] ' + Tick_String + Style.RESET_ALL + ' ' + Fore.WHITE+SS+'%'+Style.RESET_ALL, M_Price, PivotStr)
- elif Liquidity > 0:
- if Liq_change > 0:
- time.sleep(.005)
- 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) + ' ' + Fore.YELLOW + Back.BLUE,'Last Price [$' + str(Close_Price) + '] ' + Style.RESET_ALL+ Tick_String + Style.RESET_ALL+Fore.WHITE+' '+SS+'%'+Style.RESET_ALL, M_Price, PivotStr)
- if Liq_change < 0:
- time.sleep(.005)
- 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 + ' ' + Fore.YELLOW + Back.BLUE,'Last Price [$' + str(Close_Price) + '] ' + Style.RESET_ALL+ Tick_String + Style.RESET_ALL+Fore.WHITE+' '+SS+'%'+Style.RESET_ALL, M_Price, PivotStr)
- elif Liq_change > 0:
- time.sleep(.005)
- print(Fore.YELLOW + '[' + Date + ']', military_time,PCT_Range_Str,Fore.BLUE + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL + Fore.WHITE,' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + ' ' + Fore.YELLOW + Back.BLUE,'Last Price [$' + str(Close_Price) + '] ' +Style.RESET_ALL + Tick_String + Style.RESET_ALL + ' ' + Fore.WHITE+SS+'%'+Style.RESET_ALL, M_Price, PivotStr)
- elif Liq_change < 0:
- time.sleep(.005)
- print(Fore.YELLOW + '[' + Date + ']', military_time,PCT_Range_Str,Fore.BLUE + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL + Fore.CYAN,' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + ' ' + Fore.YELLOW + Back.BLUE+'Last Price [$' + str(Close_Price) + '] ' +Style.RESET_ALL + Tick_String+ Style.RESET_ALL + ' ' + Fore.WHITE+SS+'%'+Style.RESET_ALL, M_Price, PivotStr)
- '''if runningValueIndex > 0 and MIV_Index > 0:
- print(' '+Fore.BLACK+Back.WHITE+'MIV_Index:+'+MIV_Index_String+'% '+Style.RESET_ALL+' '+Fore.BLACK+Back.GREEN+'Running Value:+'+runningValueIndex_String+'%'+Style.RESET_ALL)
- if MIV_Index < 0 and runningValueIndex > 0:
- print(' '+Fore.RED+Back.YELLOW+'MIV_Index:'+MIV_Index_String+'% '+Style.RESET_ALL+' '+Fore.BLACK+Back.GREEN+'Running Value:+'+runningValueIndex_String+'%'+Style.RESET_ALL)
- if MIV_Index > 0 and runningValueIndex < 0:
- print(' '+Fore.WHITE+'MIV_Index:+'+MIV_Index_String+'% '+Style.RESET_ALL+' '+Fore.RED+Back.YELLOW+'Running Value:'+runningValueIndex_String+'%'+Style.RESET_ALL)
- if MIV_Index < 0 and runningValueIndex < 0:
- print(' '+Fore.RED+'MIV_Index:'+MIV_Index_String+'% '+Style.RESET_ALL+' '+Fore.RED+'Running Value:'+runningValueIndex_String+'%'+Style.RESET_ALL)'''
- '''else:
- runningValueIndex += MIV_Index
- runningValueIndex_String = str(round(runningValueIndex, 2))
- if runningValueIndex > 0:
- print(Fore.GREEN+'MIV_Index: '+runningValueIndex_String, '%')
- else:
- runningValueIndex_String = str(round(runningValueIndex, 2))
- print(Fore.RED+'MIV_Index: '+runningValueIndex_String, '%')'''
- if menu_ans == '3':
- printRangeFile = input('Would you like to see other found ranges?: [y/n]')
- if printRangeFile == 'y':
- file_Choose = input('Which file would you like to use? [1 = 1 min Ranges] [2 = 2 min ranges] [5 = 5 min ranges]: ')
- if file_Choose == '1':
- filename = ('/Users/King/iFiles/iRanges/SPY1.csv')
- if file_Choose == '2':
- filename = ('/Users/King/iFiles/iRanges/SPY2.csv')
- if file_Choose == '5':
- filename = ('/Users/King/iFiles/iRanges/SPY5.csv')
- with open(filename, 'r') as csv_file:
- csv_reader = csv.reader(csv_file)
- for row in csv_reader:
- Date = row[0]
- Time = row[1]
- range_ref_String = row[2]
- Close_Price = float(row[3])
- M_Price = float(row[4])
- TargetPrice = row[5]
- Money_Flow = float(row[6])
- f_Vol = float(row[7])
- OppRange = row[8]
- OppTarget = row[9]
- Liquidity = float(row[10])
- Liq_change = float(row[11])
- LFP = float(row[12])
- MIVI = float(row[13])
- ref_Num = int(row[15])
- CandleDuration = str(row[14])
- list = [Date, Time, range_ref_String]
- Targets = [M_Price, TargetPrice]
- MIV_Index = str(MIVI) + str('%')
- LFP = str(round(LFP, 3))
- oppositePrices = [OppRange, OppTarget]
- Liq_change_String = str('$' + '{:20,.2f}'.format(Liq_change))
- listlist = []
- dict = {'': list, 'Targets: ':Targets, 'Found price: ':Close_Price,'Opposite Ranges/Targets':oppositePrices}
- range_info = {'MIV Index:': MIV_Index, 'Liq Change:':Liq_change_String,'Candle Duration:':CandleDuration, 'REF#':ref_Num}
- if MIVI < 0 and Liq_change > 0:
- infotext = colored(str(range_info), 'grey', 'on_cyan', attrs=['reverse', 'underline'])
- else:
- infotext = colored(str(range_info), 'grey', 'on_red', attrs=['reverse', 'underline'])
- for k, v in dict.items():
- time.sleep(.001)
- print(Fore.YELLOW, k, v)
- cprint(infotext)
- print('\n')
- break
- print('MIV Spike Count: ',MIV_Spike_Count)
- print('Avg MIV Spike',Avg_MIV_Spike,'%')
- print(Fore.CYAN + 'REF#:', ref_Num)
- time.sleep(.25)
- print(Fore.WHITE + Time)
- time.sleep(.25)
- print("Last:", "$" + str(Close_Price))
- time.sleep(.25)
- print("HLCC:", "$" + str(HLCC))
- time.sleep(.25)
- if HLCC >= M_Price:
- print(Fore.CYAN+"Money Price: "+" $" + str(round(M_Price, 2))+Style.RESET_ALL)
- time.sleep(.25)
- print(Fore.CYAN+'Price Diff: ' + '$' + str(Diff)+Style.RESET_ALL)
- if HLCC < M_Price:
- print(Fore.RED+"Money Price: "+Fore.RED+" $" + str(round(M_Price, 2))+Style.RESET_ALL)
- time.sleep(.25)
- print(Fore.RED+'Price Diff: ' + '$' + str(Diff)+Style.RESET_ALL)
- time.sleep(.25)
- if f_Vol > 1000000:
- print(Fore.YELLOW + 'Volume:' + '{:20,.2f}'.format(f_Vol))
- else:
- print(Fore.WHITE + 'Volume:' + '{:20,.2f}'.format(f_Vol))
- time.sleep(.25)
- if Money_Flow > 350000000:
- print(Fore.YELLOW + '$Flow:' + '{:20,.2f}'.format(Money_Flow))
- else:
- print(Fore.WHITE + '$Flow:' + '{:20,.2f}'.format(Money_Flow))
- time.sleep(.25)
- if Liq_change < 0:
- print(Fore.RED + 'Liq Change:', '{:20,.2f}'.format(Liq_change), Style.RESET_ALL)
- else:
- print(Fore.CYAN + 'Liq Change:', '{:20,.2f}'.format(Liq_change))
- time.sleep(.25)
- if Liquidity < 0:
- print(Fore.RED + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity), Style.RESET_ALL)
- else:
- print(Fore.CYAN + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity), Style.RESET_ALL)
- time.sleep(.25)
- print('Avg MIV Spike: ',Avg_MIV_Spike,'%')
- if percent_Strength >= -.68:
- percent_Strength_String = Fore.GREEN+'Current Strength: '+str(percent_Strength)+'%'
- print(percent_Strength_String)
- if percent_Strength <-.68:
- percent_Strength_String = Fore.RED+'Current Strength: '+str(percent_Strength)+'%'
- print(percent_Strength_String)
- new_Strength = 100-(100*abs(percent_Strength- -.3153) / .8794)
- if new_Strength > 70:
- new_Strength_String = Fore.CYAN+'Bullishness Percentile: '+str(round(new_Strength, 2))+'%'+Style.RESET_ALL
- else:
- new_Strength_String = Fore.RED+'Bullishness Percentile: '+str(round(new_Strength, 2))+'%'+Style.RESET_ALL
- print(new_Strength_String)
- pctShortBuying = round(BuyPower / ShortPower, 4)*100
- pctNetSelling = round(SellPower / ShortPower, 4)*100
- pctNetBuying = round(BuyPower / SellPower, 4)*100
- pctNetBuyingStr = str(pctNetBuying)
- pctNetSellingStr = str(pctNetSelling)
- pctShortBuyingStr = str(pctShortBuying)
- print('Buy Power', '{:5,.2f}'.format(BuyPower), 'Short Power:','{:5,.2f}'.format(ShortPower))
- print('Buy Power as % of Short Selling: ['+pctShortBuyingStr+'%]')
- print('Sell Power as % of Short Selling: ['+pctNetSellingStr+'%]')
- BullBearRatio = round(float(pctShortBuying / pctNetSelling), 4)
- print('Bull Bear Ratio: ',BullBearRatio)
- print('Avg Cover Price: $%s' % CoverPrice)
- if lows_found >= 1 or highs_found >= 1:
- print('\nLow Ranges/Targets Found|Filled:',lows_found, '| ', low_Ranges_Filled)
- print('\nHigh Ranges/Targets Found|Filled: ',highs_found, '| ', high_Ranges_Filled)
- print('Total found: ',found)
- '''if found >0:
- tList = tList
- if tList[1] == 'High':
- print(Fore.GREEN+'LAST RANGE FOUND: [$' + str(Low_Range)+']','[$' + str(High_Range)+']', ' [' + range_ref_String + ': $' + str(Target)+']'+Style.RESET_ALL)
- print(Fore.GREEN+'POTENTIAL TARGETS: [$' + str(Low_Target)+']', '[$' + str(High_Target)+']'+Style.RESET_ALL)
- print(Fore.GREEN+'Found price: [$' + found_price + ']', 'Target implies a move of [' + implied_move + '%]'+'from current price ['+str(Close_Price)+']'+Style.RESET_ALL)
- else:
- tList = tList
- if tList[1] == 'Low':
- print(Fore.RED+'LAST RANGE FOUND: [$' + str(Low_Range)+']','$' + str(High_Range) + ' [' + range_ref_String + ': $' + str(Target)+Style.RESET_ALL)
- print(Fore.RED+'POTENTIAL TARGETS: [$' + str(Low_Target)+']', '$' + str(High_Target)+Style.RESET_ALL)
- print(Fore.RED+'Found price: [$' + (found_price) + ']', 'Target implies a move of [' + implied_move + '%]' + 'from current price [' + str(Close_Price) + ']'+Style.RESET_ALL)'''
- '''input = input('Would you like to see other found ranges?: [y/n]')
- if input == 'y':
- with open('/Users/King/Desktop/RangeTargets.csv' 'r') as csv_file:
- csv_reader = csv.reader(csv_file)
- for row in csv_file:
- row[0] = Date
- row[1] = Time
- row[2] = range_ref_String
- row[3] = Close_Price
- row[4] = M_Price
- row[5] = TargetPrice
- print('\nLow Ranges/Targets Found|Filled: ', lows_found, '| ', low_Ranges_Filled, str(round(low_range_Accuracy, 2)), '%')
- low_range_Accuracy = low_Ranges_Filled / lows_found
- row[6] = Money_Flow
- row[7] = f_Vol
- row[8] = OppRange
- row[9] = OppTarget'''
- '''if abs(Liq_change) > 500000:
- time.sleep(.005)
- print(Fore.CYAN+'['+Date+']',military_time,Fore.CYAN+'Current Liquidity:'+'{:20,.2f}'.format(Liquidity)+Style.RESET_ALL+Fore.YELLOW+Back.BLUE+Style.BRIGHT+' Liq Change: '+'{:20,.2f}'.format(Liq_change)+' '+Fore.YELLOW+Back.BLUE, 'Last Price [$'+str(Close_Price)+'] '+Tick_String+Style.RESET_ALL)
- else if Liquidity > 0:
- if Liq_change > 0:
- time.sleep(.005)
- print(Fore.YELLOW+'['+Date+']', military_time,Fore.GREEN+'Current Liquidity:'+'{:20,.2f}'.format(Liquidity)+Fore.GREEN+' Liq Change: ' + '{:20,.2f}'.format(Liq_change)+' '+Fore.YELLOW+Back.BLUE, 'Last Price [$'+str(Close_Price)+'] '+Tick_String+Style.RESET_ALL)
- if Liq_change < 0:
- time.sleep(.005)
- print(Fore.YELLOW+'['+Date+']', military_time,Fore.GREEN+'Current Liquidity:'+'{:20,.2f}'.format(Liquidity)+Style.RESET_ALL+Fore.RED+' Liq Change: '+'{:20,.2f}'.format(Liq_change)+Style.RESET_ALL+' '+Fore.YELLOW+Back.BLUE, 'Last Price [$'+str(Close_Price)+'] '+Tick_String+Style.RESET_ALL)
- else if Liq_change > 0:
- time.sleep(.005)
- print(Fore.YELLOW+'['+Date+']', military_time,Fore.BLUE+'Current Liquidity:'+'{:20,.2f}'.format(Liquidity)+Style.RESET_ALL+Fore.CYAN,' Liq Change: '+'{:20,.2f}'.format(Liq_change)+' '+Fore.YELLOW+Back.BLUE, 'Last Price [$'+str(Close_Price)+'] '+Tick_String+Style.RESET_ALL)
- else if Liq_change < 0:
- time.sleep(.005)
- print(Fore.RED+'['+Date+']', military_time,Fore.BLUE+'Current Liquidity:'+'{:20,.2f}'.format(Liquidity)+Style.RESET_ALL+Fore.CYAN,' Liq Change: '+'{:20,.2f}'.format(Liq_change)+' '+Fore.YELLOW+Back.BLUE, 'Last Price [$'+str(Close_Price)+'] '+Tick_String+Style.RESET_ALL)'''
- '''if menu_ans == '1' and Liquidity_Data == 'list':
- print(Fore.CYAN + 'REF#:', ref_Num)
- time.sleep(.05)
- print(Fore.WHITE + Time)
- time.sleep(.05)
- print("Last:", "$" + str(Close_Price))
- time.sleep(.05)
- print("HLCC:", "$" + str(HLCC))
- time.sleep(.05)
- print("Money Price: ", "$" + str(round(M_Price, 2)))
- time.sleep(.05)
- print('Price Diff: ' + '$' + str(Diff))
- time.sleep(.05)
- if f_Vol > 1000000:
- print(Fore.YELLOW + 'Volume:' + '{:20,.2f}'.format(f_Vol))
- else:
- print(Fore.WHITE + 'Volume:' + '{:20,.2f}'.format(f_Vol))
- time.sleep(.05)
- if Money_Flow > 350000000:
- print(Fore.YELLOW + '$Flow:' + '{:20,.2f}'.format(Money_Flow))
- else:
- print(Fore.WHITE + '$Flow:' + '{:20,.2f}'.format(Money_Flow))
- time.sleep(.05)
- if Liq_change < 0:
- print(Fore.RED + 'Liq Change:', '{:20,.2f}'.format(Liq_change), Style.RESET_ALL)
- else:
- print(Fore.CYAN + 'Liq Change:', '{:20,.2f}'.format(Liq_change))
- time.sleep(.05)
- if Liquidity < 0:
- print(Fore.RED + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity), Style.RESET_ALL)
- else:
- print(Fore.CYAN + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity), Style.RESET_ALL)
- time.sleep(.1)
- if NoStop == True:
- with open('/Users/King/Desktop/SPY_RangeTargets/NoStop.csv', 'r') as csv_file:
- csv_reader = csv.reader(csv_file)
- for row in csv_reader:
- Date = row[0]
- Time = row[1]
- range_ref_String = row[2]
- Close_Price = float(row[3])
- M_Price = float(row[4])
- TargetPrice = row[5]
- Money_Flow = float(row[6])
- f_Vol = float(row[7])
- OppRange = row[8]
- OppTarget = row[9]
- Liquidity = float(row[10])
- Liq_change = float(row[11])
- LFP = round(float(row[12]), 3)
- MIVI = float(row[13])
- ref_Num = int(row[14])
- list = [Date, Time, range_ref_String]
- Targets = [M_Price, TargetPrice]
- MIV_Index = str(MIVI)+str('%')
- LFP = str(round(LFP, 3))
- oppositePrices = [OppRange, OppTarget]
- Liq_change_String = str('$'+'{:20,.2f}'.format(Liq_change))
- listlist = [MIV_Index, Liq_change, ref_Num]
- dict = {'':list, 'Targets: ':Targets, 'Found price: ':Close_Price, 'Opposite Ranges/Targets':oppositePrices}
- range_info = {'MIV Index: ':MIV_Index, ' Liq Change:':Liq_change_String, 'REF#':ref_Num}
- if MIVI < 0 and Liq_change > 0:
- infotext = colored(str(range_info), 'grey', 'on_cyan', attrs=['reverse', 'underline'])
- else:
- infotext = colored(str(range_info), 'grey', 'on_white', attrs=['reverse', 'underline'])
- for k,v in dict.items():
- time.sleep(.001)
- print(Fore.YELLOW, k,v)
- cprint(infotext)
- print('\n')'''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement