Easylanguage EURUSD H1 Robot
This TradeStation/EasyLanguage code defines an automated algorithmic trading system that features distinct rules for both Long (buying) and Short (selling) trades. It was generated by Adaptrade Builder and includes custom entry conditions, volatility-based pricing, multiple exit protocols, and dynamic position sizing.
Here is the breakdown of how the strategy operates:
1. Position Sizing & Money Management
The strategy calculates the number of shares or contracts to trade dynamically based on your total account equity.
- Starting Equity: Begins with a base of $1,000 plus any accrued profits (open and closed).
- Risk Allocation: It targets 10% of the current equity (determined by the PSParam set to 10) and divides that by the absolute value of the entry price (adjusted by the instrument's BigPointValue). This means you buy fewer shares of expensive assets and more shares of cheaper assets, keeping the capital footprint proportional.
- Limits: The final share count is rounded to the nearest whole number, strictly bounded by a minimum of 1 and a maximum of 100 shares/contracts.
2. Long Trade Logic (Buying)
The long side of the strategy is a volatility-adjusted momentum breakout.
- Filter/Condition: A trade is only allowed if the current Typical Price (High + Low + Close) / 3 is greater than or equal to the Typical Price from 6 bars ago. This ensures the strategy only buys into an upward trend.
- Entry Trigger: If the trend condition is met, it places a Stop buy order above the current market. The entry price is calculated by taking the lowest High of the last 5 bars and adding a massive 4.4964x multiple of the 31-period Average True Range (ATR).
- Exits:
- Trailing Stop: Once the trade is in profit by at least 0.85x ATR(31), a trailing stop activates. It trails at 35% of the open profit, ratcheting upwards as the price rises.
- Profit Target: A limit order is placed at the entry price plus 6.42x the previous single bar's True Range.
- Time Stop: If the trade is still open after 98 bars, it force-exits at the market.
3. Short Trade Logic (Selling)
The short side is a volume-confirmed breakdown relying on traditional Floor Trader Pivots.
- Filter/Condition: A short trade is only allowed if the current bar's Volume is greater than or equal to its 13-period Exponential Moving Average (EMA). This ensures that selling pressure has above-average participation.
- Entry Trigger: The system manually calculates the Support 1 (S1) level from standard Pivot Points based on the previous bar's High, Low, and Close. It places a Stop sell order below the market at the S1 level minus 1.98x ATR(47).
- Exits:
- Hard Stop Loss: It uses a fixed dollar-amount stop loss of $512.82 per share/contract above the entry price. (Note: Depending on the asset traded, this is a very wide or very specific dollar stop).
- Profit Target: A limit order to buy-to-cover is placed at the entry price minus 1.398x ATR(47).
- (Note: There is no trailing stop or time-based exit for short trades in this code).
Summary of the Strategy's Character
This is an asymmetrical system. The Long side is built for long-term trend following: it demands a massive breakout to enter (~4.5 ATRs), gives the trade a long time to work out (98 bars), and uses a trailing stop to capture runners. The Short side is built for quicker, high-volume momentum scalps: it enters on a breakdown below a known support pivot, uses a tighter profit target (~1.4 ATRs), and has a fixed emergency stop rather than a trailing one.
Use on demoaccount first.