| Documentation

DipScript Language Reference

DipScript is a Domain-Specific Language for creating automated stock trading strategies. Write trading rules in readable syntax that executes line by line as market conditions change.

No results found

Try adjusting your search terms or browse the navigation menu.

Introduction

DipScript bridges the gap between complex algorithmic trading and accessible strategy creation. Whether you're a seasoned trader or just starting out, DipScript allows you to translate trading concepts directly into executable code without requiring extensive programming knowledge.

What Makes DipScript Different?

Traditional trading platforms require you to manually watch the market and execute trades. Programming-based solutions require advanced coding skills. DipScript gives you the best of both worlds: automation with simplicity.

  • Human-Readable Syntax: Write "IF $PROFIT > 1000 THEN SELL $ALL" instead of complex code
  • Real-Time Execution: Your strategy runs continuously, checking conditions as the market moves
  • Built-In Variables: Automatic tracking of profits, positions, and market data
  • Smart Percentages: Natural percentage calculations that work the way you think
  • No Manual Monitoring: Set it and let it run—perfect for day trading when speed matters
Simple Example
Here's a basic momentum strategy that demonstrates core DipScript concepts:
TICKER NVDA

// Buy if we haven't bought before
IF $LAST_BUY_PRICE = NULL THEN OBTAIN 400 @ $MARKET_PRICE

// Take profit when up $1000
IF $PROFIT > 1000 THEN SELL $ALL @ $MARKET_PRICE

This script buys 400 shares of NVIDIA at the current market price (if you haven't bought yet), then automatically sells everything when your profit reaches $1,000. No watching required.

Why DipScript for Day Trading?

Day trading requires split-second decisions and constant market monitoring. Missing a price movement by seconds can mean the difference between profit and loss. DipScript solves this by executing your trading rules automatically, faster than any human can.

The Day Trading Challenge

Imagine you're day trading Tesla. You want to buy when the price dips 2% below your last sell, and sell when you're up $500. Doing this manually means:

  • Constantly watching the price ticker
  • Calculating percentages in your head
  • Remembering your last sell price
  • Placing orders manually (and hoping you're fast enough)
  • Tracking your profit across multiple trades

With DipScript, this becomes two simple lines:

IF $MARKET_PRICE <= $LAST_SELL_PRICE - 2% THEN OBTAIN 100 @ $MARKET_PRICE
IF $PROFIT > 500 THEN SELL $ALL @ $MARKET_PRICE

Perfect for Multiple Trading Styles

  • Scalping: Quick in-and-out trades capturing small price movements
  • Momentum Trading: Riding price trends with trailing stops
  • Breakout Trading: Automatic entry when price breaks resistance levels
  • Mean Reversion: Buying dips and selling rallies systematically

For Non-Programmers

You don't need to be a programmer to use DipScript. If you understand trading concepts like "buy low, sell high" and "stop loss," you can write DipScript. The syntax reads like plain English: "IF my profit is greater than $500 THEN SELL all my shares."

Quick Start

Every DipScript follows the same basic structure:

  1. Ticker Declaration: TICKER [SYMBOL] (required first line)
  2. Trading Rules: IF statements and commands that define your strategy
  3. Execution: Scripts run continuously, checking conditions as market data updates

Syntax Rules

  • All syntax keywords are UPPERCASE (IF, THEN, OBTAIN, SELL, etc.)
  • Variables start with $ and contain no spaces
  • Each IF statement performs only one action
  • Comments start with //
  • Commands follow: <ACTION> <AMOUNT> @ <PRICE>

Your First Strategy in 5 Minutes

Let's build a simple profit-taking strategy step by step:

// Step 1: Declare what stock you're trading
TICKER AAPL

// Step 2: Buy 100 shares if you don't have any yet
IF $ALL = 0 THEN OBTAIN 100 @ $MARKET_PRICE

// Step 3: Sell when profit hits $200
IF $PROFIT > 200 THEN SELL $ALL @ $MARKET_PRICE

// Step 4: Cut losses if down $100
IF $PROFIT < -100 THEN SELL $ALL @ $MARKET_PRICE

That's it! This strategy automatically buys 100 shares of Apple, takes profit at $200 gain, and cuts losses at $100 down. The script runs continuously and executes these rules for you.

Language Structure

DipScript uses a simple, readable syntax where each line represents a complete instruction. Below is a comprehensive visual reference showing all available syntax patterns and options.

DipScript Syntax Diagrams

Command Format

All trading commands follow a consistent structure that mirrors how you think about trades:

// Standard format: ACTION + QUANTITY + @ + PRICE
OBTAIN 100 @ $MARKET_PRICE

// Fractional shares format: ACTION + USD + DOLLAR_AMOUNT
OBTAIN USD 5000

IF Statement Format

Conditional logic uses IF...THEN structure:

IF CONDITION THEN COMMAND AMOUNT @ PRICE

// Real example:
IF $PROFIT > 1000 THEN SELL $ALL @ $MARKET_PRICE

How Scripts Execute

DipScript processes your strategy line by line from top to bottom. When the market price updates, the engine checks each IF condition. When a condition becomes true, the associated command executes immediately. This happens continuously in real-time as market data streams in.

Important: Only one action can execute per line. If multiple conditions are true at the same time, they'll all execute (in order from top to bottom).

Variables

DipScript automatically tracks everything you need to know about your trades. You never have to manually calculate profits, remember prices, or track positions. Just reference the built-in variables.

All Available Variables

Variable Type Description
$PROFIT number Current profit/loss for active position
$TOTAL_PROFIT number Total profit/loss since script started
$PEAK_PROFIT number Highest profit reached since last sell
$PEAK_TOTAL_PROFIT number Highest total profit ever achieved
$ALL number Current quantity of shares owned
$HALF number Half of shares owned (half of $ALL)
$AMOUNT_OWNED number Same as $ALL
$MAX number Maximum shares affordable (for SELL commands, automatically becomes $ALL)
$MARKET_PRICE number Current real-time market price
$TICKER string Current stock symbol
$PEAK_PRICE number Highest market price since last trade
$LOWEST_PRICE number Lowest market price since last sell
$LAST_BUY_PRICE number Price per share of most recent purchase
$LAST_SELL_PRICE number Price per share of most recent sale
$LAST_BUY_AMOUNT number Quantity of shares in most recent purchase
$LAST_SELL_AMOUNT number Quantity of shares in most recent sale
$AMOUNT_INVESTED_SINCE_LAST_TRADE number Total dollars invested in current position
$TOTAL_AMOUNT_INVESTED number Total dollars invested across all trades
$BUY_TRADE_COUNT number Total number of buy transactions executed
$SELL_TRADE_COUNT number Total number of sell transactions executed
$ACCOUNT_EQUITY number Account equity (cash + stock value)
$BUYING_POWER number Available buying power in the account
$DAY_TRADES number Day trade count in rolling 5-business-day window
$REMAINING_DAY_TRADES number Remaining day trades before PDT flag (-1 if unlimited)

Profit & Performance Variables

These variables track your money—how much you're making or losing:

$PROFIT

Current profit/loss in dollars for your active position. Positive = making money, negative = losing money.

$TOTAL_PROFIT

Total profit/loss in dollars since your script started. Includes all closed trades.

$PEAK_PROFIT

Highest profit in dollars you've reached since your last sell. Useful for trailing stops.

$PEAK_TOTAL_PROFIT

Highest total profit ever achieved across all trades. Your all-time high.

Understanding Profit Variables
Here's how profit variables work in practice:
  • You buy 100 shares of NVDA at $100 each ($10,000 invested)
  • Price rises to $105: $PROFIT = $500, $PEAK_PROFIT = $500
  • Price rises to $110: $PROFIT = $1000, $PEAK_PROFIT = $1000
  • Price drops to $108: $PROFIT = $800, $PEAK_PROFIT = $1000 (unchanged)
  • You sell at $108: $TOTAL_PROFIT = $800, position closes
  • You buy again and make $300: $TOTAL_PROFIT = $1100

Calculating Profit Percentages

DipScript focuses on dollar values to avoid mathematical ambiguity. If you need percentage-based logic, calculate it using dollar variables:

// To check if profit is greater than 20%:
IF $PROFIT > $AMOUNT_INVESTED_SINCE_LAST_TRADE * 20% THEN SELL $ALL @ $MARKET_PRICE

// To check if total profit is greater than 15% of total invested:
IF $TOTAL_PROFIT > $TOTAL_AMOUNT_INVESTED * 15% THEN SELL $ALL @ $MARKET_PRICE

Position & Trading Variables

These variables tell you what you own and your trading history:

$ALL / $AMOUNT_OWNED

How many shares you currently own. $AMOUNT_OWNED is an alias for $ALL. Use this to sell everything: SELL $ALL @ $MARKET_PRICE

$HALF

Half of the shares you currently own (half of $ALL). Useful for partial position exits: SELL $HALF @ $MARKET_PRICE

$MAX

Maximum shares you can afford at current price with available cash. Includes a 1% buffer for market order slippage to ensure your order doesn't fail due to price movement. Perfect for buying with all available funds: OBTAIN $MAX @ $MARKET_PRICE. Note: When used with SELL commands, $MAX is automatically converted to $ALL (your current position size), since "maximum affordable" doesn't apply to selling.

$LAST_BUY_PRICE

Price per share of your most recent purchase. Useful for calculating breakeven points.

$LAST_SELL_PRICE

Price per share of your most recent sale.

$LAST_BUY_AMOUNT

Number of shares in your most recent purchase.

$LAST_SELL_AMOUNT

Number of shares in your most recent sale.

Market & Investment Variables

Live market data and investment tracking:

$MARKET_PRICE

Current real-time market price of the stock. This is constantly updated and reflects live market data.

$TICKER

Current stock symbol (e.g., "AAPL", "TSLA"). Useful when running the same script on multiple stocks.

$PEAK_PRICE

Highest market price reached since your last trade. Great for trailing stops: IF $MARKET_PRICE < $PEAK_PRICE - 5 THEN SELL $ALL

$LOWEST_PRICE

Lowest market price since your last sell. Useful for dip buying strategies.

$AMOUNT_INVESTED_SINCE_LAST_TRADE

Total dollars you've invested in your current position. Resets when you fully exit a position.

$TOTAL_AMOUNT_INVESTED

Total dollars invested across all trades since script started. Cumulative value that never resets.

Trade Counting Variables

Track how many trades you've made:

$BUY_TRADE_COUNT

Total number of buy transactions executed. Useful for limiting entries: IF $BUY_TRADE_COUNT < 3 THEN OBTAIN 100

$SELL_TRADE_COUNT

Total number of sell transactions executed. Track your trading frequency and execution count.

Account & PDT Variables

These variables help you navigate Pattern Day Trader (PDT) rules and manage your account. PDT rules restrict accounts under $25,000 to 3 day trades per rolling 5-business-day period.

$ACCOUNT_EQUITY

Your total account equity (cash + stock value). Use this to check if you're above the $25,000 PDT threshold: IF $ACCOUNT_EQUITY >= 25000 THEN OBTAIN 100 @ $MARKET_PRICE

$BUYING_POWER

Your available buying power in the account. This is the amount you can use to purchase securities. For margin accounts, this may be higher than your cash balance. Use this to ensure you have sufficient funds before placing orders: IF $BUYING_POWER > 1000 THEN OBTAIN 10 @ $MARKET_PRICE

$DAY_TRADES

Number of day trades executed in the rolling 5-business-day window. A day trade is a buy and sell of the same security on the same day. Use this to track how close you are to PDT limits.

$REMAINING_DAY_TRADES

Number of day trades remaining before hitting the PDT limit. Returns -1 if your account has unlimited day trades (equity >= $25,000 or already flagged as PDT). For accounts under $25k, this shows how many of the 3 allowed day trades you have left.

PDT-Aware Trading Strategy
// Create a macro to check if day trading is allowed
SET $CAN_DAY_TRADE = $REMAINING_DAY_TRADES > 0 OR $ACCOUNT_EQUITY >= 25000

// Only enter trades if PDT rules allow
IF $LAST_BUY_PRICE = NULL AND $CAN_DAY_TRADE THEN OBTAIN USD 5000 @ $MARKET_PRICE

// Take profits when conditions are right
IF $PROFIT > 500 AND $CAN_DAY_TRADE THEN SELL $ALL @ $MARKET_PRICE

Understanding $REMAINING_DAY_TRADES

Returns -1 (unlimited) when:

  • Account equity is $25,000 or more
  • Account is already flagged as Pattern Day Trader

Returns 0-3 for accounts under $25k, showing remaining allowed day trades in the current rolling 5-business-day window.

Commands

DipScript provides four core commands for executing trades and managing your strategy. Think of these as the "verbs" of your trading language.

OBTAIN (Target Position)

The OBTAIN command reaches a target position size, only buying what is needed. If you already own the target amount, nothing is purchased. If you own some shares, OBTAIN buys only the difference to reach the target. Think of it as "ensure I have this many shares."

How OBTAIN Works

  • OBTAIN 100 when you own 0 shares → buys 100 shares
  • OBTAIN 100 when you own 40 shares → buys 60 shares
  • OBTAIN 100 when you own 100+ shares → does nothing
// Ensure you have 100 shares at current market price
OBTAIN 100 @ $MARKET_PRICE

// Reach max affordable position at 2% below market (limit order)
OBTAIN $MAX @ $MARKET_PRICE - 2%

// Target 50 shares at $10 below last sell price
OBTAIN 50 @ $LAST_SELL_PRICE - 10

// Reach $5000 worth at market (buys only what's needed)
OBTAIN USD 5000

SELL (Sell Orders)

The SELL command liquidates your positions. You have precise control over quantity and exit price.

// Sell all shares immediately at market price
SELL $ALL @ $MARKET_PRICE

// Sell 100 shares at 5% above market (limit order)
SELL 100 @ $MARKET_PRICE + 5%

// Sell half your position at 15% profit
SELL $ALL / 2 @ $LAST_BUY_PRICE + 15%

// Sell at exactly $150 per share
SELL $ALL @ 150

SET (Variable Assignment)

The SET command creates custom variables to make your strategies more readable and maintainable. This is especially useful when you want to adjust parameters without rewriting your entire strategy.

// Set a custom buy amount
SET $BUY_AMOUNT = 600

// Set a USD investment amount for fractional shares
SET $INVESTMENT_USD = 25000

// Set profit target and stop loss levels
SET $PROFIT_TARGET = 1000
SET $STOP_LOSS = 500

// Use the variables in your logic
IF $PROFIT > $PROFIT_TARGET THEN SELL $ALL @ $MARKET_PRICE
IF $PROFIT < -$STOP_LOSS THEN SELL $ALL @ $MARKET_PRICE

Decimal Precision & Value Types

DipSkip uses industry-standard decimal precision for all financial calculations. Understanding these precision levels ensures your scripts behave exactly as expected, especially when working with penny stocks or precise price targets.

Value Type Precision Examples
Stock Prices 4 decimal places $0.1899, $152.4575
Dollar Amounts
(profit, cost, cash)
2 decimal places $1,234.56, -$50.00
Share Quantities Whole numbers only 100, 50, 1
Percentages 2 decimal places 15.75%, -2.50%

Why 4 Decimals for Prices?

SEC Rule 612 allows sub-penny pricing for stocks trading under $1.00. This means penny stocks and OTC securities can have prices like $0.1875 or $0.0023. DipSkip preserves this precision to ensure accurate order execution and price comparisons.

Whole Shares Only

DipSkip currently supports whole share quantities only (no fractional shares). When you use $MAX or calculate quantities, they are always rounded down to whole numbers. For example, if you can afford 10.7 shares, DipSkip will buy 10 shares.

Tip: Market Orders

When using $MARKET_PRICE in your scripts, the order executes as a true market order. The 4-decimal precision ensures your script correctly identifies when you're trading at market price versus a specific limit price.

Macro Variables

DipScript supports macro variables—variables that contain expressions with other variables. When a macro variable is used, DipScript recursively resolves all nested variables until the final value is calculated. This powerful feature lets you create reusable condition shortcuts and complex expressions.

Basic Macro Syntax

Create a macro by setting a variable to an expression that contains other variables. When that variable is used later, DipScript will expand and resolve all nested variables automatically.

// Define a macro that checks if day trading is allowed
SET $CAN_DAY_TRADE = $REMAINING_DAY_TRADES > 0 OR $ACCOUNT_EQUITY >= 25000

// Define a dynamic entry price based on market conditions
SET $ENTRY_PRICE = $LAST_SELL_PRICE - 2% OR $MARKET_PRICE

// Use macros in your trading logic - variables resolve recursively
IF $LAST_BUY_PRICE = NULL AND $CAN_DAY_TRADE THEN OBTAIN USD 5000 @ $ENTRY_PRICE

How Recursive Resolution Works

Resolution Process

When DipScript encounters a variable like $CAN_DAY_TRADE, it expands to $REMAINING_DAY_TRADES > 0 OR $ACCOUNT_EQUITY >= 25000. Then it resolves $REMAINING_DAY_TRADES and $ACCOUNT_EQUITY to their actual values (e.g., 3 > 0 OR 15000 >= 25000). This continues until all variables are resolved.

Depth limit: To prevent infinite loops (e.g., if $A references $B and $B references $A), DipScript limits recursive resolution to 10 levels.

Practical Examples

Macros are especially useful for creating readable, maintainable strategies by giving meaningful names to complex conditions.

Trading Condition Macros
// Create a trailing stop condition macro
SET $TRAILING_STOP_HIT = $PROFIT > 500 AND $PROFIT < $PEAK_PROFIT - 2%

// Create a "buy the dip" condition
SET $DIP_DETECTED = $MARKET_PRICE < $PEAK_PRICE - 5%

// Create a position size macro based on account size
SET $POSITION_SIZE = $ACCOUNT_EQUITY * 10%

// Use the macros for cleaner, more readable strategies
IF $TRAILING_STOP_HIT THEN SELL $ALL @ $MARKET_PRICE
IF $DIP_DETECTED AND $ALL = 0 THEN OBTAIN USD $POSITION_SIZE

Benefits of Using Macros

  • Readability: Replace complex conditions with meaningful names like $CAN_DAY_TRADE or $DIP_DETECTED
  • Maintainability: Change a condition in one place and it applies everywhere the macro is used
  • Reusability: Define common trading patterns once and use them across multiple rules
  • Organization: Keep all your parameters and conditions at the top of your script for easy tuning

Avoid Circular References

Be careful not to create circular references where $A depends on $B and $B depends on $A. DipScript will stop resolution after 10 levels and log a warning if this occurs.

USD-Based Trading

DipScript supports USD-based orders, which let you specify a dollar amount to invest instead of a specific share count. This is useful for high-priced stocks or when you want to invest a fixed dollar amount.

Important: Rounding Behavior

DipScript does not support true fractional shares. When you specify a USD amount, DipScript calculates how many shares your dollar amount can buy at the current market price, then rounds down to the nearest whole share. For example, if $1,000 at a $95/share price equals 10.52 shares, DipScript will purchase exactly 10 shares.

When to Use USD Syntax

  • High-priced stocks: Invest $10,000 instead of calculating how many shares that buys
  • Fixed dollar amounts: Maintain consistent position sizes across different stocks
  • Dollar cost averaging: Invest the same dollar amount on a recurring schedule

USD Syntax Example

Use the USD keyword before a dollar amount to specify investment size by value instead of share count.

TICKER NVDA

// SET INVESTMENT AMOUNT IN DOLLARS
SET $BUY_AMOUNT_USD = 25000

// INITIAL PURCHASE: BUY $25,000 WORTH (ROUNDS DOWN TO WHOLE SHARES)
IF $LAST_BUY_PRICE = NULL THEN OBTAIN USD $BUY_AMOUNT_USD

// TAKE PROFIT WHEN UP $1000
IF $PROFIT > 1000 THEN SELL $ALL @ $MARKET_PRICE

// BUY THE DIP WITH ANOTHER $25,000
IF $MARKET_PRICE < $LAST_SELL_PRICE - 3% THEN OBTAIN USD $BUY_AMOUNT_USD

How It Works

When you use OBTAIN USD 5000 at a stock price of $142.50, DipScript calculates the target position: 5000 ÷ 142.50 = 35.09 shares → rounds down → targets 35 shares. Like all OBTAIN commands, it only buys what's needed to reach this target. If you already own 20 shares, it buys 15 more. If you own 35+, it does nothing.

USD Syntax Limitations

  • Rounds down: Always calculates whole shares only, fractional amounts are discarded
  • Market price only: USD orders always execute at market price (no custom limit prices)
  • OBTAIN only: The USD keyword only works with OBTAIN commands, not SELL
  • Target position: Like all OBTAIN commands, only buys what's needed to reach the target
  • Selling: To sell your position, use SELL $ALL @ $MARKET_PRICE

Conditional Logic

IF statements are the heart of your trading strategy. They define when actions happen based on market conditions, profit levels, and position data. Think of them as automated decision-making.

Comparison Operators

Use these operators to compare values and create trading conditions:

Operator Description Example
> Greater than $PROFIT > 500
< Less than $MARKET_PRICE < 150
>= Greater than or equal $PROFIT >= 1000
<= Less than or equal $ALL <= 100
= Equal to $ALL = 0
!= Not equal to $LAST_BUY_PRICE != NULL

Logical Operators

AND Logic (Combining Conditions)

Use AND when you need multiple conditions to be true before taking action. This helps create more precise entry and exit rules.

// Only buy if you have no position AND price has dropped
IF $ALL = 0 AND $MARKET_PRICE <= $LAST_SELL_PRICE - 2.5% THEN OBTAIN 400 @ $MARKET_PRICE

// Sell only when profitable AND showing weakness (trailing stop logic)
IF $PROFIT > 200 AND $PROFIT < $PEAK_PROFIT - 100 THEN SELL $ALL @ $MARKET_PRICE

// Limit position size: only add shares if below max AND price is right
IF $ALL < 500 AND $MARKET_PRICE < $LAST_BUY_PRICE - 5% THEN OBTAIN 100 @ $MARKET_PRICE

OR Logic (Fallback Values)

OR has a special purpose in DipScript: providing fallback values when variables might be NULL. This prevents your strategy from breaking when data isn't available yet.

// Use $PEAK_PROFIT if available, otherwise use 600 as the fallback
IF $PROFIT < $PEAK_PROFIT - 100 OR 600 THEN SELL $ALL @ $MARKET_PRICE

// If $LAST_SELL_PRICE doesn't exist (first run), use 100 as fallback
IF $MARKET_PRICE < $LAST_SELL_PRICE - 5% OR 100 THEN OBTAIN 50 @ $MARKET_PRICE

NULL Value Handling

Understanding NULL

Variables are NULL when they don't have a value yet. For example, $LAST_SELL_PRICE is NULL if you haven't sold anything yet. $PEAK_PROFIT is NULL before you've made any profit.

Without OR fallback: If a variable is NULL and you don't provide an OR fallback, the entire IF condition evaluates to false and won't execute.

With OR fallback: If the expression before OR results in NULL or error, DipScript uses the value after OR instead.

NULL in Practice
// Check if you've never bought before (NULL means never traded)
IF $LAST_BUY_PRICE = NULL THEN OBTAIN 100 @ $MARKET_PRICE

// Check if you've sold before (not NULL means you have)
IF $LAST_SELL_PRICE != NULL THEN OBTAIN 50 @ $MARKET_PRICE

Math Operations & Smart Percentages

DipScript supports mathematical expressions for dynamic pricing strategies. One of the most powerful features is the "smart percentage" system that automatically calculates percentage changes.

Basic Math Operations

Operator Description Example
+ Addition $MARKET_PRICE + 10
- Subtraction $PROFIT - 100
* Multiplication $MAX * 0.5
/ Division $ALL / 2

Smart Percentage System

This is where DipScript really shines. When you use a percentage with addition or subtraction, DipScript automatically applies it to the base value. You don't have to calculate anything manually.

How Smart Percentages Work

When you write $MARKET_PRICE - 5%, DipScript automatically means:

"Take the market price and subtract 5% OF the market price"

It's multiplicative, not literal. The percentage is always calculated from the base value before the operator.

Percentage Calculations Explained
Assume a stock's current market price is $100. Here's how percentages work:
  • $MARKET_PRICE - 5% = $95
    Calculation: 100 - (5% of 100) = 100 - 5 = 95
  • $MARKET_PRICE + 10% = $110
    Calculation: 100 + (10% of 100) = 100 + 10 = 110
  • $MARKET_PRICE - 2.5% = $97.50
    Calculation: 100 - (2.5% of 100) = 100 - 2.5 = 97.50
  • $LAST_BUY_PRICE + 15% (if last buy was $80) = $92
    Calculation: 80 + (15% of 80) = 80 + 12 = 92

Practical Percentage Applications

Smart percentages make complex strategies simple to write:

// Buy at 2% below current market price
OBTAIN 100 @ $MARKET_PRICE - 2%

// Sell at 5% above current market price
SELL $ALL @ $MARKET_PRICE + 5%

// Buy when price drops 10% below last sell
IF $MARKET_PRICE <= $LAST_SELL_PRICE - 10% THEN OBTAIN 200 @ $MARKET_PRICE

// Take profit at 20% gain from buy price
IF $MARKET_PRICE >= $LAST_BUY_PRICE + 20% THEN SELL $ALL @ $MARKET_PRICE

// Combine percentage and fixed amount: 5% below market plus $1.25
OBTAIN 50 @ $MARKET_PRICE - 5% + 1.25

Calculating Profit Percentages

Since DipScript uses dollar-based profit variables, you can calculate percentage gains by comparing profit to investment:

// Sell when profit exceeds 20% of invested amount
// This means: profit > (invested * 20%)
IF $PROFIT > $AMOUNT_INVESTED_SINCE_LAST_TRADE * 20% THEN SELL $ALL @ $MARKET_PRICE

// Stop loss when down 10% of invested amount
IF $PROFIT < $AMOUNT_INVESTED_SINCE_LAST_TRADE * -10% THEN SELL $ALL @ $MARKET_PRICE

// Check if total profit exceeds 15% of total invested
IF $TOTAL_PROFIT > $TOTAL_AMOUNT_INVESTED * 15% THEN SELL $ALL @ $MARKET_PRICE

Day Trading with DipScript

Day trading is all about speed, precision, and discipline. You're making multiple trades within a single day, trying to profit from small price movements. DipScript automates the execution so you can focus on strategy instead of manually placing orders.

Why Automation Matters for Day Trading

Day trading windows are small. A stock might spike for 30 seconds before reversing. By the time you manually calculate your profit, decide to sell, and place the order, the opportunity is gone. DipScript executes in milliseconds.

Classic Day Trading Scenario
You're trading a volatile tech stock. You want to buy dips and sell rallies repeatedly throughout the day:
TICKER TSLA

// Initial entry: buy if we have no position
IF $ALL = 0 AND $LAST_BUY_PRICE = NULL THEN OBTAIN 100 @ $MARKET_PRICE

// Quick profit taking: sell when up $300
IF $PROFIT > 300 THEN SELL $ALL @ $MARKET_PRICE

// Re-entry: buy the dip after selling (if price drops 1.5%)
IF $ALL = 0 AND $MARKET_PRICE <= $LAST_SELL_PRICE - 1.5% THEN OBTAIN 100 @ $MARKET_PRICE

// Safety stop: cut losses if down $150
IF $PROFIT < -150 THEN SELL $ALL @ $MARKET_PRICE

This strategy will automatically cycle through buying and selling all day long, capturing $300 profits and limiting losses to $150. No manual intervention needed.

Key Day Trading Principles

  • Have a Plan: Know your entry, exit, and stop loss before the market opens
  • Risk Management: Always set stop losses. Protect your capital first
  • Take Profits: Don't get greedy. Small consistent wins compound
  • Limit Exposure: Don't hold positions overnight if you're day trading
  • Volume Matters: Day trade liquid stocks with high volume for better execution

Scalping Strategies

Scalping is high-frequency day trading. You're making dozens or hundreds of trades, capturing tiny profit margins on each. This requires automation—no human can execute scalping strategies manually at scale.

What is Scalping?

Scalpers aim for small profits per trade (often $50-$200) but make many trades. If you make 20 trades per day averaging $100 profit each, that's $2,000 daily. DipScript is perfect for this because it executes instantly when your profit targets hit.

Basic Scalping Strategy
Target $100 profits with tight $50 stop losses, cycling in and out rapidly:
TICKER SPY

// Configuration
SET $POSITION_SIZE = 200
SET $PROFIT_TARGET = 100
SET $STOP_LOSS = 50

// Entry: buy when flat
IF $ALL = 0 THEN OBTAIN $POSITION_SIZE @ $MARKET_PRICE

// Take profit at target
IF $PROFIT >= $PROFIT_TARGET THEN SELL $ALL @ $MARKET_PRICE

// Stop loss at limit
IF $PROFIT <= -$STOP_LOSS THEN SELL $ALL @ $MARKET_PRICE

This strategy immediately re-enters after every exit, running continuously. With a 2:1 profit-to-loss ratio, you only need to win 34% of trades to break even. Anything above that is profit.

Advanced Scalping: Pyramiding Profits

As you build profit, you can take partial exits to lock in gains while leaving some position to run:

TICKER QQQ

// Enter with 300 shares
IF $ALL = 0 THEN OBTAIN 300 @ $MARKET_PRICE

// Sell 1/3 when up $100 (lock in some profit)
IF $PROFIT >= 100 AND $SELL_TRADE_COUNT = 0 THEN SELL 100 @ $MARKET_PRICE

// Sell another 1/3 when up $200
IF $PROFIT >= 200 AND $SELL_TRADE_COUNT = 1 THEN SELL 100 @ $MARKET_PRICE

// Let the final 1/3 run to $300 or trailing stop
IF $PROFIT >= 300 THEN SELL $ALL @ $MARKET_PRICE

// Trailing stop: protect profits if price reverses
IF $PROFIT < $PEAK_PROFIT - 75 THEN SELL $ALL @ $MARKET_PRICE

// Hard stop: maximum loss limit
IF $PROFIT < -60 THEN SELL $ALL @ $MARKET_PRICE

Momentum Trading

Momentum trading captures sustained price moves. Instead of quick scalps, you're riding trends that might last hours or days. DipScript helps you enter breakouts automatically and protect profits with trailing stops.

Momentum Trading Principles

  • Trend is Your Friend: Only trade in the direction of strong moves
  • Breakouts: Enter when price breaks above resistance or below support
  • Trailing Stops: Let profits run but protect against reversals
  • Volume Confirmation: Strong momentum comes with high volume
Breakout Momentum Strategy
Enter on upward breakouts and ride the momentum with trailing stop protection:
TICKER NVDA

// Enter when price breaks above recent peak by 2%
IF $ALL = 0 AND $MARKET_PRICE > $PEAK_PRICE + 2% THEN OBTAIN 150 @ $MARKET_PRICE

// Add to position on continued strength (pyramiding)
IF $ALL > 0 AND $ALL < 300 AND $PROFIT > $AMOUNT_INVESTED_SINCE_LAST_TRADE * 5% THEN OBTAIN 75 @ $MARKET_PRICE

// Trailing stop: exit if profit drops 8% from peak
IF $PROFIT > 0 AND $PROFIT <= $PEAK_PROFIT - $PEAK_PROFIT * 8% THEN SELL $ALL @ $MARKET_PRICE

// Hard stop: cut losses at 10% down
IF $PROFIT < $AMOUNT_INVESTED_SINCE_LAST_TRADE * -10% THEN SELL $ALL @ $MARKET_PRICE

This strategy waits for confirmation of upward momentum before entering, adds to winning positions, and uses a percentage-based trailing stop to lock in profits as the trend continues.

Risk Management

Risk management is what separates profitable traders from those who blow up their accounts. No matter how good your strategy is, you need rules to protect your capital.

Essential Risk Controls

1. Always Use Stop Losses

Every strategy should have a maximum loss limit. Never let a losing trade run indefinitely.

// Fixed dollar stop loss
IF $PROFIT < -500 THEN SELL $ALL @ $MARKET_PRICE

// Percentage-based stop loss (10% of investment)
IF $PROFIT < $AMOUNT_INVESTED_SINCE_LAST_TRADE * -10% THEN SELL $ALL @ $MARKET_PRICE

2. Position Sizing

Don't put all your capital into a single trade. Limit position sizes to manage risk.

// Use 25% of available capital instead of maximum
IF $ALL = 0 THEN OBTAIN $MAX / 4 @ $MARKET_PRICE

// Or use a fixed maximum position size
SET $MAX_POSITION = 200
IF $ALL = 0 THEN OBTAIN $MAX_POSITION @ $MARKET_PRICE

3. Limit Number of Trades

Prevent overtrading by capping how many times you can enter a position.

// Only allow 5 buy trades total
IF $BUY_TRADE_COUNT < 5 AND $ALL = 0 THEN OBTAIN 100 @ $MARKET_PRICE

4. Profit Protection with Trailing Stops

Once profitable, use trailing stops to lock in gains while allowing for continued upside.

// Once up $200, exit if profit drops by $100 from peak
IF $PROFIT > 200 AND $PROFIT < $PEAK_PROFIT - 100 THEN SELL $ALL @ $MARKET_PRICE

Complete Risk-Managed Strategy Example

TICKER AAPL

// Configuration: all risk parameters in one place
SET $POSITION_SIZE = 100
SET $PROFIT_TARGET = 500
SET $STOP_LOSS = 250
SET $MAX_TRADES = 10

// Entry with trade limit
IF $ALL = 0 AND $BUY_TRADE_COUNT < $MAX_TRADES THEN OBTAIN $POSITION_SIZE @ $MARKET_PRICE

// Profit taking
IF $PROFIT >= $PROFIT_TARGET THEN SELL $ALL @ $MARKET_PRICE

// Stop loss
IF $PROFIT <= -$STOP_LOSS THEN SELL $ALL @ $MARKET_PRICE

// Trailing stop: protect profits once up $300
IF $PROFIT > 300 AND $PROFIT < $PEAK_PROFIT - 150 THEN SELL $ALL @ $MARKET_PRICE

Risk Management Reality Check

Even with perfect execution, trading involves risk. DipScript helps you stick to your rules, but it can't eliminate market risk. Only risk capital you can afford to lose. Consider starting with paper trading or small positions to test strategies before scaling up.

Common Patterns

These patterns form the building blocks of most trading strategies. Mix and match them to create your custom approach.

Entry Strategies

// Initial position entry (first time buying)
IF $LAST_BUY_PRICE = NULL THEN OBTAIN 100 @ $MARKET_PRICE

// Dollar cost averaging (buy more on dips)
IF $MARKET_PRICE <= $LAST_BUY_PRICE - 5% THEN OBTAIN 50 @ $MARKET_PRICE

// Breakout buying (enter on strength)
IF $MARKET_PRICE > $PEAK_PRICE + 3% THEN OBTAIN 100 @ $MARKET_PRICE

// Dip buying after selling (buy back cheaper)
IF $ALL = 0 AND $MARKET_PRICE <= $LAST_SELL_PRICE - 2% THEN OBTAIN 200 @ $MARKET_PRICE

Exit Strategies

// Fixed dollar profit target
IF $PROFIT >= 1000 THEN SELL $ALL @ $MARKET_PRICE

// Percentage-based profit target (20% gain)
IF $PROFIT > $AMOUNT_INVESTED_SINCE_LAST_TRADE * 20% THEN SELL $ALL @ $MARKET_PRICE

// Fixed dollar stop loss
IF $PROFIT <= -500 THEN SELL $ALL @ $MARKET_PRICE

// Trailing stop (exit if profit drops from peak)
IF $PROFIT <= $PEAK_PROFIT - 200 THEN SELL $ALL @ $MARKET_PRICE

// Partial exit (take some profit, let rest run)
IF $PROFIT > $AMOUNT_INVESTED_SINCE_LAST_TRADE * 10% THEN SELL $ALL / 2 @ $MARKET_PRICE

Position Management

// Position sizing based on available capital (use 25%)
IF $ALL = 0 THEN OBTAIN $MAX / 4 @ $MARKET_PRICE

// Limit number of buy transactions
IF $BUY_TRADE_COUNT < 3 AND $PROFIT > $AMOUNT_INVESTED_SINCE_LAST_TRADE * 5% THEN OBTAIN 50 @ $MARKET_PRICE

// Scale out in portions (tiered exits)
IF $PROFIT > $AMOUNT_INVESTED_SINCE_LAST_TRADE * 20% AND $SELL_TRADE_COUNT = 0 THEN SELL $ALL / 3 @ $MARKET_PRICE

Strategy Examples

Complete strategy implementations demonstrating different trading approaches. Use these as templates and customize to fit your style.

Conservative Dollar Cost Averaging

A risk-managed approach that accumulates shares on dips and takes profits systematically. Perfect for less volatile stocks and longer-term holds.
TICKER AAPL

// Initial purchase
IF $LAST_BUY_PRICE = NULL THEN OBTAIN 50 @ $MARKET_PRICE

// Add to position on 5% dips (dollar cost averaging)
IF $ALL > 0 AND $MARKET_PRICE <= $LAST_BUY_PRICE - 5% THEN OBTAIN 25 @ $MARKET_PRICE

// Take profit at 20% gain
IF $PROFIT > $AMOUNT_INVESTED_SINCE_LAST_TRADE * 20% THEN SELL $ALL @ $MARKET_PRICE

// Stop loss at 15% down
IF $PROFIT < $AMOUNT_INVESTED_SINCE_LAST_TRADE * -15% THEN SELL $ALL @ $MARKET_PRICE

Momentum Breakout Strategy

Captures upward momentum with trailing stop protection. Ideal for volatile tech stocks with strong trends.
TICKER TSLA

// Enter on breakout above recent high
IF $ALL = 0 AND $MARKET_PRICE > $PEAK_PRICE + 2% THEN OBTAIN 100 @ $MARKET_PRICE

// Add to position on continued momentum (pyramiding)
IF $ALL > 0 AND $ALL < 200 AND $PROFIT > $AMOUNT_INVESTED_SINCE_LAST_TRADE * 5% THEN OBTAIN 50 @ $MARKET_PRICE

// Trailing stop: sell if profit drops 8% from peak
IF $PROFIT > 0 AND $PROFIT <= $PEAK_PROFIT - $PEAK_PROFIT * 8% THEN SELL $ALL @ $MARKET_PRICE

// Hard stop loss at 12%
IF $PROFIT < $AMOUNT_INVESTED_SINCE_LAST_TRADE * -12% THEN SELL $ALL @ $MARKET_PRICE

Best Practices

Guidelines for writing effective and maintainable DipScript strategies that perform well in real trading conditions.

Strategy Design

  • Start Simple: Begin with basic buy/sell rules and add complexity gradually as you understand performance
  • Define Clear Entry/Exit Rules: Every strategy should have explicit conditions for entering and exiting positions
  • Include Risk Management: Always implement stop losses and position limits before going live
  • Test Edge Cases: Consider NULL values, first trades, and extreme market conditions in your logic
  • Use Variables for Parameters: SET commands make it easy to adjust profit targets and stop losses
  • Comment Your Code: Future you will thank present you for explaining complex logic

Important Risk Considerations

Always include appropriate risk controls in your strategies. Consider position sizing, stop losses, maximum drawdown limits, and trade count limits when designing strategies. Never risk more than you can afford to lose on a single trade or strategy.

Well-Structured Strategy Template
A template demonstrating good organization and risk management practices:
TICKER QQQ

// ============================================
// STRATEGY PARAMETERS (adjust these as needed)
// ============================================
SET $POSITION_SIZE = 200
SET $PROFIT_TARGET = 800
SET $STOP_LOSS = 400
SET $TRAILING_STOP = 150

// ============================================
// ENTRY LOGIC
// ============================================
IF $LAST_BUY_PRICE = NULL THEN OBTAIN $POSITION_SIZE @ $MARKET_PRICE

// ============================================
// RISK MANAGEMENT - STOP LOSS (most important!)
// ============================================
IF $PROFIT <= -$STOP_LOSS THEN SELL $ALL @ $MARKET_PRICE

// ============================================
// PROFIT TAKING
// ============================================
IF $PROFIT >= $PROFIT_TARGET THEN SELL $ALL @ $MARKET_PRICE

// Trailing stop once profitable
IF $PROFIT > 200 AND $PROFIT < $PEAK_PROFIT - $TRAILING_STOP THEN SELL $ALL @ $MARKET_PRICE

// ============================================
// RE-ENTRY LOGIC
// ============================================
IF $ALL = 0 AND $MARKET_PRICE <= $LAST_SELL_PRICE - 3% THEN OBTAIN $POSITION_SIZE @ $MARKET_PRICE

Testing and Validation

  • Paper Trade First: Test strategies with virtual money before risking real capital
  • Start Small: When going live, start with smaller position sizes
  • Monitor Closely: Watch your first few trades execute to ensure logic works as expected
  • Keep Records: Track what strategies work and what doesn't

Order Execution

Understanding how DipSkip executes and tracks your stock orders is essential for building reliable trading strategies.

Order Lifecycle

When your DipScript triggers a buy or sell order, the following process occurs:

Order Execution Flow

  1. Order Submission: Your order is submitted to the broker (Tradier)
  2. Quick Poll (10 seconds): The system polls for order status every 2 seconds, up to 5 times
  3. If Filled: Order details are recorded and your script variables are updated
  4. If Still Pending: Order is handed off to async background tracking
  5. Async Tracking (60 seconds): Background service polls every 3 seconds, up to 20 times
  6. If Still Not Filled: Order is automatically cancelled after ~70 seconds total

Pending Order Detection

DipScripts run on a continuous loop (typically every 5 seconds). If an order is still pending when your script runs again, the system automatically detects this and prevents duplicate orders from being placed.

  • Buy Orders: If a pending buy order exists for the ticker, new buy orders are blocked
  • Sell Orders: Anti-shorting protection prevents selling more shares than you own minus any pending sell quantity

Order Timeouts

Market orders typically fill within 1-2 seconds during market hours. If an order doesn't fill within approximately 70 seconds, it is automatically cancelled. This prevents orders from hanging indefinitely and protects against unusual market conditions.

Important: Limit Orders

The 70-second timeout applies to all orders. If you're using limit orders that may take longer to fill, be aware they will be cancelled if not filled within this window. For longer-term limit orders, consider managing them directly through your broker.

Tradier Connection

DipSkip uses Tradier as the brokerage connection for executing trades. Tradier is a modern, API-first brokerage that provides commission-free stock and ETF trading, making it ideal for automated trading strategies.

Creating a Tradier Account

Before connecting DipSkip to your brokerage, you'll need to create a Tradier account:

  1. Visit tradier.com and click Open an Account
  2. Select Individual Brokerage Account as your account type
  3. Complete the application with your personal information, including:
    • Full legal name and contact information
    • Social Security Number (required for tax reporting)
    • Employment information
    • Investment experience and objectives
  4. Review and sign the account agreements electronically
  5. Fund your account via bank transfer (ACH), wire transfer, or account transfer

Account Approval

Tradier typically approves accounts within 1-2 business days. You'll receive an email confirmation once your account is ready for trading.

Connecting Your Tradier Account to DipSkip

Once your Tradier account is approved and funded, you can connect it to DipSkip:

  1. Log in to DipSkip and navigate to the User tab in the sidebar
  2. In the Account Setup section, locate the Trading Connection card
  3. Click the Connect button to initiate the OAuth connection
  4. You'll be redirected to Tradier's secure login page
  5. Enter your Tradier credentials and authorize DipSkip to access your account
  6. After authorization, you'll be redirected back to DipSkip with a Connected status
Account Setup showing Trading Connection and Terms Agreement

The Account Setup section shows your connection status. Once connected, you'll see a green Connected badge. You can disconnect at any time by clicking the Disconnect button.

Terms Agreement Required

Before you can run trading scripts, you must also accept the DipSkip Terms of Service by clicking Accept Terms in the Terms Agreement card. Both the trading connection and terms agreement must be completed to activate your account.

Paper Trading Mode

DipSkip supports paper trading (simulated trading) so you can test your strategies without risking real money. Toggle paper trading mode in the Settings tab. When enabled, all trades are simulated using real market data but no actual orders are placed.

Realistic Order Simulation

Paper trading is designed to closely mirror live Tradier trading behavior while keeping order execution fast for testing. Orders fill immediately but include realistic price adjustments.

Price Slippage

Market orders include realistic slippage simulation to mimic the bid-ask spread:

  • Buy orders: Fill at slightly higher than the quoted price (up to +0.1%)
  • Sell orders: Fill at slightly lower than the quoted price (up to -0.1%)

This means your Avg Fill Price (shown in Portfolio) may differ from the Current Price. This is intentional and reflects real-world trading conditions where market orders execute at the best available price, not the exact quoted price.

Example: If you buy 100 shares when the price is $50.00, you might fill at $50.05 due to slippage. Your position will immediately show a small loss until the market price rises above your fill price.

Pattern Day Trader (PDT) Rules

Paper trading enforces PDT rules just like live trading:

  • Day trades are tracked using the 5-business-day rolling window
  • 4+ day trades triggers PDT status
  • PDT accounts require $25,000 minimum equity to continue day trading

Margin Account for Day Trading

By default, Tradier accounts are set up as cash accounts. While cash accounts work fine for swing trading and longer-term strategies, they have a significant limitation for day trading: trade settlement.

Understanding Trade Settlement

When you sell a stock in a cash account, the funds from that sale take T+1 (one business day) to settle. Until the funds settle, you cannot use them to make new purchases. This means:

  • If you buy and sell a stock on Monday, those funds aren't available until Tuesday
  • Attempting to use unsettled funds results in a Good Faith Violation
  • Multiple violations can result in account restrictions

Why You Need a Margin Account

A margin account eliminates the settlement waiting period. With margin:

  • Funds are immediately available after selling a position
  • You can execute multiple round-trip trades in a single day
  • No Good Faith Violations for using proceeds from recent sales

Margin ≠ Borrowing

Having a margin account doesn't mean you have to trade on borrowed money. You can still trade using only your own cash—the margin account simply removes the settlement delay. DipSkip's default behavior uses only your available cash balance.

Applying for Margin on Tradier

To upgrade your Tradier cash account to a margin account:

  1. Log in to your account at dash.tradier.com
  2. Navigate to AccountSettings or Account Features
  3. Look for Margin Trading or Account Upgrade options
  4. Complete the margin application, which includes:
    • Acknowledging the risks of margin trading
    • Confirming your investment experience
    • Signing the margin agreement
  5. Wait for approval (typically 1-2 business days)

Pattern Day Trader Rule

If you execute 4 or more day trades within 5 business days, you may be classified as a Pattern Day Trader (PDT). PDT accounts require a minimum equity of $25,000. If your account falls below this threshold, day trading may be restricted until you deposit additional funds. DipSkip tracks your day trade count in the Settings tab to help you stay aware of this limit.

Alternative: Paper Trading

If you want to practice day trading strategies without margin requirements or PDT restrictions, use DipSkip's paper trading mode. Paper trading simulates real market conditions without any of the regulatory limitations, making it perfect for strategy development and testing.

Price Chart

The dashboard displays an interactive price chart for each of your running scripts, providing real-time visualization of price movements and key reference points. Understanding what each element represents helps you monitor your strategy's performance at a glance.

Dashboard Price Chart

Price Line

The main blue line shows the stock's price movement over time. The chart automatically scales to show recent price action and updates in real-time during market hours. Hover over any point to see the exact price and timestamp.

Reference Lines

Three horizontal reference lines help you understand your position relative to key price levels:

  • Buy Line (Green): Shows the price at which you entered your current position. This appears when your last executed order was a buy. The line is labeled "Buy" with the exact price on the right axis.
  • Sell Line (Red): Shows the price at which you exited your last position. This appears when your last executed order was a sell. The line is labeled "Sell" with the exact price on the right axis.
  • Peak Line (Orange): Tracks the highest price reached since your last buy. The label shows the percentage above your entry price, e.g., "Peak (+0.5%)" means the peak is 0.5% higher than your buy price. This resets each time you make a new purchase.
  • Low Line (Purple): Tracks the lowest price reached since your last sell. The label shows the percentage below your sell price, e.g., "Low (-2.6%)" means the low is 2.6% below your sell price. This resets each time you sell.

Trade Markers

When trades execute, markers appear on the chart at the exact time and price:

  • B (Green): Buy order executed at this point
  • S (Red): Sell order executed at this point

Using the Chart Effectively

The percentage indicators on Peak and Low lines are especially useful for evaluating your strategy's performance:

  • A high Peak percentage shows the maximum potential profit you could have captured
  • Comparing Peak to current price shows how much profit has been given back
  • The Low percentage helps evaluate whether your entry points are timing dips correctly
  • Wide gaps between Peak and Low indicate high volatility—adjust your strategy accordingly

Script Metrics

Adjacent to the price chart, the dashboard displays real-time metrics for each running script. These statistics update automatically and provide a comprehensive view of your strategy's current state and historical performance.

Profit Metrics

  • Current Total Profit: Your overall profit/loss combining both realized gains from completed trades and unrealized gains from open positions. Displayed in dollars and as a percentage of your invested capital.
  • Current Running Profit: The unrealized profit/loss on your currently held shares. This fluctuates with the market price and becomes realized when you sell.
  • Total Realized Profit: The sum of all profits and losses from completed trades. This only changes when you actually sell shares and lock in gains or losses.

Position Information

  • Stocks Owned: The number of shares you currently hold in this position. Shows 0 when you have no open position.
  • Buy Trade Count: Total number of buy orders executed by this script since it started running. Useful for understanding how active your strategy is.
  • Sell Trade Count: Total number of sell orders executed by this script. Comparing buy and sell counts helps you understand position cycling frequency.

Executed Orders

Below the metrics, a table shows your recent order history for this script:

  • Timestamp: Exact date and time the order was filled
  • Type: Whether the order was a buy or sell
  • QTY: Number of shares traded
  • Avg Fill Price: The actual price at which the order executed
  • Profit: For sell orders, the profit or loss realized on that trade

Monitoring Multiple Scripts

If you're running multiple scripts on different tickers, each one has its own independent chart and metrics panel. Scroll through your dashboard to monitor all active strategies, or use the script selector to focus on a specific one.

Alerts Overview

DipSkip's alerts system keeps you informed about important events without requiring you to constantly monitor the dashboard. Set up email notifications for price movements, profit/loss thresholds, and trade executions so you can stay on top of your strategies wherever you are.

Why Use Alerts?

While your scripts run autonomously, there are times when you want to know immediately about specific events:

  • A stock you're watching hits your target entry price
  • Your script executes a trade (buy or sell)
  • Your position reaches a profit target or loss limit
  • Market conditions trigger unusual activity in your strategy

Alerts bridge the gap between full automation and staying informed. You get the convenience of hands-off trading with the awareness of real-time notifications.

Email Delivery

All alerts are delivered via email to the address associated with your account. Make sure your email settings are correct in your account profile to receive notifications.

Alert Types

DipSkip supports five different alert types, each designed for specific monitoring needs. You can create multiple alerts of each type with different configurations.

Symbol Price Alert

Get notified when any stock reaches a specific price point. This alert type is independent of your scripts and monitors the market directly.

  • Symbol: The stock ticker to watch (e.g., AAPL, NVDA, TSLA)
  • Target Price: The price that triggers the alert

Use case: Set a symbol price alert for a stock you want to buy when it drops to a certain level, or to notify you when a watched stock breaks through resistance.

Loss Amount Alert

Receive a notification when the current loss on selected scripts reaches a threshold. You can set the threshold in either dollar amount or percentage terms.

  • Amount: The loss value that triggers the alert
  • Type: Choose between USD (e.g., -$50) or Percent (e.g., -5%)
  • Scripts: Select which scripts to monitor for this alert

Use case: Set a loss alert at -10% to know immediately if a position moves significantly against you, giving you time to review and potentially intervene.

Gain Amount Alert

Get notified when the current profit on selected scripts reaches a target level. Configure in dollar amount or percentage.

  • Amount: The profit value that triggers the alert
  • Type: Choose between USD (e.g., $100) or Percent (e.g., +10%)
  • Scripts: Select which scripts to monitor for this alert

Use case: Set a gain alert at +15% to celebrate hitting your target, or to consider taking partial profits manually.

Buy Trades Alert

Receive notifications when your scripts execute buy orders. Configure to alert on every buy or only after a certain number of buys.

  • Every Trade: Get notified on every single buy execution
  • After X Trades: Only alert after a specific number of buys (useful for averaging-down strategies)
  • Scripts: Select which scripts to monitor

Use case: If your script averages down on dips, set an alert after 3 buys to know when multiple entries have occurred, signaling either opportunity or caution.

Sell Trades Alert

Receive notifications when your scripts execute sell orders. Similar to buy alerts, configure for every sell or after a threshold.

  • Every Trade: Get notified on every single sell execution
  • After X Trades: Only alert after a specific number of sells
  • Scripts: Select which scripts to monitor

Use case: Set sell alerts to "every trade" so you know immediately when your script locks in profits or cuts losses.

Alert Frequency

Be mindful when setting "every trade" alerts on high-frequency strategies. If your script trades frequently, you may receive many emails. Consider using the "after X trades" option for busy strategies.

Managing Alerts

Access the Alerts tab from the main navigation to view, create, edit, and delete your alerts.

Creating an Alert

  1. Navigate to the Alerts tab
  2. Select the alert type from the dropdown menu
  3. Fill in the required fields based on the alert type
  4. For script-based alerts, select one or more scripts to monitor
  5. Click Add Alert to save

Editing an Alert

To modify an existing alert, click the Edit button next to the alert in your alerts list. Update the fields as needed and click Update Alert to save your changes.

Deleting an Alert

Click the Delete button next to any alert to remove it. You'll be asked to confirm before the alert is permanently deleted.

Alert Status

Each alert shows its current configuration in the alerts list, including:

  • Alert type and trigger conditions
  • Associated scripts (for script-based alerts)
  • Current status (active/triggered)

Combining Alerts with Script Logic

Alerts work alongside your scripts, not instead of them. Use alerts for awareness while letting your scripts handle the actual trading logic. For example, your script might have a stop-loss at -15%, but you could set a loss alert at -10% to give yourself early warning.

Backtesting Overview

The Backtester tab allows you to test your DipScript strategies against historical price data before risking real capital. By simulating how your script would have performed in the past, you can validate your logic, fine-tune parameters, and build confidence in your approach.

Why Backtest?

Every trading strategy looks good in theory, but backtesting reveals the truth. Before going live, you should know:

  • Would this strategy have been profitable over a given time period?
  • What's the maximum drawdown I should expect?
  • How frequently does my script execute trades?
  • Are my profit targets and stop losses calibrated correctly?

The backtester runs your exact DipScript logic against price data, simulating every trade as if it happened in real-time. The same script you test is the same script you deploy.

Backtester Workflow

  1. Load price data - Upload historical CSV data or generate synthetic prices
  2. Select a script - Choose which DipScript to test from your saved scripts
  3. Run the backtest - Execute the simulation and view results
  4. Analyze performance - Review metrics, trade history, and visualizations
  5. Iterate - Adjust your script and test again until satisfied

Loading Price Data

The backtester needs price data to simulate against. You have two options: upload your own historical data or generate synthetic price movements.

Backtester Data Input

Option 1: Upload CSV Data

If you have historical price data from Yahoo Finance, your broker, or another source, you can upload it directly. Click Choose CSV File and select your data file. The backtester supports multiple CSV formats:

  • Date,Price - Simple daily closing prices
  • Timestamp,Price - Intraday data with timestamps
  • OHLCV - Full candlestick data (Open, High, Low, Close, Volume)

Option 2: Generate Synthetic Data

Don't have historical data? The Data Generator creates realistic price movements based on parameters you control. This is useful for stress-testing strategies against specific market conditions.

Generator Parameters

  • Starting Price ($): The initial stock price when the simulation begins.
  • Target End Price ($): The approximate ending price. The generator will trend toward this value over time, though volatility means it won't hit exactly.
  • Volatility (%): How much daily price fluctuation to simulate. Typical stocks range from 1-10%. Higher values create more dramatic swings.
  • Trend Strength: How strongly prices trend vs. random walk. Set to 0 for pure random movement, 1 for strong directional trend.
  • Number of Data Points: How many price observations to generate. 252 points equals roughly one trading year of daily data.
  • Initial Cash ($): Your simulated starting capital for the backtest.
  • Prices to Hit (Optional): Comma-separated price levels you want the simulation to reach. Useful for testing how your script handles specific price targets.

Click Generate Chart to create the price data and visualize it. Click Export CSV if you want to save the generated data for later use.

Running a Backtest

Once your price data is loaded, you'll see an interactive chart showing the full price history along with key statistics about the data.

Generated Price Chart

Data Statistics

Below the chart, summary statistics help you understand the data you're testing against:

  • Data Points: Total number of price observations in the dataset
  • Start Price: The opening price at the beginning of the period
  • End Price: The closing price at the end of the period
  • Total Change: Overall percentage gain or loss across the entire period
  • Highest Price: The maximum price reached during the simulation
  • Lowest Price: The minimum price reached during the simulation

Selecting and Running Your Script

Use the Select Script dropdown at the top of the chart to choose which of your saved DipScripts you want to test. The dropdown shows all scripts from your repository.

Once selected, click Run Script to execute the backtest. The system will simulate your script running against every price point in the data, executing trades exactly as it would in live trading.

Backtest Execution

The backtester processes each price point sequentially, evaluating your script's conditions against the current simulated market state. All variables like $PROFIT, $PEAK_PRICE, and $LAST_BUY_PRICE update exactly as they would during live trading.

Analyzing Results

After the backtest completes, you'll see comprehensive results showing exactly how your strategy performed.

Backtest Results

Performance Metrics

The results panel displays key performance indicators:

  • Total Return: Your overall profit or loss in dollars. This is the bottom line - how much money the strategy made or lost.
  • Initial Capital: The starting cash you configured for the simulation.
  • Final Value: What your portfolio would be worth at the end, including any remaining cash and open positions.
  • Final Cash: The cash remaining after all trades, excluding any unrealized gains from open positions.
  • Max Drawdown: The largest peak-to-trough decline during the simulation. This is crucial for understanding risk - how much could you have been down at the worst point?
  • Unrealized Gain: Profit or loss on any shares still held at the end of the simulation.
  • Buy Trades / Sell Trades: Total number of each order type executed. This tells you how active your strategy is.
  • Win Rate: Percentage of profitable trades. A higher win rate generally indicates more consistent performance.

Trade Visualization

The price chart updates to show your actual entry and exit points:

  • Green markers (B): Buy orders executed at that price and time
  • Red markers (S): Sell orders executed at that price and time

This visual representation helps you understand when your strategy is trading and whether the timing makes sense given the price action.

Trade History

Below the chart, a detailed trade log shows every transaction: the date, action (buy/sell), quantity, price, and running totals. Use this to audit your strategy's behavior and identify patterns or problems.

Iterating on Your Strategy

The real power of backtesting comes from iteration:

  1. Review the results and identify issues (too many trades? exits too early? poor win rate?)
  2. Modify your script in the Scripts tab (adjust profit targets, stop losses, entry conditions)
  3. Return to the Backtester and run again with the same data
  4. Compare results to see if changes improved performance
  5. Test against different market conditions (bullish, bearish, high volatility)

Backtesting Limitations

While backtesting is valuable, remember that past performance doesn't guarantee future results. The backtester assumes perfect execution at the simulated price, which may not reflect real-world slippage or liquidity constraints. Always paper trade before going live, even with a well-backtested strategy.

System Architecture

Technical details about how DipSkip operates under the hood.

Script Execution

Your DipScript runs continuously in a loop, executing line by line. Each iteration evaluates all conditions against current market data and your position state. The execution frequency is configurable but typically runs every 5 seconds during market hours.

Rate Limiting

To prevent hitting broker API limits and ensure fair usage across all users, DipSkip implements intelligent rate limiting:

  • Token Bucket Algorithm: API calls are rate-limited using a token bucket with automatic refill
  • Request Throttling: If limits are approached, requests are automatically queued
  • Graceful Degradation: The system prioritizes trade execution over data fetching when under load

Caching

To improve performance and reduce API calls, frequently accessed data is cached with appropriate TTLs:

  • Account Data: Cached for 60 seconds
  • Position Data: Cached for 60 seconds
  • Stock Prices: Cached for 30 seconds
  • Market Status: Cached for 60 seconds

Cache is automatically invalidated after trades to ensure your script sees updated position data.

Error Handling

DipSkip implements comprehensive error handling to ensure reliability:

  • Automatic Retries: Failed API calls are automatically retried with exponential backoff
  • Connection Timeouts: HTTP connections timeout after 15 seconds, requests after 30 seconds
  • Database Resilience: Database operations use connection pooling with automatic reconnection
  • Error Logging: All errors are logged with full context for debugging

Price Fetch Resilience

DipSkip includes intelligent handling for temporary price data failures to prevent unnecessary script pauses:

  • Retry on Failure: Each price fetch attempt includes up to 10 automatic retries with 500ms delays
  • Skip Counting: If a price fetch still fails after retries, the script execution is skipped (not paused)
  • Threshold Protection: After 20 consecutive skipped executions due to price fetch failures, the script is automatically paused
  • Automatic Recovery: The skip counter resets to zero after any successful price fetch

This approach ensures your scripts remain running through temporary market data interruptions while still protecting against persistent connectivity issues. You'll see log messages like:

Skipping execution due to price fetch failure (3/20 skips)

If your script is paused due to reaching the skip threshold, simply resume it once market data connectivity is restored. The skip counter will be reset when the script is resumed.

Scalability

The system is designed to handle hundreds of concurrent users:

  • Thread Pool: Configurable thread pool for handling concurrent script executions
  • Connection Pooling: Database connections are pooled for efficient resource usage
  • Async Order Tracking: Order status polling runs in background threads to avoid blocking

Dark Mode Support

DipSkip fully supports dark mode across all interfaces. Your preference is saved and applied automatically. Toggle dark mode in your user settings.

Error Codes

When DipSkip encounters an issue during script execution, it generates a structured error with a unique error code, descriptive message, and correlation ID for debugging. Understanding these codes helps you quickly diagnose and resolve issues.

Error Format

All errors follow this format:

[E-XXX-NNN] Error message | Correlation: uuid
  • E-XXX-NNN: The error code (category + number)
  • Error message: Human-readable description of what went wrong
  • Correlation ID: Unique identifier to trace the error through logs

Validation Errors (VAL)

Script syntax and structure issues that prevent execution.

CodeNameDescriptionResolution
E-VAL-001 Invalid Script Syntax Script failed validation checks Review your script syntax and fix any highlighted errors
E-VAL-002 Multiple OR Clauses Script has more than one OR operator in a line Split complex conditions into multiple lines with one OR each
E-VAL-003 Invalid Command Format Command structure doesn't match expected pattern Check command syntax: BUY/SELL quantity @ price
E-VAL-004 Missing @ Symbol Trade command missing @ price separator Add @ followed by price: BUY 100 @ $MARKET_PRICE
E-VAL-005 Invalid @ Format Command has multiple @ symbols Use only one @ symbol per command
E-VAL-006 Invalid OR Expression Neither side of OR expression is valid Ensure both sides of the OR are valid conditions
E-VAL-007 Invalid Comparison Comparison operator used with invalid operands Check that both sides of the comparison are valid values
E-VAL-008 Invalid Operator Unknown or unsupported operator Use supported operators: =, >, <, >=, <=
E-VAL-009 Unknown Value Unrecognized value or variable Check spelling of variables and ensure they start with $
E-VAL-010 Invalid USD Amount USD value couldn't be parsed Use valid numeric format: $100 or $100.50

Price/Data Fetch Errors (PRC)

Market data retrieval issues.

CodeNameDescriptionResolution
E-PRC-001 Stock Price Unavailable Unable to get current market price Execution skipped automatically; script pauses after 20 consecutive failures. Check ticker symbol, market hours, and broker connection.
E-PRC-002 Stale Price Data (Buy) Price fetch failed during buy order Execution skipped automatically; script pauses after 20 consecutive failures. Check market data connectivity.
E-PRC-003 Stale Price Data (Sell) Price fetch failed during sell order Execution skipped automatically; script pauses after 20 consecutive failures. Check market data connectivity.
E-PRC-004 Account Data Unavailable Unable to retrieve account info Check broker connection and API status

Ticker Errors (TKR)

Invalid or unknown ticker symbol issues.

CodeNameDescriptionResolution
E-TKR-001 Invalid Ticker Symbol Ticker symbol not found or not tradeable Verify the symbol is correct. DipSkip validates symbols against Tradier's API to ensure they're tradeable.

Pattern Day Trader Errors (PDT)

Day trading restriction violations. These protect you from PDT rule violations.

CodeNameDescriptionResolution
E-PDT-001 PDT Account Under Minimum PDT flagged account is under $25k equity Add funds to reach $25k or wait 90 days for PDT flag to clear
E-PDT-002 Would Trigger PDT This trade would trigger PDT status Wait for existing day trades to expire (5 business day rolling window)
E-PDT-003 PDT Day Trade Limit All 3 day trades used on account under $25k Wait for day trades to clear or add funds to reach $25k

Pattern Day Trader Rule

The PDT rule restricts accounts under $25,000 to 3 day trades per 5 business days. A day trade is buying and selling the same stock on the same day. DipSkip automatically tracks your day trades and prevents violations that could freeze your account.

Buy Order Errors (BUY)

Issues preventing buy orders from executing.

CodeNameDescriptionResolution
E-BUY-001 Insufficient Buying Power Not enough funds for the order Reduce order size or add funds to your account
E-BUY-002 Cannot Afford Minimum Can't afford even 1 share after safety buffer Add funds or choose a lower-priced stock
E-BUY-003 Buy Order Pending Already have an open buy order Wait for pending order to fill or cancel it
E-BUY-004 Buy Order Rejected Broker rejected the buy order Check broker rejection reason in your brokerage account
E-BUY-005 Invalid Buy Quantity Calculated quantity is zero or negative Review your quantity calculation in the script

Sell Order Errors (SEL)

Issues preventing sell orders from executing.

CodeNameDescriptionResolution
E-SEL-001 No Shares Owned No position to sell Verify you own shares before attempting to sell
E-SEL-002 Anti-Shorting Protection Sell quantity exceeds owned shares Reduce sell quantity or use $ALL to sell entire position
E-SEL-003 Pending Sell Conflict Pending sells would exceed position Wait for pending orders to complete or cancel them
E-SEL-004 Position Changed Position changed mid-execution This is typically temporary - restart the script
E-SEL-005 Sell Order Rejected Broker rejected the sell order Check broker rejection reason in your brokerage account
E-SEL-006 Invalid Sell Quantity Calculated sell quantity is invalid Review your quantity calculation in the script

Variable Resolution Errors (VAR)

Issues with variable substitution in scripts.

CodeNameDescriptionResolution
E-VAR-001 Variable Not Found Referenced variable doesn't exist Check variable spelling and ensure it's defined
E-VAR-002 Circular Reference Variables reference each other in a loop Break the circular dependency between variables

System/Internal Errors (SYS)

Unexpected system failures. These typically require investigation.

CodeNameDescriptionResolution
E-SYS-001 Script Crashed Unhandled exception during execution Check logs using correlation ID; contact support if persistent
E-SYS-002 Trading Internal Error Trading system error Retry the operation; check broker status
E-SYS-003 Database Error Database operation failed This is typically temporary; restart your script
E-SYS-004 Broker API Error Broker API returned unexpected error Check broker status page; may be temporary outage
E-SYS-005 Timeout Error Operation took too long Retry the operation; may indicate network issues

User-Initiated States (USR)

Actions triggered by user commands in scripts.

CodeNameDescriptionResolution
E-USR-001 Script Stopped STOP command executed in script This is intentional - your script reached a STOP command

Using the Correlation ID

Every error includes a unique correlation ID (shown with a fingerprint icon on the dashboard). This ID traces through all related log events and is essential for debugging complex issues.

Reporting Issues

When contacting support about an error, always include the full error code and correlation ID. This allows us to quickly locate and analyze the exact sequence of events that led to the error.

Disclaimer

The examples and strategies shown in this documentation are for educational purposes only and do not constitute financial advice. Trading stocks involves substantial risk of loss and is not suitable for every investor. Always conduct thorough testing, understand the risks, and consider your risk tolerance before implementing any automated trading strategy. Past performance does not guarantee future results.