Tucsky / aggr

Cryptocurrency trades aggregator
https://charts.aggr.trade/
GNU General Public License v3.0
847 stars 242 forks source link

Please consider adding Vector Candle support #304

Closed OutOfThisPlanet closed 1 year ago

OutOfThisPlanet commented 1 year ago

I'm not sure if it would be easy to implement, however, I would love to see "Vector Candles" supported in the interface.

Examples in this tradingview screenshot, using the indicator called TR_MAIN (Trader's Reality): There are also volume vectors in this screenshot, using the indicator PVSRA_VS.

image

In the above image, the Vector Candles are the Green, Blue, Red, and Violet candles, and are used to show market-maker manipulation.

I became aware of this indicator via the youtube channel Traders Reality, and my trading has improved tenfold since using that strategy.

For more information, check this video :)

https://www.youtube.com/watch?v=Kwhnj80Qvn8

lmvdz commented 1 year ago

$price.color = barColour to set the bar color in aggr script

hashemh4a commented 1 year ago

is the for aggr ? if yes how to add to aggr thx mate :)

lmvdz commented 1 year ago

Script it correct, but the colors aren't printing the same as the TV script

image

lmvdz commented 1 year ago

Fixed it, was (vbuy+vsell) not (vbuy-vsell).

high = $price.high
low = $price.low
close = $price.close
open = $price.open
volume = (vbuy+vsell)

averageVolume = sum(volume[1], 10)/10.0
volumeSpread = volume*(high - low)
highestVolumeSpread = highest(volumeSpread[1], 10)
color = 
  (
    (volume >= 2*averageVolume || volumeSpread >= highestVolumeSpread) ? 
      (close > open ? options.greenVectorColor : options.redVectorColor) : 
    (volume >= 1.5*averageVolume) ? 
      (close > open ? options.blueVectorColor : options.violetVectorColor) : 
    (close > open ? options.regularCandleUpColor : options.regularCandleDownColor)
  )

histogram({
  time: time,
  value: volume < 0 ? Math.abs(volume) : volume,
  color: color
})

$price.color = color
lmvdz commented 1 year ago

@Tucsky when I modify the $price.color via indicator, the current candle doesn't use the correct color

lmvdz commented 1 year ago

image

lmvdz commented 1 year ago

image

Latest candles don't get updated with the color from the indicator

lmvdz commented 1 year ago

image Only way I've found is to open the Indicator and save it, causes the candle colors to repopulate

lmvdz commented 1 year ago

indicator_pvsra.txt

Already has the colors setup for you.

adeacetis commented 1 year ago

Hi @lmvdz,

I have tried to import your indicator to aggr.trade and I get this error:

image

Is that normal ?

OutOfThisPlanet commented 1 year ago

How do you set this up... do you have to self-host?

lmvdz commented 1 year ago

Click the Add button by indicators Click Import in bottom left Select the indicator_pvsra.txt you downloaded. Make sure your Price indicator has the name price Open the PVSRA indicator you added, and press Save. This will update the color of the bars to reflect the volume.

image

lmvdz commented 1 year ago

Will need to wait for word from @Tucsky about how to get the price bar colors to update automatically.

OutOfThisPlanet commented 1 year ago

This is truly awesome work, @lmvdz

Thanks so much!

adeacetis commented 1 year ago

Hello all,

It seems an unidentified issue prevents the chart to update bar charts colors unless you edit and save the indicator which forces repainting candles.

You might have to file a separate bug report. Let's see what @Tucsky think about that.

Tucsky commented 1 year ago

@lmvdz

This is whats happening and why the candle color isn't the one from the PVSRA indi for realtime bars :

Every refreshRate (which can go as many as your monitor's hz) it does the following

For example with price and PVSRA indi on

  1. price indicator get processed, price serie get rendered
  2. PVSRA get processed (it assigns color to price, which was already rendered), PVSRA serie(s) get rendered

To fix that issue we have to separate the script processing & rendering

More loops needed and unfortunately more memory footprint, idk how I feel about that yet but it's live on https://tucsky.github.io/aggr

OutOfThisPlanet commented 1 year ago

This is awesome :)

So many thanks, folks! :)