mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-10 18:23:50 +00:00
Show current stoploss line
This commit is contained in:
parent
46ca166863
commit
c1e447e163
|
@ -37,6 +37,9 @@ import {
|
|||
TooltipComponent,
|
||||
VisualMapComponent,
|
||||
VisualMapPiecewiseComponent,
|
||||
// MarkAreaComponent,
|
||||
MarkLineComponent,
|
||||
// MarkPointComponent,
|
||||
} from 'echarts/components';
|
||||
import { use } from 'echarts/core';
|
||||
import { CanvasRenderer } from 'echarts/renderers';
|
||||
|
@ -54,6 +57,9 @@ use([
|
|||
TooltipComponent,
|
||||
VisualMapComponent,
|
||||
VisualMapPiecewiseComponent,
|
||||
// MarkAreaComponent,
|
||||
MarkLineComponent,
|
||||
// MarkPointComponent,
|
||||
|
||||
CandlestickChart,
|
||||
BarChart,
|
||||
|
|
|
@ -127,6 +127,8 @@ export function generateTradeSeries(
|
|||
): ScatterSeriesOption {
|
||||
const { tradeData } = getTradeEntries(dataset, trades);
|
||||
|
||||
const openTrades = trades.filter((t) => t.is_open);
|
||||
|
||||
const tradesSeries: ScatterSeriesOption = {
|
||||
name: nameTrades,
|
||||
type: 'scatter',
|
||||
|
@ -158,6 +160,35 @@ export function generateTradeSeries(
|
|||
symbolSize: 13,
|
||||
data: tradeData,
|
||||
};
|
||||
|
||||
// Show distance to stoploss
|
||||
if (openTrades.length > 0) {
|
||||
// Ensure to import and "use" whatever feature in candleChart! (MarkLine, MarkArea, ...)
|
||||
tradesSeries.markLine = {
|
||||
symbol: 'none',
|
||||
itemStyle: {
|
||||
color: '#ff000055',
|
||||
},
|
||||
label: {
|
||||
show: true,
|
||||
position: 'middle',
|
||||
},
|
||||
lineStyle: {
|
||||
type: 'solid',
|
||||
},
|
||||
data: openTrades.map((t) => {
|
||||
return [
|
||||
{
|
||||
name: 'Stoploss',
|
||||
yAxis: t.stop_loss_abs,
|
||||
xAxis: t.open_timestamp,
|
||||
},
|
||||
{
|
||||
yAxis: t.stop_loss_abs,
|
||||
xAxis: t.close_timestamp ?? dataset.data_stop_ts,
|
||||
},
|
||||
];
|
||||
}),
|
||||
};
|
||||
}
|
||||
return tradesSeries;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user