Insider Actions

A custom indicator created by TrendSpider on TrendSpider. You can import this script into your TrendSpider account. Don't have TrendSpider? Create an account first, then import the script.

Chart featuring the Insider Actions indicator

This indicator paints the last few months of Insider trades on a given chart.

Source code

This indicator had been implemented by TrendSpider in JavaScript on TrendSpider. Check out the developer documentation to learn more about JS on TrendSpider.

// This script had been cloned from "Insider actions" at 10 Jan 2024, 08:54
describe_indicator('Insider Actions');

await plotInsiderActions(constants.ticker);


async function plotInsiderActions(ticker) {
	const trades = await request.insider_trading(ticker);
	
	const buys = trades.transactions.filter(item => item.transaction == 'buy');
	const sells = trades.transactions.filter(item => item.transaction == 'sell');
	const gifts = trades.transactions.filter(item => item.transaction == 'gift' || item.transaction == 'award');


	const buysLanded = land_points_onto_series(
		buys.map(item => item.timestamp),
		buys.map(() => ticker == constants.ticker ? 'buy' : `${ticker} buy`),
		time, 'ge'
	);

	const sellsLanded = land_points_onto_series(
		sells.map(item => item.timestamp),
		sells.map(() => ticker == constants.ticker ? 'sell' : `${ticker} sell`),
		time, 'ge'
	);

	const giftsLanded = land_points_onto_series(
		gifts.map(item => item.timestamp),
		gifts.map(() => ticker == constants.ticker ? 'gift' : `${ticker} gift`),
		time, 'ge'
	);

	
	paint(sellsLanded, { style: 'labels_above', color: 'red', backgroundBorderRadius: 4, backgroundColor: 'red' });
	paint(buysLanded, { style: 'labels_below', color: 'green', backgroundBorderRadius: 4, backgroundColor: 'green' });
	paint(giftsLanded, { style: 'labels_below', color: 'blue', backgroundBorderRadius: 4, backgroundColor: 'blue' });
}