Simple Coding Help - No Promise.

SetChartBkGradientFill(colorWhite,colorLightGrey,colorWhite);
Period= ParamList("Base","Monthly|Weekly|Daily|Hourly|15Minute|5Minute|1Minute",0);

if(Period=="Monthly"){
TimeFrameSet(inMonthly);
PlotOHLC(Open, High, Low, Close, "Monthly Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="Weekly"){
TimeFrameSet(inWeekly);
PlotOHLC(Open, High, Low, Close, "weekly Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="Daily"){
TimeFrameSet(inDaily);
PlotOHLC(Open, High, Low, Close, "Daily Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="Hourly"){
TimeFrameSet(inHourly);
PlotOHLC(Open, High, Low, Close, "Hourly Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="15Minute"){
TimeFrameSet(in15Minute);
PlotOHLC(Open, High, Low, Close, "15Minute Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="5Minute"){
TimeFrameSet(in5Minute);
PlotOHLC(Open, High, Low, Close, "5Minute Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="1Minute"){
TimeFrameSet(in1Minute);
PlotOHLC(Open, High, Low, Close, "1Minute Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}


C1=Ref(C,-1);
CHANGE=100*(C-C1)/C1;//Change Percentage
Filter=Change;
AddColumn(CHANGE,"% change");
AddColumn(Close,"close");
AddColumn(Volume,"volume");
 

john302928

Well-Known Member
Thank you for your help Tracebullet bro and Jayakumar bro,

I have couple of other queries
1, I have watchlists named, I want to arrange them in alphabetical order how to do that?
2.I have sheets named properly in one database, I want the same template to be reflacted in other data bases, Which file do i need to copy and paste?

Thanks in advance
 

TracerBullet

Well-Known Member
Thank you for your help Tracebullet bro and Jayakumar bro,

I have couple of other queries
1, I have watchlists named, I want to arrange them in alphabetical order how to do that?
2.I have sheets named properly in one database, I want the same template to be reflacted in other data bases, Which file do i need to copy and paste?

Thanks in advance
1)There is sort on symbol but you have to do manually everytime, i dont know if there is direct way to fix it.

I use workaround to manage watchlists as i need to rank them too and have to manage many scrips.
Symbol is always added to bottom on adding to a watchlist. You can use that to add them in correct order. You can use CategoryGetSymbols/CategoryAddSymbol/CategoryRemoveSymbol to do this

Example util functions below - Adapt as needed

Code:
function EraseWatchList( category, wlno ){
	oldlist = CategoryGetSymbols( category, wlno );						// retrieve watchlist members
	for ( i = 0; ( sym = StrExtract( oldlist, i ) ) != ""; i++ ){		// iterate through the list and remove tickers
      	CategoryRemoveSymbol( sym, category, wlno  );
	}
}

function isSymbolInWL( category, wlno ){

	wl_symbols = CategoryGetSymbols( category, wlno, 0 );

	sym   = "TEMP";
	found = False;	

	for( i=0; sym != "" ; i++ ){

		sym = StrExtract( wl_symbols, i );

		if( Name() == sym  ){
			found  = True;
			break;
		}
		if( sym == "" ){
			found = False;
			break;
		}
	}
	return found;
}

// Moves Input symbol in Input WatchList to Top or Bottom
function WLMoveSymbol( category, wlno, moveme, isTop ){

	if( isSymbolInWL(category, wlno) ){

		wl_symbols = CategoryGetSymbols( category, wlno, 0 );

		EraseWatchList( category, wlno );						// Empty Watchlist

		if( isTop ){
			CategoryAddSymbol( moveme, category, wlno);		// Add Top Symbol First
		}

		sym   = "TEMP";
		for( i=0; sym != "" ; i++ ){							// Now Add all other symbols

			sym = StrExtract( wl_symbols, i );

			if( sym == "" )
				break;
			if( sym == moveme  )
				continue;

			CategoryAddSymbol( sym , category, wlno);	
		}
		
		if( !isTop ){												// Add Bottom Symbol Last
			CategoryAddSymbol( moveme, category, wlno);	
		}
	}
}
 

john302928

Well-Known Member
Bro, I want to arrange the watchlist names itself in ascending order

say i have the below watchlists
Shorterm watch
medium term watch
Longterm
Intraday
Delivery

I want to arrange it as
Delivery
Intraday
Longterm
Medium term
shorterm
 

TracerBullet

Well-Known Member
Bro, I want to arrange the watchlist names itself in ascending order

say i have the below watchlists
Shorterm watch
medium term watch
Longterm
Intraday
Delivery

I want to arrange it as
Delivery
Intraday
Longterm
Medium term
shorterm
1) you can rename WL through Symbol > Categories.
2) AmibrokerDB\WatchLists\index.txt. This file has the order and i think changing it worked for me. Dont know if we can do it via AB GUI.
 

john302928

Well-Known Member
1) you can rename WL through Symbol > Categories.
2) AmibrokerDB\WatchLists\index.txt. This file has the order and i think changing it worked for me. Dont know if we can do it via AB GUI.
Thanks bro your second Idea worked for me.

By the way could you please look at my second question in the previous post.thanks
 

john302928

Well-Known Member
i dont know if it will work, but try to copy AmibrokerDB\Layouts
Or
you can save your layout in Global folder, Global layouts are saved for all DBs.

I will try.
Bro do you have any afl that can scan:-
1.Oversold Stocks with Rising RSI
2.Overbought Stocks with falling RSI
 

Similar threads