amisur
November 5, 2020, 4:06pm
1
When I change the Watchlist Name , The Ticker Symbols from the Selected Watchlist are not updating. Is there any other Method to achieve this?
_SECTION_BEGIN("Relative Performance 4");
WatchlistName = ParamList("WatchList", "Nifty-Auto,Nifty-Bank");
wlnumber = CategoryFind(WatchlistName, categoryWatchlist );
Watchlist = CategoryGetSymbols( categoryWatchlist, wlnumber );
SymbolList = StrReplace(Watchlist, ",", ",");
_N( TickerList = ParamStr( "Tickers", Symbollist ) );
fontsize = Param("Label font size", 10, 4, 30, 1 );
fvb = Status( "firstvisiblebar" );
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 );
x = LastValue( BarIndex() ) + 1;
y = LastValue( relP );
PlotTextSetFont( symbol, "Arial", fontsize, x, y, GetChartBkColor(), color, -fontsize/2 );
}
}
PlotGrid( 0, colorYellow );
_SECTION_END();
Note:- I referred this thread before posting this question
hi i know the basic def paramlist
OrderType = ParamList(“Order Type”, “MKT|LMT|STP” ); OrderType = ParamList(“Order Type”, “MKT|LMT|STP” );
but if want to get a watchlist of stocks in paramlist how can i do it . can you kindly give solution on how it can be done
beppe
November 6, 2020, 10:47am
2
@amisur , remove the unneeeded ParamStr call.
_SECTION_BEGIN("Relative Performance 4");
WatchlistName = ParamList("WatchList", "List 0,List 1");
_TRACE(WatchlistName);
wlnumber = CategoryFind(WatchlistName, categoryWatchlist );
// watchlist = CategoryGetSymbols( categoryWatchlist, wlnumber );
tickerlist = CategoryGetSymbols( categoryWatchlist, wlnumber );
_TRACE("WL number " + wlnumber);
// SymbolList = StrReplace(Watchlist, ",", ",");
// _TRACE("Symbol list" + symbollist);
// _N( TickerList = ParamStr( "Tickers", Symbollist ) );
_TRACE("Ticker list" + tickerlist);
fontsize = Param("Label font size", 10, 4, 30, 1 );
fvb = Status( "firstvisiblebar" );
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 );
x = LastValue( BarIndex() ) + 1;
y = LastValue( relP );
PlotTextSetFont( symbol, "Arial", fontsize, x, y, GetChartBkColor(), color, -fontsize/2 );
}
}
PlotGrid( 0, colorYellow );
_SECTION_END();
I did not check the rest of code.
1 Like
fxshrat
November 6, 2020, 11:03am
3
This is improper code line.
Parameters are cached . So you should not insert variable code. Symbollist
is variable that changes.
So remove ParamStr.
_N( TickerList = Symbollist );
or simply use Watchlist
variable instead of TickerList
.
Lol all of the sudden 2nd post has changed.
BTW, @amisur
Tomasz has told you here something about code copy:
Main code you copied is from here
2 Likes
beppe
November 6, 2020, 11:05am
4
@amisur , please, note that for a quick test, in the above snippet I changed your watchlists names (replace them as per your original code).
1 Like
amisur
November 6, 2020, 11:57am
5
@beppe
Thank you for the help. Everything is perfect now.
amisur
November 6, 2020, 12:05pm
6
@fxshrat
Thank you for the help. I am sorry, I will make it sure that I strictly adhere with the forum rules from my next post. I picked the code randomly from a folder and I was not aware that the code was a part of Knowledge Base Article. Nothing was intentional nor meant any kind of disrespect to the authors.
system
Closed
February 14, 2021, 12:05pm
7
This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.