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 pathlib
- import os
- import os.path
- from pathlib import Path
- import glob
- from progress.bar import Bar
- filename_input = input('[Ticker][Number] Input filename_input: ')
- iFiles = '/Users/King/iFiles/'
- rangeiFiles = '/Users/King/iFiles/iRanges/' ### All Range files created will be in this iFilesectory
- rangeiFileExtension = '_RangeTargets.csv'
- default = '/Users/King/Data.csv' ### Easiest for ETRADE to automatically export as this filename_input
- checkFile = Path(iFiles+filename_input+'.csv')
- file_Exists = Path.is_file(checkFile)
- rangeCheckFile = Path(rangeiFiles+filename_input+rangeiFileExtension)
- rangefile_Exists = Path.is_file(rangeCheckFile)
- if filename_input == 'Watchlist':
- import Watchlist
- Watchlist.show_available()
- time.sleep(.15)
- print('These are all symbols currently in your watchlist')
- time.sleep(.5)
- pick_file_answer = input('Would you like to choose a symbol from here?: ')
- if pick_file_answer == 'y':
- Watchlist.symbol_dict()
- if file_Exists:
- if filename_input != 'Watchlist':
- time.sleep(.35)
- print(Fore.CYAN+'File Found!'+Style.RESET_ALL)
- time.sleep(.75)
- pass
- else:
- print('Sorry, File is not in iFile iFilesectory')
- with open(iFiles+str(filename_input)+'.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 = {}
- hr_found = bool
- ht_filled = bool
- hr_filled = bool
- lr_found = bool
- lr_filled = bool
- lt_filled = bool
- lows_found = int()
- highs_found = 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 = []
- TickerID = int(0)
- menu_ans = input('What would you like to do? \n [1] Print Liquidity Data | [2] NULL | [3] RangeTargets File | [4] No-Stop-Data-Add [6] Current Info\n')
- if menu_ans == '1':
- Liquidity_Data = input('Would you like to print liquidity data? [y/n]: ')
- if menu_ans == '4':
- NoStop = True
- CandleDur = input('Candle Duration: ')
- else:
- NoStop = False
- ### Might use this space for a (show liquidity) type option to make it false
- 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()
- 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
- #######################################################################################################################################################
- 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) # 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)
- Liq_Tick = int()
- Price_Tick = int()
- tREF = int()
- rFound = False
- Range_Clause = bool
- 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
- '''
- #####################################################################################################################################################
- ####################DEFINE#####RANGE########DATA#######################
- if abs(allData[7]-allData[6]) >= criteria:
- diff = abs(M_Price - Close_Price)
- Range_Clause = True
- range_identifier_all = 'All'
- if Range_Clause == True:
- t_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)
- if M_Price >= found_Price+diff:
- 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
- hr_found = True
- tLow = False
- elif M_Price<= found_Price-diff:
- found += 1
- range_ref_String = "LOW TARGET"
- tLow = True
- tHigh = False
- 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
- lr_found = True
- lows_found += 1
- rFound = True
- else:
- Range_Clause = False
- lr_found = False
- hr_found = False
- rFound = False
- #################################################START######################LIQUIDITY#####################################################################
- if menu_ans == '1' or menu_ans == '4':
- if Close_Price > Open_Price and Liq_change > 0:
- Price_Tick = 1
- Liq_Tick = 1
- elif Close_Price >= Open_Price and Liq_change < 0:
- Price_Tick = 0
- Liq_Tick = -1
- elif Close_Price <= Open_Price and Liq_change > 0:
- Price_Tick = -1
- Liq_Tick = 0
- elif Close_Price <= Open_Price and Liq_change < 0:
- Price_Tick = -1
- Liq_Tick = -1
- Tick = Liq_Tick + Price_Tick
- Strength += Tick
- percent_Strength = round(Strength / ref_Num, 4)
- if Tick == 2:
- Tick_String = Fore.BLUE+Back.GREEN+'STRONG BUYERS'+Style.RESET_ALL+' '+Fore.GREEN+str(Strength)
- if Tick == -1 and Price_Tick == 0:
- Tick_String = Fore.WHITE+'PRICE UP LIQ DOWN'+Style.RESET_ALL+' '+Fore.RED+str(Strength)
- if Tick == -2:
- Tick_String = Fore.RED+Back.YELLOW+'STRONG SELLERS'+Style.RESET_ALL+' '+Fore.WHITE+str(Strength)
- if Tick == -1 and Liq_Tick == 0:
- Tick_String = Fore.RED+'SHORT COVERING'+Style.RESET_ALL+' '+Fore.YELLOW+Back.BLUE+str(Strength)
- Range_List[ref_Num] = Range_Found
- #########################################Tick###########Exception##########Option#1##############Option#4####################################################
- 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 < -950000:
- print("MARKET MAKER LOW TARGET")
- if rFound == True:
- if tHigh == True:
- tLow = False
- HRS = str(High_Range)
- HRT = str(High_Target)
- LRS = str(Low_Range)
- LRT = str(Low_Target)
- print(Fore.YELLOW+'['+Date+']',military_time,Style.RESET_ALL+Fore.BLUE+Back.YELLOW+Style.BRIGHT+'Current Liquidity:'+'{:20,.2f}'.format(Liquidity)+Style.RESET_ALL+Fore.BLUE+Back.YELLOW+Style.BRIGHT+' Liq Change: '+'{:20,.2f}'.format(Liq_change)+Style.RESET_ALL, Fore.YELLOW+Back.BLUE+Style.BRIGHT,'Last Price: [$'+str(Close_Price)+'] '+Style.RESET_ALL+Tick_String+Style.RESET_ALL+Fore.GREEN+Back.BLUE+Style.BRIGHT+' NEW HIGH RANGE FOUND:[$'+HRS+']'+' NEW HIGH TARGET FOUND: [$'+HRT+']'+Style.RESET_ALL)
- time.sleep(2)
- if NoStop == True:
- with open(rangeiFiles+str(filename_input)+rangeiFileExtension, 'a') as csv_file:
- CandleDuration = CandleDur
- file_PriceList = [Date, military_time, range_ref_String, Close_Price, M_Price, HRT, Money_Flow, f_Vol, LRS, LRT, Liquidity, Liq_change, liq_flowPrice, MIV_Index, CandleDuration, ref_Num]
- wr = csv.writer(csv_file)
- wr.writerow(file_PriceList)
- else:
- add_Range_Target = input('Would you like to add this range to file?: [y/n]:')
- if add_Range_Target == 'y':
- CandleDuration = str(filename_input[-1:])+'Min'
- with open(rangeiFiles+str(filename_input)+rangeiFileExtension, 'a') as csv_file:
- file_PriceList = [Date, military_time, range_ref_String, Close_Price, M_Price, HRT, Money_Flow, f_Vol, LRS, LRT, Liquidity, Liq_change, liq_flowPrice, MIV_Index, CandleDuration, ref_Num]
- wr = csv.writer(csv_file)
- wr.writerow(file_PriceList)
- else:
- tHigh = False
- if tLow == True:
- tHigh = False
- HRS = str(High_Range)
- HRT = str(High_Target)
- LRS = str(Low_Range)
- LRT = str(Low_Target)
- 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+']'+Style.RESET_ALL)
- time.sleep(2)
- if NoStop == True:
- with open(rangeiFiles+str(filename_input)+rangeiFileExtension, 'a') as csv_file:
- CandleDuration = CandleDur
- file_PriceList = [Date, military_time, range_ref_String, Close_Price, M_Price, LRT, Money_Flow, f_Vol, HRS, HRT, Liquidity, Liq_change, liq_flowPrice, MIV_Index, CandleDuration, ref_Num]
- wr = csv.writer(csv_file)
- wr.writerow(file_PriceList)
- else:
- add_Range_Target = input('Would you like to add this range to file?: [y/n]:')
- if add_Range_Target == 'y':
- CandleDuration = str(filename_input[-1:])+'Min'
- with open(rangeiFiles+str(filename_input)+rangeiFileExtension, 'a') as csv_file:
- file_PriceList = [Date, military_time, range_ref_String, Close_Price, M_Price, LRT, Money_Flow, f_Vol, HRS, HRT, Liquidity, Liq_change, liq_flowPrice, MIV_Index, CandleDuration, ref_Num]
- wr = csv.writer(csv_file)
- wr.writerow(file_PriceList)
- else:
- tLow = False
- else:
- rFound = False
- else:
- rFound = False
- #######################################################################################################
- if lr_filled == False:
- if filled == False:
- if lr_found == True and Low_Price <= Low_Range:
- hr_found = False
- 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
- else:
- if High_Price >= High_Range:
- time.sleep(.5)
- OPPOSITE_RFILLED = (' !!!OPPOSITE RANGE FILLED!!!')
- OppRangeFilled_String = colored(OPPOSITE_RFILLED, 'green', attrs=['bold','blink'])
- cprint(OppRangeFilled_String)
- lr_filled = True
- if hr_filled == False:
- if filled == False:
- if hr_found == True and High_Price >= High_Range:
- lr_found = False
- 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
- else:
- if Low_Price <= Low_Range:
- time.sleep(.5)
- OPPOSITE_RFILLED = (' !!!OPPOSITE RANGE FILLED!!!')
- OppRangeFilled_String = colored(OPPOSITE_RFILLED, 'red', attrs=['bold','blink'])
- cprint(OppRangeFilled_String)
- hr_filled = True
- else:
- Range_Clause = False
- if Liq_change < -1000000 and tLow == False:
- if tHigh == False:
- print(Fore.YELLOW + '[' + Date + ']', military_time,Style.RESET_ALL + Fore.CYAN + Back.RED + Style.BRIGHT + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL + Fore.YELLOW + Back.RED + Style.BRIGHT + ' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + Style.RESET_ALL, Fore.YELLOW + Back.RED + Style.BRIGHT,'Last Price: [$' + str(Close_Price) + '] ' + Style.RESET_ALL + Tick_String + Style.RESET_ALL + Fore.YELLOW + Back.RED + Style.BRIGHT + '**SELL SIGNAL**' + Style.RESET_ALL)
- time.sleep(1)
- 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)
- elif 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)
- elif Liq_change > 0:
- time.sleep(.005)
- print(Fore.YELLOW + '[' + Date + ']', military_time,Fore.BLUE + 'Current Liquidity:' + '{:20,.2f}'.format(Liquidity) + Style.RESET_ALL + Fore.WHITE,' Liq Change: ' + '{:20,.2f}'.format(Liq_change) + ' ' + Fore.YELLOW + Back.BLUE,'Last Price [$' + str(Close_Price) + '] ' + Tick_String + Style.RESET_ALL)
- elif 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)
- 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)
- liq_flowPrice = abs(Liq_change / Money_Flow)
- runningValueIndex_String = str(runningValueIndex)
- if abs(MIV_Index) > .25:
- if MIV_Index > .25:
- 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+'Running Value: '+Style.RESET_ALL+Fore.BLACK+Back.RED+'[+'+runningValueIndex_String+'%]'+Style.RESET_ALL)
- elif MIV_Index < -.25:
- 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+'Running Value: '+Style.RESET_ALL+Fore.BLACK+Back.CYAN+'['+runningValueIndex_String+'%]'+Style.RESET_ALL)
- #####################################################################################
- if menu_ans == '3':
- bar = Bar('Loading Range File', max=20, suffix='%(index)d/%(max)d - %(percent).1f%% - %(eta)ds')
- for i in range(20):
- time.sleep(.05) # Do some work
- bar.next()
- bar.finish()
- printRangeFile = input('Would you like to see other found ranges?: [y/n]')
- if printRangeFile == 'y':
- watchlist = iFiles+'watchlist.csv'
- with open(rangeiFiles+str(filename_input)+'_RangeTargets.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 = 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('%')
- liq_flowPrice = str(round(LFP, 3))
- oppositePrices = [OppRange, OppTarget]
- Liq_change_String = str('$' + '{:20,.2f}'.format(Liq_change))
- turnToDate = str(Date)
- turnToTime = str(Time)
- turnToRRef = str(range_ref_String)
- turnToMoney = '$'+str(Close_Price)
- turnToRange = '$'+str(M_Price)
- turnToTarget = '$'+str(TargetPrice)
- lastRange = [turnToDate,turnToMoney,turnToRange,turnToTarget]
- 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
- if menu_ans == '5':
- print('Sorry, still testing')
- '''choose_info = input('[2] MIV_Index [3] Liquidity [4] Liq Change [5] % Strength [6] Volume [7] Money Flow [8] Liq Flow Price')
- if choose_info == '2':
- 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)
- liq_flowPrice = abs(Liq_change / Money_Flow)
- percent_Strength = round(Strength / ref_Num, 4)
- info = [Date, military_time, MIV_Index, Liquidity, Liq_change, percent_Strength]
- print(MIV_Index)'''
- 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)
- print("Money Price: ", "$" + str(round(M_Price, 2)))
- time.sleep(.25)
- print('Price Diff: ' + '$' + str(Diff))
- 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)
- if percent_Strength >= -.68:
- percent_Strength_String = Fore.GREEN+'Current Strength: '+str(percent_Strength)+'%'
- if percent_Strength <-.68:
- percent_Strength_String = Fore.RED+'Current Strength: '+str(percent_Strength)+'%'
- if percent_Strength < 1 and percent_Strength > -.99:
- percent_Strength_String = colored('Current Strength: '+'#N/A', 'white', 'on_grey', attrs=['blink'])
- cprint(percent_Strength_String)
- else:
- print(percent_Strength_String)
- new_Strength = 100-(100*abs(percent_Strength- -.3153) / .9333)
- 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
- if lows_found > 0 or highs_found > 0:
- lowAccuracy = round(low_Ranges_Filled / lows_found, 3)*100
- highAccuracy = round(high_Ranges_Filled / highs_found, 3)*100
- print(new_Strength_String)
- print('\nLow Ranges/Targets Found|Filled:',lows_found, '| ', low_Ranges_Filled)
- print('\nHigh Ranges/Targets Found|Filled: ',highs_found, '| ', high_Ranges_Filled)
- print(found)
- else:
- print('\nLast Range Found '+turnToDate+' at '+turnToTime+' Found Price: ['+turnToMoney+']')
- print(turnToRRef,'\nRange: ['+turnToRange+']',' Target: ['+turnToTarget+']')
- RangesNULL = colored('Range Accuracy Data Unavailable', 'grey', 'on_yellow', attrs=['bold'])
- cprint(RangesNULL)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement