@@ -499,12 +499,12 @@ def _construct_pf_collections(dates, highs, lows, volumes, config_tip_params, cl
499
499
new_dates = [] # holds the dates corresponding with the index
500
500
new_volumes = [] # holds the volumes corresponding with the index. If more than one index for the same day then they all have the same volume.
501
501
box_values = [] # y values for the boxes
502
- circle_patches = []
502
+ circle_patches = [] # list of circle patches to be used to create the cirCollection
503
503
line_seg = [] # line segments that make up the Xs
504
504
505
505
volume_cache = 0 # holds the volumes for the dates that were skipped
506
- index = - 1
507
- last_trend_positive = True
506
+ index = - 1 # only incremented when difference > 0
507
+
508
508
for diff_index , difference in enumerate (cdiff ):
509
509
diff = abs (int (round (difference , 0 )))
510
510
if volumes is not None : # only adds volumes if there are volume values when volume=True
@@ -522,8 +522,7 @@ def _construct_pf_collections(dates, highs, lows, volumes, config_tip_params, cl
522
522
523
523
524
524
sign = (difference / abs (difference )) # -1 or 1
525
- start_iteration = 0 if sign > 0 else 1
526
- start_iteration += 0 if (last_trend_positive and sign > 0 ) or (not last_trend_positive and sign < 0 ) else 1
525
+ start_iteration = 0 if sign > 0 else 2
527
526
528
527
x = [index ] * (diff )
529
528
y = [(curr_price + ((i + (box_size * 0.005 )) * box_size * sign )) for i in range (start_iteration , diff + start_iteration )]
@@ -549,6 +548,7 @@ def _construct_pf_collections(dates, highs, lows, volumes, config_tip_params, cl
549
548
cirCollection = PatchCollection (circle_patches )
550
549
cirCollection .set_facecolor ([tfc ] * len (circle_patches ))
551
550
cirCollection .set_edgecolor ([dc ] * len (circle_patches ))
551
+
552
552
xCollection = LineCollection (line_seg ,
553
553
colors = [uc ] * len (line_seg ),
554
554
linewidths = lw ,
0 commit comments