BTC Relative Price Percent Performance Chart

On the Relative Performance Chart...
I am not that good with arrays yet...

  1. I would like to set the "index" to BTC-USD;
  2. How do I sort the left side display of the array in Descending Order
  3. I would like to actually see the Tickers and Values in the Chart Pane with the symbol.

Any help appreciated in advance.
Mr V

//Relative Performance Chart to BTC Index


_N( TickerList = ParamStr( "Tickers", "AAVE-BTC,ADA-BTC,ADK-BTC,ADX-BTC,AE-BTC,AEON-BTC,AION-BTC,ALGO-BTC,ALIAS-BTC,AMB-BTC,AMP1-BTC,ANT-BTC,AR-BTC,ARDR-BTC,ARK-BTC,ARRR-BTC,ATOM1-BTC,ATRI-BTC,AVAX-BTC,AXEL-BTC,AYA-BTC,BAT-BTC,BCA-BTC,BCD-BTC,BCH-BTC,BDX-BTC,BEAM-BTC,BHD-BTC,BHP-BTC,BLK-BTC,BLOCK-BTC,BNB-BTC,BNT-BTC,BONO-BTC,BPC-BTC,BPS-BTC,BRC-BTC,BST-BTC,BSV-BTC,BTC-USD,BTC2-BTC,BTG-BTC,BTM-BTC,BTS-BTC,BTT1-BTC,BTX-BTC,CCA-BTC,CCXX-BTC,CEL-BTC,CELO-BTC,CHI-BTC,CHZ-BTC,CLAM-BTC,COTI-BTC,CRO-BTC,CRU-BTC,CRV-BTC,CRW-BTC,CTC1-BTC,CTXC-BTC,CURE-BTC,CUT-BTC,CVC-BTC,DAG-BTC,DASH-BTC,DCR-BTC,DDK-BTC,DERO-BTC,DFI-BTC,DGB-BTC,DGD-BTC,DIVI-BTC,DMCH-BTC,DMD-BTC,DNT-BTC,DOGE-BTC,DOT1-BTC,DTEP-BTC,DYN-BTC,EGLD-BTC,ELA-BTC,EMC2-BTC,ENJ-BTC,EOS-BTC,ERG-BTC,ETC-BTC,ETH-BTC,ETP-BTC,EWT-BTC,FAIR-BTC,FCT-BTC,FIL-BTC,FIO-BTC,FIRO-BTC,FLO-BTC,FSN-BTC,FTC-BTC,FUN-BTC,GAME-BTC,GAS-BTC,GBYTE-BTC,GHOST-BTC,GHO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UMA-BTC,UNI-BTC,UNI3-BTC,UNO-BTC,USDC-BTC,USDT-BTC,USNBT-BTC,VAL1-BTC,VERI-BTC,VET-BTC,VGX-BTC,VIA-BTC,VITAE-BTC,VITE-BTC,VLX-BTC,VRA-BTC,VSYS-BTC,VTC-BTC,WAN-BTC,WAVES-BTC,WAXP-BTC,WGR-BTC,WICC-BTC,WINGS-BTC,WOZX-BTC,WTC-BTC,XCP-BTC,XDC-BTC,XEM-BTC,XHV-BTC,XLM-BTC,XLQ-BTC,XLT-BTC,XMC-BTC,XMR-BTC,XNC-BTC,XRC-BTC,XRP-BTC,XSN-BTC,XTZ-BTC,XUC-BTC,XVG-BTC,XWC-BTC,YEP-BTC,YFI-BTC,YOYOW-BTC,ZANO-BTC,ZEC-BTC,ZEL-BTC,ZEN-BTC,ZIL-BTC,ZNN-BTC,ZRX-BTC,ZYN-BTC" ) );
fontsize = Param("Label font size", 10, 4, 30, 1 );
fvb = Status( "firstvisiblebar" );
index = Foreign("BTC-USD", "C"); //All Performance Relative to BTC-USD

for( i = 0; ( symbol = StrExtract( Name() + "," + TickerList, i ) ) != ""; i++ )
{
    fc = Foreign( symbol, "C" );
    
    if( ! IsNull( fc[ 0 ] ) )
    {
        relP = 100 * ( fc - fc[ fvb ] ) / fc[ fvb ];
        Plot( relP , "\n" + symbol, color = colorLightOrange + ( ( 2 * i ) % 15 ), styleLine );

        x = LastValue( BarIndex() ) + 1;
        y = LastValue( relP );

        PlotTextSetFont( symbol, "Arial", fontsize, x, y, GetChartBkColor(), color, -fontsize/2 );
    }
}

PlotGrid( 0, colorYellow );
_N( Title = "{{NAME}} - Relative Performance [%]: {{VALUES}}" );
  1. Also, How do I change from fvb, status first visible bar to just the last 260 days?
    Thanks
    Mr V

Come on. Did you tried anything on your own before posting? Please follow this advice: How to ask a good question

You just assign any value to fvb you want

fvb = any value you want

Example:

fvb = BarCount - 260; 

If your BarCount may be less than 260, you better make sure that fvb is not less than zero:

fvb = Max( BarCount - 260, 0 );
3 Likes

TJ,
Thank You for pointing out great several solutions.
I did not see that in the KB.
Mr V

Using AQ for data with Yahoo symbols...
Here is what I have so far...

Goal: To get the Relative Performance Chart and Exploration to Agree in descending order
How do I,

  1. Get the exploration data to match the charted data of symbol and relP, the percentages do not match, and I don't know where my error is. The symbols and percentages don't agree.

  2. Question: Can one create an array of variable relP and sort it in descending order and display that down the left side of the chart, similar to chart display now, but with a descending sort?
    I'm sure it can be done, I don't know how.
    Thanks for any input in advance.
    Mr V

GraphXSpace = 15;
SetChartOptions( 0, chartShowDates ); 
SetBarsRequired(100000,0);
//SetSortColumns( -6 );
SetSortColumns( -2,-4 );


///////////////////////////
/*
_Open = Open;
//_OpenText = NumToStr(_Open,8.7,True,False);
//customCloseformat = IIF(Close > 0.99999, 8.2 ,8.9);
_Close = Close;
//_CloseText = NumToStr(_Close,8.7 ,True,False);


_ROpen = Open;
fmt = IIf( LastValue( Open ) >= 1.00, 1.2, 1.7 );
//AddColumn( _ROpen, "Open", fmt );
//Plot(_ROpen ,"Open",2,1);
_RROpen = NumToStr(_ROpen,fmt);


_RHigh = High;
fmt = IIf( LastValue( High ) >= 1.00, 1.2, 1.7 );
//AddColumn( _RHigh, "High", fmt );
//Plot(_RHigh ,"High",2,1);
_RRHigh = NumToStr(_RHigh,fmt);

_RLow = Low;
fmt = IIf( LastValue( Low ) >= 1.00, 1.2, 1.7 );
//AddColumn( _RLow, "Low", fmt );
//Plot(_RLow ,"Low",2,1);
_RRLow = NumToStr(_RLow,fmt);
*/


_RClose = Close;
fmt = IIf( LastValue( Close ) >= 1.00, 1.2, 1.7 );
//AddColumn( _RClose, "Close", fmt );
//Plot(_RClose ,"Close",2,1);
_RRClose = NumToStr(_RClose,fmt);


///////////////////////////

_N( TickerList = ParamStr( "Tickers", "AAVE-BTC,ADA-BTC,ADK-BTC,ADX-BTC,AE-BTC,AEON-BTC,AION-BTC,ALGO-BTC,ALIAS-BTC,AMB-BTC,AMP1-BTC,ANT-BTC,AR-BTC,ARDR-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TC,XNC-BTC,XRC-BTC,XRP-BTC,XSN-BTC,XTZ-BTC,XUC-BTC,XVG-BTC,XWC-BTC,YEP-BTC,YFI-BTC,YOYOW-BTC,ZANO-BTC,ZEC-BTC,ZEL-BTC,ZEN-BTC,ZIL-BTC,ZNN-BTC,ZRX-BTC,ZYN-BTC" ) );  // Database Ticker List of BTC Symbols using AmiQuote on Yahoo data
fontsize = Param("Label font size", 10, 4, 30, 1 );
//fvb = Status( "firstvisiblebar" );
fvb = Max( BarCount - 260, 0 ); //Sets Relative Price to Time Frame
//index = Foreign("BTC-USD", "C");

for( i = 0; ( symbol = StrExtract( Name() + "," + TickerList, i ) ) != ""; i++ )
{
    fc = Foreign( symbol, "C" );
    

    if( ! IsNull( fc[ 0 ] ) )
    {
        relP = 100 * ( fc - fc[ fvb ] ) / fc[ fvb ];
        //Plot( relP , symbol, color = colorLightOrange + ( ( 2 * i ) % 15 ), styleLine );
        Plot( relP , "\n" + symbol, color = colorLightOrange + ( ( 2 * i ) % 15 ), styleLine );

        x = LastValue( BarIndex() ) + 1;
        y = LastValue( relP );

        PlotTextSetFont( symbol +" :" + relP + " %", "Arial", fontsize, x, y, GetChartBkColor(), color, -fontsize/2 );
    }
}

PlotGrid( 0, colorYellow );
_N( Title = "{{NAME}} - Relative Performance [%]: {{VALUES}}" );


Filter = Close;
AddTextColumn(_RRClose,"Close");
AddColumn(relP,"Relative Performance %               ");

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.