Blocks Overview
Visual Strategy Editor
The OptionStack Visual Strategy Editor (VSE) is a no-code editor that allows you to construct your stock and options trading strategies without writing any code. Instead, you can use construct your trading strategies via drag-and-drop of visual blocks.
There are TWO steps to defining your trading strategy:
- First, define WHEN you would like to make a trade.
- Trading signals can include market / technical studies such as Bollinger Bands, implied volatility, earnings dates, etc..
- Trading signals can also include portfolio attributes such as profit / loss, ROI, option greeks (i.e. delta), breakeven points, etc..
- Second, define WHAT you would like to trade WHEN your trading signals are triggered.
- Trading actions can include opening a position, closing a position, rolling a position, legging into a position, etc..
For Each Event Block
Attach the blocks directly or indirectly to the For Each Event block. For each tick of data, the blocks attached to the Event block will be evaluated. Blocks that are detached from the Event block will be ignored.
All blocks attached to the For Each Event block will be evaluated with every tick of data. So if a Strategy block is attached to the For Each Event block without an enclosing WHEN block, the trade will be executed with each tick of data.
For example, the strategy below will sell puts with every tick of data, as long as no puts are open (no enclosing WHEN block with max open = 1 position)
In order to prevent a specific action from being evaluated with every tick of data, the action should be enclosed by a WHEN block. The actions defined inside the body of the WHEN block will only be executed when the conditions specified in the WHEN block are satisfied.
WHEN Block
The WHEN block can be used to define your trading conditions / signals. For each tick of data, the conditions in your WHEN block will be evaluated to see if they are TRUE. When the conditions are TRUE, the actions defined inside the body of the WHEN block are executed.
The WHEN blocks are usually combined with the Market Studies Block, Portfolio Studies Block, and the Comparison Block to determine whether the current market conditions satisfy your desired trading conditions.
For example, the following WHEN block below uses the Market Studies Block and the Comparison block to compare two different technical studies. It compares the value of the 50 day Moving Average with the 200 day Moving Average. (i.e. WHEN the value of the 50 day Moving average crossesAbove the 200 day Moving Average, it will trigger)
You can also combine multiple trading conditions together using the Logic block (AND, OR).
For example, the WHEN block below uses the Market Studies Block, Portfolio Studies Block, Logic Block, and the Comparison Block to trigger only when several conditions are met. (i.e. WHEN call vertical position has a 25%+ return AND 50 day Moving average is above 200 day moving average)
Block Scope
Only actions defined inside the body of the WHEN block are governed by the conditions of the WHEN block. Actions defined above or below the WHEN block are outside the scope of the WHEN block, and will NOT be governed by the conditions specified in the WHEN block.
For example, in the blocks below, the first Sell Put trade (“Sell Put 1”) will only be executed when VIX is at its upper range. But the second Sell Put trade (“Sell Put 2”) is outside the scope of the WHEN block, since it is defined below the WHEN block.
Instead of triggering only when VIX is at its upper range, the “Sell Put 2” position will be executed with each tick of data, and a new put will be sold if none is already open. (Max Open = 1)