Entries need three things on the same bar: the 5 EMA crossing the 10 EMA, RSI(8) of the median price crossing 50, and a candle whose body is larger than both wicks. It has not been backtested yet, so there are no results to show.
| positionSize Contracts per trade | 1 |
| fastPeriod Fast EMA length | 5 |
| slowPeriod Slow EMA length | 10 |
| maType Average type, 1 = exponential | 1 |
| rsiPeriod RSI length on median price | 8 |
| rsiMidLevel RSI midline the RSI must cross | 50 |
| takeProfitLongPoints Long profit target in points | 262 |
| stopLossLongPoints Long stop in points | 39 |
| takeProfitShortPoints Short profit target in points | 26 |
| stopLossShortPoints Short stop in points | 50 |
| useHighLowTrail 0 trails on the close, 1 on high / low | 0 |
| trailStartPips Open profit in pips before the trail starts | 12 |
| trailBaseShare Share of open profit locked when the trail starts | 0.094 |
| trailStepPips Extra profit in pips per step of the locked share | 6 |
| trailShareIncrement Relative increase of the locked share per step | 0.102 |
| trailRoundOffset Rounding offset for the step count | -0.5 |
| trailMinDistancePips If price is closer than this to the trail level, exit at market | 7 |
The code
// ============================================================ // HLHB Trend Catcher // ProRealAlgos Strategy Library | prorealalgos.com // Type: Trend // Direction: Long & short // Timeframe tested: Not yet tested // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = false DEFPARAM PreloadBars = 50000 // --- Parameters --- positionSize = 1 // contracts per trade fastPeriod = 5 // fast average length slowPeriod = 10 // slow average length maType = 1 // 1 = exponential average rsiPeriod = 8 // RSI length, on median price rsiMidLevel = 50 // RSI must cross this line to confirm takeProfitLongPoints = 262 // long target stopLossLongPoints = 39 // long stop takeProfitShortPoints = 26 // short target stopLossShortPoints = 50 // short stop useHighLowTrail = 0 // 0 = trail on close, 1 = trail on high / low trailStartPips = 12 // open profit needed before the trail starts trailBaseShare = 0.094 // share of open profit locked at the start trailStepPips = 6 // each step of extra profit raises the locked share trailShareIncrement = 0.102 // relative increase of the locked share per step trailRoundOffset = -0.5 // rounding offset for the step count trailMinDistancePips = 7 // closer than this to the level, exit at market ONCE tradeAllowed = 1 // trading allowed from the first bar // --- Indicators --- fastMA = Average[fastPeriod, maType](close) slowMA = Average[slowPeriod, maType](close) rsiValue = RSI[rsiPeriod](MedianPrice) minExitDistance = trailMinDistancePips * PipSize // A "long candle" has a body wider than both wicks together. candleBody = abs(close - open) upperWick = high - max(close, open) lowerWick = min(close, open) - low longCandle = candleBody > upperWick + lowerWick longBullish = longCandle AND open < close longBearish = longCandle AND open > close
95 more lines: the entry and exit rules.
Setup
Questions
The code is written as an automated system with 1 contract per trade. It has not been compile checked or backtested yet.
None so far. No backtest has been run, so there are no instrument results.
Without a backtest there is no drawdown figure to size from. The long stop of 39 points and short stop of 50 points give the per trade risk at 1 contract.
Signals run on whatever chart the system is loaded on. An earlier 1 hour signal timeframe and hour filter are not part of this version.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.