Skip to Main Content

07/07/2023 |

TrendSpider Software Update: Visual Scripting Major Upgrade

Hello, traders, and welcome to another software update from your friends here at TrendSpider! In this update, we’re excited to bring a major upgrade to our Visual Scripting functionality. Details after the jump!

If you’ve spent any time working in TrendSpider, you’re likely well aware of Visual Scripting, which allows you to create conditions for your scans, alerts, and strategies with just a click of your mouse. This update adds a whole new level of ease to your script writing, allowing you greater control in defining exactly when your conditions were met.

New ‘Happened’ Control

If you’re trading with even the simplest of plans, you’re likely looking for a condition, or a set of conditions, to be true in order to trigger an entry or exit. Depending on the requirements of your strategy and the timeframe you’re trading it on, these conditions can sometimes be fleeting and easy to miss. As a means to help you more easily define the conditions you’re looking for, we now offer the new ‘Happened’ control.

As pictured in the below image, this new ‘Happened’ dropdown menu will appear in any instance in which you are utilizing Visual Scripting. You can now choose between selecting an exact candle(s) for your conditions to occur on, or a period of candles within which your conditions have occurred.

This is an image of the new 'happened' controller.

If you’d like to be very specific about when your conditions have occurred, you can continue to write your scripts the way you always have with ‘Happened’ selected. This is the default setting.

If you’d like to give your conditions a window within which to occur, you can click the drop-down menu and switch ‘Happened’ to ‘Happened Within’ and then simply type in the number of candles contained in the window.

This is an image of the new 'happened' controller with 'happened within' selected.


At this time, the only limitation to this new functionality is the size of the candle window that can be defined. The ‘Happened Within’ window must be greater than one and less than thirty.

Use Cases

Finding More Opportunities

As mentioned above, conditions you’re interested in can be true one candle and false the next and, therefore, easy to miss especially if you’re utilizing the scanner to find setups on lower time frames.

In the below image, we’re searching the S&P 100 index for a simple moving average cross on the current hourly candle. As seen in the results, there are six symbols meeting this criterion.

This is an image of a scan that doesn't utilize the 'happened within' functionality.
It’s possible that you might find no actionable names within this small list, and therefore, you might want to search for these conditions having occurred recently instead of right now.

In the image below, the exact same condition is utilized with one specific change: We’ve defined the ‘Happened Within’ criteria to be ‘5’ candles. This means that this cross is either occurring on the current candle or any of the past four candles. By making this one simple change, the list of names meeting this criterion is quite more extensive, yielding more potential opportunities.

This is an image of a scan that utilizes the 'happened within' functionality.

Defining Condition Groups Uniquely

If your script criterion contains multiple condition groups, you can uniquely define the period within which each group’s conditions were true.

In the image below, there are three condition groups that are all defined in different ways. In the first group, we’ve defined that either one of two moving average crosses has occurred within the last 5 candles. The second defines that daily RSI was greater than 80 within the last 10 candles. Finally, the third group defines that any of the selected bullish candlestick patterns have formed on the 2-hour chart within the past 2 candles.

This is an image of a set of conditions with different 'happened within' requirements.

Using ‘Happened Within’ In The Smart Checklist

There is one small change to note when using the ‘Happened Within’ prompt in the Smart Checklist. Note the grey boxes next to the individual parameters. Since the specific candle upon which the conditions are occurring is not important, the Smart Checklist defaults to the second tier box which defines simply that the conditions contained within each group are true or false. If the box is green, then the condition is true within the candle period defined. If the box is red, the condition is not true on any of the candles within the defined period.

This is an image of 'happened within' conditions in the smart checklist.

As always, we hope you find these updates helpful and, if you have any questions, feel free to reach out to us via the ‘Contact Us’ button in the bottom right-hand corner of your chart view.