#!/home/hoogca/virtualenv/bri/3.7/bin/python ###!/home/debian/miniconda3/bin/python3 #print("Incl wyckoff") import sys, os, math global n, nRecords, Records sideBorder=20 PriceBarpx=100 candleWidth=10 canvasW=(sideBorder+PriceBarpx)+(nRecords*candleWidth) canvasH=850 VolumeBarHeight=100 topBorder=50 HL=HighestHigh-LowestLow PriceRange=HL+(2*(HL*0.05)) PriceWindowPx=canvasH-VolumeBarHeight#-(2*topBorder) basePrice=canvasH-VolumeBarHeight #(2*topBorder)+PriceWindowPx baseVolume=basePrice+VolumeBarHeight #print(HighestHigh) svg=f""" """ barWidth=candleWidth-2 wickWith=4 if candleWidth>14: wickWith=6 if candleWidth<16: wickWith=2 debug=True for n in range(1,nRecords): X=(sideBorder)+(n*candleWidth) nhX=(sideBorder)+(Records['PeakHigh'][n]*candleWidth) hY=round((PriceWindowPx)-( ((Records['high'][n]-LowestLow)*PriceWindowPx) / PriceRange )) nhY=round((PriceWindowPx)-( ((Records['high'][Records['PeakHigh'][n]]-LowestLow)*PriceWindowPx) / PriceRange )) #svg+=f""" \n""" if debug: svg+=f""" \n""" nlX=(sideBorder)+(Records['PeakLow'][n]*candleWidth) lY=round((PriceWindowPx)-( ((Records['low'][n]-LowestLow)*PriceWindowPx) / PriceRange )) nlY=round((PriceWindowPx)-( ((Records['low'][Records['PeakLow'][n]]-LowestLow)*PriceWindowPx) / PriceRange )) #svg+=f""" \n""" if debug: svg+=f""" \n""" if n\n""" cY=round((PriceWindowPx)-( ((Records['close'][n]-LowestLow)*PriceWindowPx) / PriceRange )) #oY=cY+( ((openX-close)*PriceWindowPx) / PriceRange ) #oY=(PriceWindowPx)-( ((openX-LowestLow)*PriceWindowPx) / PriceRange ) hY=round((PriceWindowPx)-( ((Records['high'][n]-LowestLow)*PriceWindowPx) / PriceRange )) lY=round((PriceWindowPx)-( ((Records['low'][n]-LowestLow)*PriceWindowPx) / PriceRange )) svg+=f""" \n"""#100,0,0 svg+=f""" \n"""#0,100,0 svg+=f""" \n""" if Records['spread'][n] > (Records['spreadMA'][n]*2): svg+=f""" \n"""#100,0,0 svg+=f""" \n"""#0,100,0 if Records['spread'][n] > (GlobalSpreadAvg*2) and abs(Records['gain'][n]) > (GlobalGainAvg*2): svg+=f""" \n"""#100,0,0 svg+=f""" \n"""#0,100,0 #zY=round((PriceWindowPx)-( ((Records['avgZZMA5'][n]-LowestLow)*PriceWindowPx) / PriceRange )) #pzY=round((PriceWindowPx)-( ((Records['avgZZMA5'][n-1]-LowestLow)*PriceWindowPx) / PriceRange )) #if Records['avgZZMA5slope'][n]>slope: clr="0,200,0" #elif Records['avgZZMA5slope'][n]<-slope: clr="200,0,0" #else: clr="0,0,200" #if Records['direction'][n]=="up": clr="0,200,0" #elif Records['direction'][n]=="dn": clr="200,0,0" #else: clr="0,0,200" #svg+=f""" \n""" #avgMomentumWave, avgVolumeWave, HighestMomentumWave, HighestVolumeWave #vY=(baseVolume)-( ((volume)*VolumeBarHeight) / HighestVolume ) #svg+=f""" \n""" #0,0,100 #if Records['direction'][n]>="up": # vwY=round((basePrice)-( (Records['MomentumWave'][n]*(VolumeBarHeight/1)) / HighestMomentumWave )) # svg+=f""" \n""" #else: # vwY=(basePrice)-( (Records['MomentumWave'][n]*(VolumeBarHeight/1)) / HighestMomentumWave ) # svg+=f""" \n""" #vwY=round((basePrice)-( (avgMomentumWave*(VolumeBarHeight/1)) / HighestMomentumWave )) #svg+=f""" \n""" # if Records['direction'][n]>="up": # vwY=round((basePrice)-( (abs(Records['VolumeWave'][n])*(VolumeBarHeight/1)) / HighestVolumeWave )) # svg+=f""" \n""" # else: # vwY=(basePrice)-( (abs(Records['VolumeWave'][n])*(VolumeBarHeight/1)) / HighestVolumeWave ) # svg+=f""" \n""" # vwY=round((basePrice)-( (avgVolumeWave*2*(VolumeBarHeight/1)) / HighestMomentumWave )) # svg+=f""" \n""" #peaks=peaks.rstrip(",") #hprint(peaks) #peakArr=peaks.split(",") #for npeak in range(0,len(peakArr)): # if npeak>0: # # FROM=peakArr[npeak-1] # if FROM.find("H")==0: # nFROM=int(FROM.replace("H","")) # FROMprice=Records['high'][nFROM] # else: # nFROM=int(FROM.replace("L","")) # FROMprice=Records['low'][nFROM] # TO=peakArr[npeak] # if TO.find("H")==0: # nTO=int(TO.replace("H","")) # TOprice=Records['high'][nTO] # else: # nTO=int(TO.replace("L","")) # TOprice=Records['low'][nTO] # # #hprint(f"{nFROM}|{FROMprice} .. {nTO}|{TOprice}") # XF=(sideBorder)+(nFROM*candleWidth) # XT=(sideBorder)+(nTO*candleWidth) # YF=round((PriceWindowPx)-( ((FROMprice-LowestLow)*PriceWindowPx) / PriceRange )) # YT=round((PriceWindowPx)-( ((TOprice-LowestLow)*PriceWindowPx) / PriceRange )) # svg+=f""" \n""" # #svg+=f""" \n""" for p in range(0,len(Peaks)): XF=(sideBorder)+(Peaks['Start'][p]*candleWidth) XT=(sideBorder)+(Peaks['End'][p]*candleWidth) if Peaks['Direction'][p]=="up": YF=round((PriceWindowPx)-( ((Records['low'][Peaks['Start'][p]]-LowestLow)*PriceWindowPx) / PriceRange )) YT=round((PriceWindowPx)-( ((Records['high'][Peaks['End'][p]]-LowestLow)*PriceWindowPx) / PriceRange )) elif Peaks['Direction'][p]=="dn": YF=round((PriceWindowPx)-( ((Records['high'][Peaks['Start'][p]]-LowestLow)*PriceWindowPx) / PriceRange )) YT=round((PriceWindowPx)-( ((Records['low'][Peaks['End'][p]]-LowestLow)*PriceWindowPx) / PriceRange )) #svg+=f""" \n""" #svg+=f""" \n""" if len(Peaks['WaveTookOut'][p])>0: #hprint(Peaks['WaveTookOut'][p]) for w in Peaks['WaveTookOut'][p].rstrip(",").split(","): nPeakTookOut=int(w.split("|")[0]) nBarTookOut=int(w.split("|")[1]) if Peaks['Direction'][p]=="up": XF=(sideBorder)+(nBarTookOut*candleWidth) XT=(sideBorder)+(Peaks['End'][p]*candleWidth) #YF=round((PriceWindowPx)-( ((Records['low'][Peaks['Start'][nPeakTookOut]]-LowestLow)*PriceWindowPx) / PriceRange )) YT=round((PriceWindowPx)-( ((Records['high'][Peaks['End'][p]]-LowestLow)*PriceWindowPx) / PriceRange )) svg+=f""" \n""" elif Peaks['Direction'][p]=="dn": XF=(sideBorder)+(nBarTookOut*candleWidth) XT=(sideBorder)+(Peaks['End'][p]*candleWidth) #YF=round((PriceWindowPx)-( ((Records['low'][Peaks['Start'][nPeakTookOut]]-LowestLow)*PriceWindowPx) / PriceRange )) YT=round((PriceWindowPx)-( ((Records['low'][Peaks['End'][p]]-LowestLow)*PriceWindowPx) / PriceRange )) svg+=f""" \n""" else: if Peaks['Direction'][p]=="up": XF=(sideBorder)+(len(Records)*candleWidth) XT=(sideBorder)+(Peaks['End'][p]*candleWidth) #YF=round((PriceWindowPx)-( ((Records['low'][Peaks['Start'][nPeakTookOut]]-LowestLow)*PriceWindowPx) / PriceRange )) YT=round((PriceWindowPx)-( ((Records['high'][Peaks['End'][p]]-LowestLow)*PriceWindowPx) / PriceRange )) svg+=f""" \n""" elif Peaks['Direction'][p]=="dn": XF=(sideBorder)+(len(Records)*candleWidth) XT=(sideBorder)+(Peaks['End'][p]*candleWidth) #YF=round((PriceWindowPx)-( ((Records['low'][Peaks['Start'][nPeakTookOut]]-LowestLow)*PriceWindowPx) / PriceRange )) YT=round((PriceWindowPx)-( ((Records['low'][Peaks['End'][p]]-LowestLow)*PriceWindowPx) / PriceRange )) svg+=f""" \n""" svg+=f"""""" print(svg)