Open AHammerLine opened 1 year ago
We have even better one: just copy the .navy
file, replace the name [OVERLAY name=PC3...
and change the legend function.
Thanks, I have read the navy docs, that's a gread idea, but I sitll have a question here. My indicator need antoher data except ohlcv for calculation, say, "amount", how could I introduce the data into navy script?
For now it's the props
field, later will also be dataStatic
For now it's the
props
field, later will also bedataStatic
What data format supposed? I past like [<timestamp>, value]
, but it didn't work。
"scripts": [
...
"props": {
"data": [
[1648360800000, 13.92],
[1648364400000, 14.92]
]
}
]
Try to add in your overlay :
prop('data', { type: 'array', def: [] })
Then:
$props.data
Try to add in your overlay :
prop('data', { type: 'array', def: [] })
Then:
$props.data
Oh, I see. What if I want to custom an indicator script? Suppose I custom a TEST
indicator to compute some data and draw by Spline
overlay, how should I specific the data format that could be recognized and handled properly? I try below these, but doesn't work.
// App.svelte
chart = new NightVision("chart-container", {
data: dataShort,
scripts: [
`
[Overlay name=TEST, versiont=1.0.0]
prop('data', { type: 'array', def: [] })
[UPDATE]
let data = ts($props.data, [])
console.log(data)
Spline(data, {
name: "test"
})
`,
],
});
and dataShort
is imported by a json file:
// dataShort.json
{
"panes": [
{
"overlays": [
{
"name": "APE / Tether US",
"type": "Candles",
"main": true,
"data": [
[
1648360800000,
13.92,
14.083,
13.5025,
13.92,
10379666.97
],
[
1648364400000,
13.92,
14.2455,
13.871,
14.157,
19149600.5
],
[
1648368000000,
14.157,
14.3755,
14.013,
14.2695,
12874309.69
],
[
1648371600000,
14.2695,
14.2695,
13.9535,
13.9645,
8899211.04
],
[
1648375200000,
13.9645,
14.076,
13.8415,
13.8525,
13092402.18
],
[
1648378800000,
13.8525,
14.029,
13.7325,
13.987,
9720198.64
],
[
1648382400000,
13.987,
14.05,
13.74,
13.74,
9190532.1
],
[
1648386000000,
13.74,
14,
13.56,
13.948,
12672318.36
],
[
1648389600000,
13.948,
14.04,
13.81,
13.838,
6286435.6
],
[
1648393200000,
13.838,
14.17,
13.781,
13.9485,
7569704.26
]
],
"settings": {},
"props": {}
}
]
},
{
"scripts": [
{
"type": "TEST",
"props": {
"data": [
4,
5,
9,
4,
1,
6,
1,
3,
6,
2
]
}
}
]
}
]
}
You need scripts to produce new data, overlays for rendering (by design).
You need scripts to produce new data, overlays for rendering (by design).
I know ... but how can I pass additional data except ohlcv to an indicator script, for illustration, suppose I download turnover data which cannot be produced by ohlcv , how could I use them as close do in ema(close, 12)
. Close is stored in a ScriptEngine object, how could I tell ScriptEngine to save my turnover data?
Description
NightVision is a great library, I enjoy the most of its fetures. However, there is some minor flaw yet.
I use histogram overlay to chart my indicator, named pc3 in second pane. The indicator doesn't need extra moving average, so I don't put the data of value and signal in overlay. The problem is that legend title still presents two "x" even without data, see my fig below.
I know the histogram overlay is designed for MACD, but it would be nicer with more flexibility.
Appriciating for your attentions.
Suggested solution
Add a propery
Histogram.showLine
in Overlay object likescandles
do. And program checks the value, if true then charts line and displays value on legend, otherwise, doesn't show it.Alternative
No response
Additional context
No response
Validations