Skip to content

Commit

Permalink
Ensure stop line is visible for new trades
Browse files Browse the repository at this point in the history
  • Loading branch information
xmatthias committed Jul 29, 2023
1 parent c1e447e commit bc88cd1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/shared/charts/tradeChartData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,13 @@ export function generateTradeSeries(
// Show distance to stoploss
if (openTrades.length > 0) {
// Ensure to import and "use" whatever feature in candleChart! (MarkLine, MarkArea, ...)
// Offset to avoid having the line at the very end of the chart
const offset = dataset.timeframe_ms * 10;

tradesSeries.markLine = {
symbol: 'none',
itemStyle: {
color: '#ff000055',
color: '#ff0000AA',
},
label: {
show: true,
Expand All @@ -180,7 +183,10 @@ export function generateTradeSeries(
{
name: 'Stoploss',
yAxis: t.stop_loss_abs,
xAxis: t.open_timestamp,
xAxis:
dataset.data_stop_ts - offset > t.open_timestamp
? t.open_timestamp
: dataset.data_stop_ts - offset,
},
{
yAxis: t.stop_loss_abs,
Expand Down

0 comments on commit bc88cd1

Please sign in to comment.