refactor: Improve SunnyBands target price calculation using band range
This commit is contained in:
parent
fe2b13dff5
commit
3f10207481
@ -355,10 +355,15 @@ def run_sunny_scanner(min_price: float, max_price: float, min_volume: int, portf
|
||||
try:
|
||||
entry_price = last_day['close']
|
||||
upper_band = results['upper_band'].iloc[-1]
|
||||
# Calculate a more aggressive target price (2x the distance to upper band)
|
||||
band_distance = upper_band - entry_price
|
||||
target_price = entry_price + (band_distance * 2)
|
||||
print(f"Debug: Entry: ${entry_price:.2f}, Upper Band: ${upper_band:.2f}, Target: ${target_price:.2f}") # Debug line
|
||||
dma = results['dma'].iloc[-1]
|
||||
|
||||
# Calculate band distances
|
||||
band_range = upper_band - dma # Distance from middle to upper band
|
||||
|
||||
# Set target as one full band range above the upper band
|
||||
target_price = upper_band + band_range
|
||||
|
||||
print(f"Debug: Entry: ${entry_price:.2f}, DMA: ${dma:.2f}, Upper Band: ${upper_band:.2f}, Target: ${target_price:.2f}")
|
||||
position = calculator.calculate_position_size(
|
||||
entry_price=entry_price,
|
||||
target_price=target_price
|
||||
|
||||
Loading…
Reference in New Issue
Block a user