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
- import sys
- import time
- import hashlib
- ########## NEED ##########
- ref_Num = int()
- Liquidity = float()
- gap_up = int()
- gap_down = int()
- Last = float()
- prevVol = float(1)
- prevFlow = float(1)
- prevPrice = float(1)
- Strength = float()
- MIV_Spike = float()
- MIV_Spike_Count = int()
- TradingAbove_Count = int()
- TradingBelow_Count = int()
- TradingAbove_Diff = float()
- TradingBelow_Diff = float()
- RegRangeCount = int()
- CurRegRangeCount = int()
- High_Range_Count = int()
- Low_Range_Count = int()
- test = []
- CashOpenHash = '00491302948265c47e651fcff99fd9fb'
- CashOpen = float()
- chg_Open = float()
- MM_Range_Count = int()
- range_ref_Str = str()
- gap_Ratio = float()
- range_ref_Str = ''
- cps = []
- datalist2 = []
- test2 = []
- Master = []
- test3 = []
- raw_liq_list = []
- ns_list = []
- pvs_list = []
- Liq_list = []
- PotentialMatches = []
- EODHashStr = '7263a069030520f9333799b957c155bf'
- PivotPrice = float()
- findDiff = float()
- TotalDiff = float()
- z_gain = float(1)
- chg_Close = float()
- curr_chg_Close = float()
- prev_Day_Close = float()
- DayCount = int()
- curr_Price = float()
- z_gain_count = int()
- sum_z_gain = float()
- avg_z_gain = float()
- y_price = float(1)
- o_CHG = []
- c_CHG = []
- GR = []
- NS = []
- LIQ1 = []
- LIQ2 = []
- PVS_i = []
- PVS_c = []
- RR = []
- TATBR = []
- MMR = []
- PM1 = []
- PM2 = []
- MASTER = []
- lcount = int()
- chg_c_cps = float(1)
- PT_MIS = []
- Has_Range = bool
- all_RR_Data = []
- RR_Data = []
- RR_Dict = {}
- Range_Info = []
- all_Range_Info = []
- M1_Range_Info = []
- p_diff = float()
- p_diff1 = float()
- MIV_Ratio = float()
- oppRange = float()
- oppTarget = float()
- Range_Targets = []
- oppRange_Targets = []
- lfpc_diff_spread = float()
- lfpc_cps_diff_spread = float()
- ta_tbr_cps = float()
- ta_tbr = float()
- avg_ND_gain = float()
- avg_3D_gain = float()
- count = int()
- sum_ND_gain = float()
- sum_3D_gain = float()
- ################# TA.PY
- full_ref = int()
- cp1_list = []
- chg_390 = float(1)
- chg_1170 = float(1)
- cp2_list = []
- neg_ND_return = int()
- ND_drawdown = float()
- pos_ND_return = int()
- ND_gain = float()
- neg_ND_return = int()
- neg_N3D_return = int()
- N3D_drawdown = float()
- pos_N3D_return = float()
- N3D_gain = int()
- Accuracy = float()
- ################## TA.PY
- cps_file = '/Users/King/Desktop/iSpy.csv'
- curfile = '/Users/King/data.csv'
- with open(curfile, 'r') as curfile:
- cur_reader = csv.reader(curfile)
- cur_header = next(cur_reader)
- for row in cur_reader:
- ref_Num += 1
- dTime = str(datetime.strptime(row[0], '%a %b %d %H:%M'))
- Time = dTime[-14:]
- Open_Price = float(row[1])
- Close_Price = float(row[2])
- High_Price = float(row[3])
- Low_Price = float(row[4])
- Money_Flow = float(row[6])
- last = Close_Price
- Vol = row[5]
- f_Vol = float(Vol[:-1])
- m_Vol = str(Vol[-1:])
- if m_Vol == "K":
- f_Vol = f_Vol * 1000
- if m_Vol == "M":
- f_Vol = f_Vol * 1000000
- if m_Vol != "K" and m_Vol != "M":
- f_Vol = float(row[5])
- 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
- Diff = round(HLCC - M_Price, 2)
- MMM = float(f_Vol * HLCC)
- Liq_change = float(Money_Flow - MMM)
- Liquidity += Liq_change
- Date = str(Time[:5])
- military_time = str(Time[-8:])
- criteria1 = abs(.0035 * HLCC)
- criteria2 = abs(.003 * HLCC)
- findDiff = round(M_Price - Close_Price, 2)
- TotalDiff += findDiff
- PivotPrice = round(Close_Price + TotalDiff, 2)
- PivotSpread = round(PivotPrice - Close_Price, 2)
- hashTime = hashlib.md5(str.encode(military_time))
- if ref_Num == 1:
- CashOpen = Open_Price
- if ref_Num >= 1:
- CashOpen = CashOpen
- if ref_Num >= 2:
- prevPrice1 = Close_Price
- if ref_Num % 2 != 0:
- Price1 = Close_Price
- if ref_Num % 2 == 0:
- Price2 = Close_Price
- if ref_Num % 2 != 0 and ref_Num > 2:
- Last = Price2
- Chg = 100 * round((Close_Price - Last) / Last, 4)
- if ref_Num % 2 == 0 and ref_Num >= 2:
- Last = Price1
- Chg = 100 * round((Close_Price - Last) / Last, 4)
- if Open_Price > Last and ref_Num > 1:
- gap_up += 1
- if Open_Price < Last and ref_Num > 1:
- gap_down += 1
- if M_Price > High_Price:
- TradingAbove_Count += 1
- TradingAbove_Diff += M_Price - Close_Price
- if M_Price < Low_Price:
- TradingBelow_Count += 1
- TradingBelow_Diff += M_Price - Close_Price
- if Money_Flow > 0:
- MIV_Index = round(100 * (f_Vol / prevVol) - 100 * ((Money_Flow * HLCC) / (prevFlow * prevPrice)), 3)
- prevPrice = Close_Price
- prevFlow = Money_Flow
- prevVol = f_Vol
- MIV_Index_String = str(MIV_Index)
- if MIV_Index >= .25:
- MIV_Spike += abs(MIV_Index)
- MIV_Spike_Count += 1
- Avg_MIV_Spike = round(MIV_Spike / MIV_Spike_Count, 3)
- if abs(Liq_change) > 0:
- LFP = round(Money_Flow / abs(Liq_change) * .01, 3)
- VolLiqPrice = round(f_Vol / abs(Liq_change), 2)
- LFPC = round(1000 * (abs(Liq_change) / Money_Flow) * .01, 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)
- new_Strength = round(100 - (100 * abs(percent_Strength - -.3153) / .8794), 2)
- MIV_Str = str(MIV_Index)+'%'
- Liquidity = round(Liquidity, 2)
- chg_Open = round(100*(Close_Price - CashOpen) / CashOpen, 2)
- curr_Price = Close_Price
- if gap_up >= 1 and gap_down >= 1:
- gap_Ratio = round(gap_up / gap_down, 2)
- if abs(M_Price - HLCC) >= criteria1:
- RegRangeCount += 1
- p_diff = round(100*(M_Price - HLCC) / HLCC, 3)
- p_diff1 = round(100*(M_Price - Close_Price) / Close_Price, 3)
- Range = M_Price
- spread_from_target = round((M_Price - Close_Price) * 2, 2)
- Target = round(spread_from_target + Close_Price, 2)
- oppRange = round((-1 * spread_from_target) / 2 + Close_Price, 2)
- oppTarget = round((-1 * spread_from_target) + Close_Price, 2)
- if M_Price > Close_Price:
- High_Range_Count += 1
- range_ref_Str = 'HIGH'
- if M_Price < Close_Price:
- Low_Range_Count += 1
- range_ref_Str = 'LOW'
- ############
- Range_Targets = [Range, Target]
- oppRange_Targets = [oppRange, oppTarget]
- MF_Str = '{:8,.2f}'.format(Money_Flow)
- liqchgstr = '{:8,.2f}'.format(Liq_change)
- MIV_Ratio = round(MIV_Index / Avg_MIV_Spike, 3)
- p_diffstr = str(p_diff1)+'%'
- R_Type = [LFP, LFPC]
- MIV_Type = [MIV_Index, MIV_Ratio]
- MF_LQ = [MF_Str, liqchgstr]
- LFPC = round(LFPC * 10, 3)
- lfpc_cps_diff_spread = round(LFPC - abs(p_diff1), 3)
- RR_Data = [range_ref_Str, p_diffstr, p_diff, Date, military_time, Close_Price, Range, Target, MIV_Index, MIV_Ratio, LFP, LFPC, oppRange, oppTarget, Liq_change, Money_Flow, lfpc_cps_diff_spread]
- ##########
- if abs(M_Price - HLCC) < criteria1 and abs(M_Price - HLCC) >= criteria2:
- MM_Range_Count += 1
- if RegRangeCount >= 1:
- Has_Range = True
- RR_Dict = {'Range Type:':RR_Data[0], 'Implied Move:':RR_Data[1], 'LFP:':R_Type[0], 'LFPC:':R_Type[1], 'MIV Index:':MIV_Type[0], 'MIV Ratio:':MIV_Type[1], 'MoneyFlow:':MF_LQ[0], 'Liq Change:':MF_LQ[1]}
- CurRegRangeCount = RegRangeCount
- curdata = [Date, military_time, Close_Price, new_Strength, chg_Open, Liquidity, gap_up, gap_down, gap_Ratio, TradingAbove_Count, TradingBelow_Count, RegRangeCount, range_ref_Str, MM_Range_Count, PivotSpread]
- else:
- datalist = [ref_Num, new_Strength, chg_Open, Liquidity, gap_up, gap_down, gap_Ratio, TradingAbove_Count, TradingBelow_Count, RegRangeCount, Low_Range_Count, High_Range_Count, MM_Range_Count]
- curdata = [Date, military_time, Close_Price, new_Strength, chg_Open, Liquidity, gap_up, gap_down, gap_Ratio, TradingAbove_Count, TradingBelow_Count, RegRangeCount, range_ref_Str, MM_Range_Count, PivotSpread]
- test.append(curdata)
- def compare():
- PotentialMatch = []
- tt_compare = str(curdata[1])
- tt_cps_hash = hashlib.md5(str.encode(tt_compare))
- tt_cps_str = tt_cps_hash.hexdigest()
- ns_cps = float(curdata[3])
- chg_o_cps = float(curdata[4])
- Liq_cps = float(curdata[5])
- gu_cps = float(curdata[6])
- gd_cps = float(curdata[7])
- gr_cps = float(curdata[8])
- tac_cps = float(curdata[9])
- tbc_cps = float(curdata[10])
- rrc_cps = float(curdata[11])
- rrs_cps = str(curdata[12])
- mmc_cps = int(curdata[13])
- pvs_cps = float(curdata[14])
- with open(cps_file, 'r') as cps_file:
- cps_reader = csv.reader(cps_file)
- cps_header = next(cps_reader)
- for row in cps_reader:
- full_ref += 1
- ref_Num += 1
- dTime = str(datetime.strptime(row[0], '%a %b %d %H:%M'))
- Time = dTime[-14:]
- Open_Price = float(row[1])
- Close_Price = float(row[2])
- High_Price = float(row[3])
- Low_Price = float(row[4])
- Money_Flow = float(row[6])
- last = Close_Price
- Vol = row[5]
- f_Vol = float(Vol[:-1])
- m_Vol = str(Vol[-1:])
- if m_Vol == "K":
- f_Vol = f_Vol * 1000
- if m_Vol == "M":
- f_Vol = f_Vol * 1000000
- if m_Vol != "K" and m_Vol != "M":
- f_Vol = float(row[5])
- 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
- Diff = round(HLCC - M_Price, 2)
- MMM = float(f_Vol * HLCC)
- Liq_change = float(Money_Flow - MMM)
- Liquidity += Liq_change
- Date = str(Time[:5])
- military_time = str(Time[-8:])
- criteria1 = abs(.0035 * HLCC)
- criteria2 = abs(.003 * HLCC)
- findDiff = round(M_Price - Close_Price, 2)
- TotalDiff += findDiff
- PivotPrice = round(Close_Price + TotalDiff, 2)
- PivotSpread = round(PivotPrice - Close_Price, 2)
- hashTime = hashlib.md5(str.encode(military_time))
- cp1_list.append(Close_Price)
- cp2_list.append(Close_Price)
- if full_ref >= 390:
- chg_390 = round(100*(cp1_list[0] - cp1_list[-1]) / cp1_list[0], 2)
- cp1_list.pop(0)
- if full_ref >= 1170:
- chg_1170 = round(100*(cp2_list[0] - cp2_list[-1]) / cp2_list[0], 2)
- cp2_list.pop(0)
- if hashTime.hexdigest() == CashOpenHash:
- CashOpen = Open_Price
- if ref_Num >= 2:
- prevPrice1 = Close_Price
- if ref_Num % 2 != 0:
- Price1 = Close_Price
- if ref_Num % 2 == 0:
- Price2 = Close_Price
- if ref_Num % 2 != 0 and ref_Num > 2:
- Last = Price2
- Chg = 100 * round((Close_Price - Last) / Last, 4)
- if ref_Num % 2 == 0 and ref_Num >= 2:
- Last = Price1
- Chg = 100 * round((Close_Price - Last) / Last, 4)
- if Open_Price > Last and ref_Num > 1:
- gap_up += 1
- if Open_Price < Last and ref_Num > 1:
- gap_down += 1
- if M_Price > High_Price:
- TradingAbove_Count += 1
- TradingAbove_Diff += M_Price - Close_Price
- if M_Price < Low_Price:
- TradingBelow_Count += 1
- TradingBelow_Diff += M_Price - Close_Price
- if Money_Flow > 0:
- MIV_Index = round(100 * (f_Vol / prevVol) - 100 * ((Money_Flow * HLCC) / (prevFlow * prevPrice)), 3)
- prevPrice = Close_Price
- prevFlow = Money_Flow
- prevVol = f_Vol
- MIV_Index_String = str(MIV_Index)
- if MIV_Index >= .25:
- MIV_Spike += abs(MIV_Index)
- MIV_Spike_Count += 1
- Avg_MIV_Spike = round(MIV_Spike / MIV_Spike_Count, 3)
- if abs(Liq_change) > 0:
- LFP = round(Money_Flow / abs(Liq_change) * .01, 3)
- VolLiqPrice = round(f_Vol / abs(Liq_change), 2)
- LFPC = round(1000 * (abs(Liq_change) / Money_Flow) * .01, 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)
- new_Strength = round(100 - (100 * abs(percent_Strength - -.3153) / .8794), 2)
- if MIV_Spike_Count >= 1:
- MIV_Ratio = round(MIV_Index / Avg_MIV_Spike, 3)
- Liq_change = int(Liq_change)
- if abs(M_Price - HLCC) >= criteria1:
- RegRangeCount += 1
- if M_Price > Close_Price:
- High_Range_Count += 1
- range_ref_Str = 'HIGH'
- if M_Price < Close_Price:
- Low_Range_Count += 1
- range_ref_Str = 'LOW'
- LFPC = round(LFPC * 10, 3)
- p_diff1 = round(100*(M_Price - Close_Price) / Close_Price, 3)
- p_diff = round(100*(M_Price - HLCC) / HLCC, 3)
- lfpc_diff_spread = round(LFPC - abs(p_diff1), 3)
- all_RR_Data = [Date, military_time, range_ref_Str, p_diff1, LFPC, LFP, MIV_Index, MIV_Ratio, Liq_change, Money_Flow, chg_390, chg_1170, lfpc_diff_spread]
- if Has_Range == True and range_ref_Str == RR_Data[0]:
- if lfpc_cps_diff_spread * lfpc_diff_spread > 0:
- if (MIV_Ratio - 1) * (RR_Data[9] - 1) > 0:
- all_Range_Info.append(all_RR_Data)
- if abs(M_Price - HLCC) < criteria1 and abs(M_Price - HLCC) >= criteria2:
- MM_Range_Count += 1
- Liquidity = round(Liquidity, 2)
- chg_Open = round(100 * (Close_Price - CashOpen) / Close_Price, 2)
- liqstr = '{:8,.2f}'.format(Liquidity)
- if gap_up >= 1 and gap_down >= 1:
- gap_Ratio = round(gap_up / gap_down, 2)
- if RegRangeCount >= 1 or MM_Range_Count >= 1:
- datalist2 = [ref_Num, new_Strength, chg_Close, chg_Open, Liquidity, gap_up, gap_down, gap_Ratio, TradingAbove_Count, TradingBelow_Count, RegRangeCount, Low_Range_Count, High_Range_Count, MM_Range_Count, PivotSpread, z_gain, chg_390, chg_1170]
- cps = [Date, military_time, Close_Price, new_Strength, chg_Close, chg_Open, liqstr, gap_up, gap_down, gap_Ratio, TradingAbove_Count, TradingBelow_Count, RegRangeCount, range_ref_Str, MM_Range_Count, PivotSpread, z_gain, chg_390, chg_1170]
- RR.append(cps)
- else:
- datalist2 = [ref_Num, new_Strength, chg_Close, chg_Open, Liquidity, gap_up, gap_down, gap_Ratio, TradingAbove_Count, TradingBelow_Count, RegRangeCount, Low_Range_Count, High_Range_Count, MM_Range_Count, PivotSpread, z_gain, chg_390, chg_1170]
- cps = [Date, military_time, Close_Price, new_Strength, chg_Close, chg_Open, liqstr, gap_up, gap_down, gap_Ratio, TradingAbove_Count, TradingBelow_Count, RegRangeCount, range_ref_Str, MM_Range_Count, PivotSpread, z_gain, chg_390, chg_1170]
- ####################################### FINDING THE CLOSE OF 390 CANDLES PREVIOUS ############
- #################################### IF COMPARE FILE == CURRENT FILE TIME ######################
- if hashTime.hexdigest() == tt_cps_str:
- x_price = Close_Price
- ns_diff = round(abs(ns_cps - new_Strength), 2)
- co_diff = round(abs(chg_o_cps - chg_Open), 2)
- pvs_diff = round(abs(pvs_cps - PivotSpread), 2)
- gr_diff = round(abs(gr_cps - gap_Ratio), 2)
- gr_above_below = round((gr_cps - 1) * (gap_Ratio - 1), 2)
- LIQ_pct_spread = (Liq_cps + Liquidity)*.3
- LIQ_abs_diff = abs(Liq_cps - Liquidity)
- if tac_cps > 0 or tbc_cps > 0:
- ta_tbr_cps = tac_cps - tbc_cps
- if TradingAbove_Count > 0 or TradingBelow_Diff > 0:
- ta_tbr = TradingAbove_Count - TradingBelow_Count
- if (ta_tbr_cps - 1) * (ta_tbr - 1) > 0:
- if abs(ta_tbr_cps) > 0 and abs(ta_tbr) > 0:
- TATBR.append(cps)
- sum_ND_gain += chg_390
- sum_3D_gain += chg_1170
- count += 1
- if chg_1170 < 0:
- neg_N3D_return += 1
- if chg_1170 > 0:
- pos_N3D_return += 1
- if chg_390 < 0:
- neg_ND_return += 1
- if chg_390 > 0:
- pos_ND_return += 1
- if gr_above_below > 0:
- GR.append(cps)
- if chg_o_cps * chg_Open > 0:
- o_CHG.append(cps)
- if Liq_cps * Liquidity >= 0 and ns_diff < 5:
- sum_z_gain += z_gain
- z_gain_count += 1
- if chg_c_cps * chg_Close >= 0:
- c_CHG.append(cps)
- if pvs_cps * PivotSpread > 0 and pvs_diff < .5 * abs(pvs_cps + PivotSpread):
- PVS_i.append(cps)
- if pvs_diff < .3 * abs(pvs_cps + PivotSpread):
- PVS_c.append(cps)
- sum_ND_gain += chg_390
- sum_3D_gain += chg_1170
- count += 1
- if chg_1170 < 0:
- neg_N3D_return += 1
- if chg_1170 > 0:
- pos_N3D_return += 1
- if chg_390 < 0:
- neg_ND_return += 1
- if chg_390 > 0:
- pos_ND_return += 1
- if Liq_cps * Liquidity > 0:
- LIQ1.append(cps)
- if LIQ_abs_diff <= LIQ_pct_spread:
- LIQ2.append(cps)
- if ns_diff < 7:
- NS.append(cps)
- if MM_Range_Count >= 1:
- MMR.append(cps)
- if RegRangeCount >= 1:
- RR.append(cps)
- if hashTime.hexdigest() == EODHashStr:
- if DayCount >= 1:
- chg_Close = round(100*(Close_Price - prev_Day_Close) / prev_Day_Close, 2)
- prev_Day_Close = Close_Price
- else:
- DayCount += 1
- prev_Day_Close = Close_Price
- z_gain = round(100*(y_price - x_price) / y_price, 2)
- y_price = Close_Price
- ############################### RESETING ALL STATISTICS ###################
- Tick = Tick * 0
- Strength = Strength * 0
- new_Strength = new_Strength * 0
- ref_Num = 0
- Liquidity = Liquidity * 0
- if tt_cps_str == '15:59:00':
- prevClose = prevClose
- prevClose = Close_Price
- RegRangeCount = RegRangeCount * 0
- TradingBelow_Count = TradingBelow_Count * 0
- TradingAbove_Count = TradingAbove_Count * 0
- gap_Ratio = gap_Ratio * 0
- gap_down = gap_down * 0
- gap_up = gap_up * 0
- High_Range_Count = High_Range_Count * 0
- Low_Range_Count = Low_Range_Count * 0
- MM_Range_Count = MM_Range_Count * 0
- range_ref_Str = str()
- findDiff = findDiff * 0
- TotalDiff = TotalDiff * 0
- PivotPrice = PivotPrice * 0
- PivotSpread = PivotSpread * 0
- curr_chg_Close = round(100*(curr_Price - prev_Day_Close) / curr_Price, 2)
- curdata.insert(4, curr_chg_Close)
- chg_c_cps = float(curdata[4])
- chg_o_cps = float(curdata[5])
- print('\n\n')
- help_comment = """BP%: Bullish percentile. % of upticks (+ liquidity & + price changes) / total count of upticks/neutral/downticks in given time frame.
- @bid: # of times gapping UP after each minute candle. These are typically market orders filled on the ASK, but are found during times when orders are large enough to take out BID orders
- @ask: # of times gapping DOWN after each minute candle. These are typically market orders filled on the BID, but are found during times when orders are large enough to take out ASK orders
- Gap|R: # of gap UPS / # of gap DOWNS. Higher ratios tend to become overly bearish after a typical show of extreme sentiment on the bullish side.
- TA: # of times trading ABOVE. This is where a $ price (distribution price for algos) is ABOVE the high price of a minute candle in a given minute
- TB: # of times trading BELOW. This is where a $ price (accumulation price for algos) is BELOW the low price of a minute candle in a given minute
- #R/Type: # of REGULAR (.35% or more) ranges seen in a given day; represented w/ high or low $ prices (a "High/Low Range")
- PivotSpread: The $ difference in ATR terms between current day's pivot price from where price is currently trading. Typically divergences > $1.00 are best for entries of a majority of tickers/trades
- %byEOD: % chg using current days closing price as % change from day's cash open price"""
- print(help_comment)
- print('\n')
- indent = ' '
- print(indent + ' Date Time Price BP% %ChgClose/Open Liquidity @bid/@ask Gap|R TA TB #R/Type PivotSpread')
- print('Current: ', curdata)
- if CurRegRangeCount >= 1:
- Range_Info.append(RR_Data)
- for i in Range_Info:
- cps_Range_ref = str(i[0])
- cps_IV = float(i[2])
- cps_MIV = float(i[8])
- cps_MIV_Ratio = float(i[9])
- cps_LFP = float(i[10])
- cps_LFPC = float(i[11])
- cps_MF = float(i[14])
- for k,v in dict.items(RR_Dict):
- print(k,v)
- print('\n')
- print('\n POSSIBLE SCENARIOS (MISCELLANIOUS) \n')
- desc = ' Date Time Price BP% %ChgClose/Open Liquidity @bid @ask Gap|R TA TB #Ranges/Type #MMRanges PivotSpread %EOD %ND %3D'
- print(desc)
- if CurRegRangeCount >= 1:
- print('RANGES OF TYPE')
- print(Range_Info)
- print('\n')
- print(' Date Time Type %Move LFPC LFP MIV MIV|R Liq_Change Money Flow %Chg_ND | %3D LFPC Spread')
- for i in all_Range_Info:
- print(i)
- lcount += 1
- print('Total items: %s' % lcount)
- else:
- print('\nLIQ, % CHG CLOSE MATCHES\n')
- print(desc)
- for i in c_CHG:
- if i in LIQ1 and i in o_CHG:
- if i in GR and i in NS:
- print(i)
- PM2.append(i)
- # print(i)
- # print('RELIABLE SIMILARITIES')
- for i in c_CHG:
- if i in LIQ1 and i in LIQ2:
- if i not in PM2:
- PM2.append(i)
- # print('CREDIBLE SIMILARITIES')
- for i in LIQ1:
- if i in NS and i in GR:
- PM1.append(i)
- if i in LIQ2:
- print(i)
- # print('CERTIFIED MATCHES\n')
- for i in GR:
- if i in LIQ2 and i not in PM1:
- PM1.append(i)
- print(i)
- print('\n TATBR')
- print(desc)
- for i in TATBR:
- if i in PVS_c:
- print(i)
- for i in PM1:
- if i in PM2:
- MASTER.append(i)
- else:
- pass
- for i in MASTER:
- print(i)
- if i not in PVS_i or i in PVS_c:
- PT_MIS.append(i)
- print('\n')
- print('HIGH POTENTIAL SCENARIOS')
- desc1 = ' Date Time Price BP% %ChgClose|Open Liquidity @bid @ask Gap|R %EOD %ND %3D'
- print(desc1)
- for i in PT_MIS:
- if i not in RR:
- sum_3D_gain += i[-1]
- sum_ND_gain += i[-1]
- x = i[:-9]
- y = i[-3:]
- z = [x, y]
- dict = {'':x, '% Chgs':y}
- print(z)
- avg_ND_gain = round(sum_ND_gain / count, 2)
- avg_3D_gain = round(sum_3D_gain / count, 2)
- if avg_3D_gain < 0:
- Accuracy = round(100*(neg_N3D_return / count), 3)
- if avg_3D_gain > 0:
- Accuracy = round(100*(pos_N3D_return / count), 3)
- print('\n')
- print('AVG ND % GAIN:', avg_ND_gain)
- print('AVG 3D % GAIN:', avg_3D_gain)
- print('TREND ACCURACY:', Accuracy)
- avg_z_gain = round(sum_z_gain / z_gain_count, 2)
- print('AVG Z GAIN:', avg_z_gain,'%')
- print('\n')
- ### [range_ref_Str, p_diffstr, p_diff, Date, military_time, Close_Price, Range, Target, MIV_Index, MIV_Ratio, LFP, LFPC, oppRange, oppTarget, Money_Flow]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement