@@ -508,7 +508,7 @@ def _construct_pf_collections(dates, highs, lows, volumes, config_renko_params,
508
508
diff = abs (int (round (difference , 0 )))
509
509
if volumes is not None : # only adds volumes if there are volume values when volume=True
510
510
if diff != 0 :
511
- new_volumes .extend ([ volumes [diff_index ] + volume_cache ] * diff )
511
+ new_volumes .append ( volumes [diff_index ] + volume_cache )
512
512
volume_cache = 0
513
513
else :
514
514
volume_cache += volumes [diff_index ]
@@ -521,21 +521,27 @@ def _construct_pf_collections(dates, highs, lows, volumes, config_renko_params,
521
521
522
522
523
523
sign = (difference / abs (difference )) # -1 or 1
524
- x = [index ] * (diff )
525
524
start_iteration = 0 if sign > 0 else 1
526
525
start_iteration += 0 if (last_trend_positive and sign > 0 ) or (not last_trend_positive and sign < 0 ) else 1
527
526
528
- y = [(curr_price + (i * box_size * sign )) for i in range (start_iteration , diff + start_iteration )]
529
- box_values .extend (y )
527
+ x = [index ] * (diff )
528
+ y = [(curr_price + ((i + (box_size * 0.01 )) * box_size * sign )) for i in range (start_iteration , diff + start_iteration )]
529
+
530
530
531
531
spacing = 0.1 * box_size
532
532
curr_price += (box_size * sign * (diff )) + spacing
533
+ box_values .append (curr_price - spacing - box_size )
534
+
533
535
for i in range (len (x )): # x and y have the same length
536
+ height = box_size * 0.9
537
+ width = min (0.5 * (box_size * 0.2 ), 0.9 )
538
+ if height < 0.5 :
539
+ width = height
534
540
if sign == 1 : # X
535
- line_seg .append ([(x [i ]- 0.25 , y [i ]- (box_size / 2 )), (x [i ]+ 0.25 , y [i ]+ (box_size / 2 ))]) # create / part of the X
536
- line_seg .append ([(x [i ]- 0.25 , y [i ]+ (box_size / 2 )), (x [i ]+ 0.25 , y [i ]- (box_size / 2 ))]) # create \ part of the X
541
+ line_seg .append ([(x [i ]- width / 2 , y [i ]- (height / 2 )), (x [i ]+ width / 2 , y [i ]+ (height / 2 ))]) # create / part of the X
542
+ line_seg .append ([(x [i ]- width / 2 , y [i ]+ (height / 2 )), (x [i ]+ width / 2 , y [i ]- (height / 2 ))]) # create \ part of the X
537
543
else : # O
538
- circle_patches .append (Ellipse ((x [i ], y [i ]), 0.5 , box_size / 0.9 ))
544
+ circle_patches .append (Ellipse ((x [i ], y [i ]), width , height ))
539
545
useAA = 0 , # use tuple here
540
546
lw = 0.5
541
547
0 commit comments