ProRealCode - Trading & Coding with ProRealTime™
Hi everyone,
This is my first post within the community here.
I just finalised the following trading strategy (1mn intraday/scalp trading on DAX, Long only, trying to capture momentum based on MACD and SMA crossovers with TP/SL/trailing working alongside 60mn ATR).
I am very happy with the backtest but when i try to make the strategy live PRT comes up with this an error message that, I am sure everybody might be familiar with: “The trading system was stopped because the historical data loaded was insufficient to calculate at least one indicator during the evaluation of the last candlestick. You can avoid this in the future by changing the number of preloaded bars with instruction DEFPARAM (ex: DEFPARAM Preladedbars = 10000).“
Though, as you can see in my code the DEFPARAM Preloadedbars is already set to 10000 and PRT caps this to that amount.
I have tried – with the famous AI: Cl**de – to tackle this but still no luck after many culprits attempted. Would anyone from the community have an idea about this? Always very frustrated to have come with a nice and consistent strategy and not being able to make it live :/ ?
Note: I have written a quick description about the strategy and the help I would need at the beginning of the script as well as a definition/description for each parameter.
Thanks a lot in advance for anyone looking and spending time on this post.
…it seems that the file i tried to drop did not load correct. Here it is below:
// ================================================================
// DAX COMBINED ENVIRONMENTS — Long Only
// DAX 40 — 1 Minute Chart
// ================================================================
// STRATEGY OVERVIEW
// ----------------------------------------------------------------
// This strategy trades the DAX 40 on a 1-minute chart, long only.
// It classifies the current market into one of four daily
// environments based on where price sits relative to the 20-day
// SMA and the level/direction of the 14-day RSI. Each environment
// has its own set of entry filters, exit conditions and ATR-based
// risk parameters, all independently toggleable and tunable.
//
// Entry signals are momentum-based: the strategy looks for
// accelerating MACD divergence, accelerating SMA divergence,
// accelerating MACD histogram, consecutive green Heikin Ashi bars,
// and a minimum 1-minute RSI level — all computed on the 1-minute
// chart during a defined intraday session window.
//
// Risk is managed via hourly ATR multiples for stop loss, take
// profit and trailing stop — all frozen at entry so they remain
// consistent for the duration of the trade.
//
// ----------------------------------------------------------------
// KNOWN PRODUCTION ISSUE — HELP REQUESTED
// ----------------------------------------------------------------
// The strategy runs correctly in ProBacktest but crashes in
// ProOrder live production with the error:
// "The trading system was stopped because the historical data
// loaded was insufficient to calculate at least one indicator
// during the evaluation of the last candlestick."
// DEFPARAM PreLoadBars is already set to 10000 (the platform
// maximum). The issue appears related to the TIMEFRAME(daily)
// and/or TIMEFRAME(1 hour) blocks — specifically RSI[14] and
// Average[20] inside the daily timeframe, and AverageTrueRange[14]
// inside the hourly timeframe. Any help identifying which indicator
// causes the failure and how to resolve it within the 10000 bar
// preload constraint would be greatly appreciated.
// ================================================================
DEFPARAM CumulateOrders = False
DEFPARAM PreLoadBars = 10000
// ================================================================
// PARAMETERS — GLOBAL
// ================================================================
// ATR period used for the 1-minute ATR fallback calculation
ATRPeriod = 7
// If the DAX drops more than this % vs previous day's close,
// no new trades are allowed for that day (drawdown circuit breaker)
MaxDayDropPct = 4.0
// --- Daily SMA environment thresholds
// Price must be within this % band above/below the 20-day SMA
// to qualify as BuL or BeL (moderate bull/bear environments)
SMABandPct = 1.5
// Price must be beyond this % above/below the 20-day SMA
// to qualify as BuXL or BeXL (extreme bull/bear environments)
SMABandXLPct = 1.51
// --- Daily RSI thresholds
// BuXL: RSI must be above this level (strong bullish momentum)
RSIBuXLMin = 56
// BuL: RSI must be between RSIBuLLo and RSIBuLHi (moderate bullish)
RSIBuLHi = 65.9
RSIBuLLo = 50.01
// BeL: RSI must be between RSIBeLLo and RSIBeLHi (moderate bearish)
RSIBeLHi = 50.00
RSIBeLLo = 34.01
// BeXL: RSI must be below this level (strong bearish momentum)
RSIBeXLMax = 34
// ================================================================
// PARAMETERS — BuXL ENVIRONMENT
// ================================================================
// BuXL = Bullish Extreme
// Activated when:
// - Price is more than +1.51% above the 20-day SMA (strong uptrend)
// - 14-day RSI is above 56 (bullish momentum confirmed)
// - 14-day RSI is above its own 14-day SMA (momentum is rising)
// This is the most bullish of the four environments.
// ----------------------------------------------------------------
// Set to 1 to allow trading in this environment, 0 to disable it
UseBuXL = 1
// --- Entry: MACD divergence momentum
// Measures how much the gap between MACD line and signal line
// has increased over the lookback period. A rising divergence
// means bullish momentum is building on the 1-minute chart.
// Toggle: 1 = filter active, 0 = filter ignored
BuXLUseMACDDivMom = 1
// Minimum increase in MACD divergence required over the lookback
// (MACD divergence now minus MACD divergence N bars ago >= this value)
BuXLMACDDivMomPct = 0.30
// Number of 1-minute bars to look back when measuring the increase
BuXLMACDDivMomBars = 5
// --- Entry: SMA divergence momentum
// Measures how much the gap between the 1-minute SMA20 and SMA50
// has changed over the lookback period. A rising (or less negative)
// divergence % confirms the short-term trend is strengthening.
// Toggle: 1 = filter active, 0 = filter ignored
BuXLUseSMADivMom = 1
// Minimum change in SMA divergence % required over the lookback
// (negative value means even a slight deterioration is acceptable)
BuXLSMADivMomPct = -0.09
// Number of 1-minute bars to look back when measuring the change
BuXLSMADivMomBars = 4
// --- Entry: MACD histogram momentum
// Measures how much the MACD histogram value has increased over
// the lookback period. A rising histogram means bullish momentum
// is accelerating on the 1-minute chart.
// Toggle: 1 = filter active, 0 = filter ignored
BuXLUseMACDHistMom = 1
// Minimum increase in histogram value required over the lookback
BuXLMACDHistMomPct = 1.30
// Number of 1-minute bars to look back when measuring the increase
BuXLMACDHistMomBars = 5
// Set to 1 to additionally require the histogram to be above zero
// (i.e. MACD line already above signal line). 0 = no requirement.
BuXLMACDHistAboveZero = 0
// --- Entry: Heikin Ashi consecutive green bars
// Requires a minimum number of consecutive green Heikin Ashi bars
// on the 1-minute chart before entry is allowed. Green HA bars
// (HA close > HA open) indicate sustained short-term buying pressure.
// Toggle: 1 = filter active, 0 = filter ignored
BuXLUseHAGreen = 1
// Minimum number of consecutive green HA bars required at entry
BuXLEntryHAGreenBars = 7
// --- Entry: 1-minute RSI minimum level
// Requires the 1-minute RSI(14) to be above a minimum threshold
// at the time of entry, filtering out oversold or weak momentum bars.
// Toggle: 1 = filter active, 0 = filter ignored
BuXLUseRSI1m = 1
// 1-minute RSI must be above this value for entry to be allowed
BuXLEntryRSI1mMin = 30
// --- Exit: consecutive SMA bear bars
// Exits the trade if the 1-minute SMA20 has been below SMA50
// for this many consecutive bars, signalling trend deterioration.
// Toggle: 1 = exit condition active, 0 = ignored
BuXLUseExitSMABear = 0
// Number of consecutive bars where SMA20 < SMA50 required to exit
BuXLExitSMABearBars = 15
// --- Exit: consecutive negative MACD histogram bars
// Exits if the MACD histogram has been negative for this many
// consecutive bars, indicating momentum has turned bearish.
// Toggle: 1 = exit condition active, 0 = ignored
BuXLUseExitMACDNeg = 0
// Number of consecutive negative histogram bars required to exit
BuXLExitMACDNegBars = 14
// --- Exit: MACD histogram trough threshold
// Exits if the current histogram value reaches a set percentage
// of the previous histogram trough (most negative recent value).
// For example 200% means histogram has reached twice the depth
// of the previous trough, indicating strong bearish reversal.
// Toggle: 1 = exit condition active, 0 = ignored
BuXLUseExitMACDTrough = 0
// Percentage of previous trough at which to exit (e.g. 200 = 200%)
BuXLExitMACDTroughPct = 200
// --- Cooldown
// Number of 1-minute bars to wait after a trade closes before
// allowing the next entry. Prevents immediate re-entry after exits.
BuXLCooldownBars = 2
// --- ATR risk management
// All SL, TP and trail levels are calculated as multiples of the
// hourly ATR(14) value frozen at the moment of entry.
// Toggle: 1 = stop loss active, 0 = no stop loss
BuXLUseSL = 1
// Stop loss = entry price minus (ATR at entry x this multiplier)
BuXLSLMult = 1.8
// Toggle: 1 = take profit active, 0 = no take profit
BuXLUseTP = 1
// Take profit = entry price plus (ATR at entry x this multiplier)
BuXLTPMult = 2.4
// Toggle: 1 = trailing stop active, 0 = no trailing stop
BuXLUseTrail = 0
// Trail activates once price has moved this multiple of ATR in profit
BuXLTrailTrigMult = 2.1
// Once active, trail stop sits this multiple of ATR below current close
BuXLTrailDistMult = 2.1
// --- Daily limits
// Maximum cumulative profit in points allowed per day in this environment.
// Once reached, no new trades fire for the rest of the day.
BuXLMaxDailyGain = 210
// Maximum cumulative loss in points allowed per day in this environment.
// Once reached, no new trades fire for the rest of the day.
BuXLMaxDailyLoss = 50
// ================================================================
// PARAMETERS — BuL ENVIRONMENT
// ================================================================
// BuL = Bullish Light
// Activated when:
// - Price is between 0% and +1.5% above the 20-day SMA
// (price above SMA but not stretched)
// - 14-day RSI is between 50.01 and 65.9 (moderate bullish)
// - 14-day RSI is above its own 14-day SMA (momentum rising)
// ================================================================
UseBuL = 1
BuLUseMACDDivMom = 1
BuLMACDDivMomPct = 0.015
BuLMACDDivMomBars = 6
BuLUseSMADivMom = 1
BuLSMADivMomPct = -0.05
BuLSMADivMomBars = 5
BuLUseMACDHistMom = 1
BuLMACDHistMomPct = 0.035
BuLMACDHistMomBars = 6
BuLMACDHistAboveZero = 0
BuLUseHAGreen = 1
BuLEntryHAGreenBars = 2
BuLUseRSI1m = 1
BuLEntryRSI1mMin = 25
BuLUseExitSMABear = 0
BuLExitSMABearBars = 40
BuLUseExitMACDNeg = 0
BuLExitMACDNegBars = 11
BuLUseExitMACDTrough = 0
BuLExitMACDTroughPct = 120
BuLCooldownBars = 3
BuLUseSL = 1
BuLSLMult = 0.5
BuLUseTP = 1
BuLTPMult = 2.5
BuLUseTrail = 1
BuLTrailTrigMult = 1.5
BuLTrailDistMult = 1.5
BuLMaxDailyGain = 500
BuLMaxDailyLoss = 40
// ================================================================
// PARAMETERS — BeL ENVIRONMENT
// ================================================================
// BeL = Bearish Light
// Activated when:
// - Price is between 0% and -1.5% below the 20-day SMA
// (price below SMA but not stretched)
// - 14-day RSI is between 34.01 and 50.00 (moderate bearish)
// - 14-day RSI is below its own 14-day SMA (momentum falling)
// Even in bearish environments the strategy is long only —
// it looks for intraday bounces and momentum reversals.
// ================================================================
UseBeL = 1
BeLUseMACDDivMom = 1
BeLMACDDivMomPct = 0.25
BeLMACDDivMomBars = 2
BeLUseSMADivMom = 1
BeLSMADivMomPct = 0.08
BeLSMADivMomBars = 10
BeLUseMACDHistMom = 1
BeLMACDHistMomPct = 0.40
BeLMACDHistMomBars = 10
BeLMACDHistAboveZero = 0
BeLUseHAGreen = 1
BeLEntryHAGreenBars = 2
BeLUseRSI1m = 0
BeLEntryRSI1mMin = 25
BeLUseExitSMABear = 0
BeLExitSMABearBars = 15
BeLUseExitMACDNeg = 0
BeLExitMACDNegBars = 10
BeLUseExitMACDTrough = 0
BeLExitMACDTroughPct = 200
BeLCooldownBars = 1
BeLUseSL = 1
BeLSLMult = 1.5
BeLUseTP = 1
BeLTPMult = 1.0
BeLUseTrail = 0
BeLTrailTrigMult = 1.0
BeLTrailDistMult = 1.5
BeLMaxDailyGain = 60
BeLMaxDailyLoss = 50
// ================================================================
// PARAMETERS — BeXL ENVIRONMENT
// ================================================================
// BeXL = Bearish Extreme
// Activated when:
// - Price is more than -1.51% below the 20-day SMA (strong downtrend)
// - 14-day RSI is below 34 (bearish momentum confirmed)
// - 14-day RSI is below its own 14-day SMA (momentum still falling)
// This is the most bearish of the four environments. The strategy
// still trades long only, targeting sharp intraday relief bounces.
// ================================================================
UseBeXL = 1
BeXLUseMACDDivMom = 1
BeXLMACDDivMomPct = 0.20
BeXLMACDDivMomBars = 2
BeXLUseSMADivMom = 1
BeXLSMADivMomPct = 0.045
BeXLSMADivMomBars = 12
BeXLUseMACDHistMom = 1
BeXLMACDHistMomPct = 0.60
BeXLMACDHistMomBars = 4
BeXLMACDHistAboveZero = 0
BeXLUseHAGreen = 1
BeXLEntryHAGreenBars = 1
BeXLUseRSI1m = 0
BeXLEntryRSI1mMin = 40
BeXLUseExitSMABear = 1
BeXLExitSMABearBars = 80
BeXLUseExitMACDNeg = 0
BeXLExitMACDNegBars = 1
BeXLUseExitMACDTrough = 0
BeXLExitMACDTroughPct = 100
BeXLCooldownBars = 1
BeXLUseSL = 1
BeXLSLMult = 1.0
BeXLUseTP = 1
BeXLTPMult = 1.0
BeXLUseTrail = 0
BeXLTrailTrigMult = 2.0
BeXLTrailDistMult = 1.5
BeXLMaxDailyGain = 350
BeXLMaxDailyLoss = 40
// ================================================================
// SECTION 0 — DST AWARE SESSION
// ================================================================
// The DAX session is defined in local London time.
// PRT adjusts automatically with the broker clock so no manual
// offset is needed — simply enter the times as seen on the chart.
// Summer and winter values are identical here since this is a
// purely London-time session (BST and GMT produce the same HHMM).
SessionOpenWinter = 0800
SessionCloseWinter = 1429
SessionOpenSummer = 0800
SessionCloseSummer = 1429
IsDST = 0
IF Month = 3 AND Day >= 14 AND Day <= 28 THEN
IsDST = 1
ENDIF
IF Month > 3 AND Month < 11 THEN
IsDST = 1
ENDIF
IF Month = 11 AND Day <= 7 THEN
IsDST = 1
ENDIF
SessionOpen = SessionOpenWinter
SessionClose = SessionCloseWinter
IF IsDST = 1 THEN
SessionOpen = SessionOpenSummer
SessionClose = SessionCloseSummer
ENDIF
InSession = 0
IF Hour * 100 + Minute >= SessionOpen AND Hour * 100 + Minute < SessionClose THEN
InSession = 1
ENDIF
// ================================================================
// SECTION 0B — DAILY INDICATORS
// ================================================================
// Daily RSI(14) and SMA20 are sourced from the daily timeframe.
// PriceVsSMA20 is then calculated using the live 1-minute close
// vs the daily SMA20, giving a real-time reading of how stretched
// price is relative to the daily trend anchor.
// DailySmRSI is the 14-day SMA of DailyRSI, computed manually
// using a day-shift store to avoid nested timeframe calculations.
//
// *** THIS SECTION IS THE SUSPECTED SOURCE OF THE PRODUCTION ERROR ***
// TIMEFRAME(daily) with RSI[14] and Average[20] appears to require
// more historical daily bars than PRT can provide in production mode
// even with PreLoadBars = 10000 (the platform maximum).
TIMEFRAME(daily, UpdateOnClose)
DailyRSI = RSI[14](close)
DailySMA20 = Average[20](close)
TIMEFRAME(default)
PriceVsSMA20 = 0
IF DailySMA20 <> 0 THEN
PriceVsSMA20 = (Close - DailySMA20) / DailySMA20 * 100
ENDIF
IF BarIndex = 0 THEN
DailyRSIStore1 = DailyRSI
DailyRSIStore2 = DailyRSI
DailyRSIStore3 = DailyRSI
DailyRSIStore4 = DailyRSI
DailyRSIStore5 = DailyRSI
DailyRSIStore6 = DailyRSI
DailyRSIStore7 = DailyRSI
DailyRSIStore8 = DailyRSI
DailyRSIStore9 = DailyRSI
DailyRSIStore10 = DailyRSI
DailyRSIStore11 = DailyRSI
DailyRSIStore12 = DailyRSI
DailyRSIStore13 = DailyRSI
DailyRSIStore14 = DailyRSI
ENDIF
IF Day <> Day[1] THEN
DailyRSIStore14 = DailyRSIStore13
DailyRSIStore13 = DailyRSIStore12
DailyRSIStore12 = DailyRSIStore11
DailyRSIStore11 = DailyRSIStore10
DailyRSIStore10 = DailyRSIStore9
DailyRSIStore9 = DailyRSIStore8
DailyRSIStore8 = DailyRSIStore7
DailyRSIStore7 = DailyRSIStore6
DailyRSIStore6 = DailyRSIStore5
DailyRSIStore5 = DailyRSIStore4
DailyRSIStore4 = DailyRSIStore3
DailyRSIStore3 = DailyRSIStore2
DailyRSIStore2 = DailyRSIStore1
DailyRSIStore1 = DailyRSI
ENDIF
DailySmRSI = (DailyRSIStore1 + DailyRSIStore2 + DailyRSIStore3 + DailyRSIStore4 + DailyRSIStore5 + DailyRSIStore6 + DailyRSIStore7 + DailyRSIStore8 + DailyRSIStore9 + DailyRSIStore10 + DailyRSIStore11 + DailyRSIStore12 + DailyRSIStore13 + DailyRSIStore14) / 14
ONCE PrevDayClose = Close
IF Day <> Day[1] THEN
PrevDayClose = Close[1]
ENDIF
DayOverDay = 0
IF PrevDayClose <> 0 THEN
DayOverDay = (Close - PrevDayClose) / PrevDayClose * 100
ENDIF
DayDropBlocked = 0
IF MaxDayDropPct > 0 AND DayOverDay <= -MaxDayDropPct THEN
DayDropBlocked = 1
ENDIF
// ================================================================
// SECTION 1 — ENVIRONMENT DETECTION
// ================================================================
IsBuXL = 0
IsBuL = 0
IsBeL = 0
IsBeXL = 0
IF UseBuXL = 1 THEN
IF PriceVsSMA20 > SMABandXLPct AND DailyRSI > RSIBuXLMin AND DailyRSI > DailySmRSI THEN
IsBuXL = 1
ENDIF
ENDIF
IF UseBuL = 1 THEN
IF PriceVsSMA20 >= 0 AND PriceVsSMA20 <= SMABandPct AND DailyRSI > RSIBuLLo AND DailyRSI < RSIBuLHi AND DailyRSI > DailySmRSI THEN
IsBuL = 1
ENDIF
ENDIF
IF UseBeL = 1 THEN
IF PriceVsSMA20 < 0 AND PriceVsSMA20 >= -SMABandPct AND DailyRSI > RSIBeLLo AND DailyRSI < RSIBeLHi AND DailyRSI < DailySmRSI THEN
IsBeL = 1
ENDIF
ENDIF
IF UseBeXL = 1 THEN
IF PriceVsSMA20 < -SMABandXLPct AND DailyRSI < RSIBeXLMax AND DailyRSI < DailySmRSI THEN
IsBeXL = 1
ENDIF
ENDIF
AnyEnvActive = 0
IF IsBuXL = 1 OR IsBuL = 1 OR IsBeL = 1 OR IsBeXL = 1 THEN
AnyEnvActive = 1
ENDIF
// ================================================================
// SECTION 2 — SELECT ACTIVE ENVIRONMENT PARAMETERS
// ================================================================
// Defaults use impossible thresholds (999) so no trade fires
// unless a real environment block overwrites the Active* variables.
ActiveUseMACDDivMom = 1
ActiveMACDDivMomPct = 999
ActiveMACDDivMomBars = 1
ActiveUseSMADivMom = 1
ActiveSMADivMomPct = 999
ActiveSMADivMomBars = 1
ActiveUseMACDHistMom = 1
ActiveMACDHistMomPct = 999
ActiveMACDHistMomBars = 1
ActiveMACDHistAboveZero = 0
ActiveUseHAGreen = 1
ActiveEntryHAGreenBars = 999
ActiveUseRSI1m = 1
ActiveEntryRSI1mMin = 999
ActiveUseExitSMABear = 0
ActiveExitSMABearBars = 0
ActiveUseExitMACDNeg = 0
ActiveExitMACDNegBars = 0
ActiveUseExitMACDTrough = 0
ActiveExitMACDTroughPct = 0
ActiveCooldownBars = 0
ActiveUseSL = 1
ActiveSLMult = 1.5
ActiveUseTP = 1
ActiveTPMult = 2.0
ActiveUseTrail = 0
ActiveTrailTrigMult = 1.0
ActiveTrailDistMult = 1.5
ActiveMaxDailyGain = 350
ActiveMaxDailyLoss = 150
IF IsBuXL = 1 THEN
ActiveUseMACDDivMom = BuXLUseMACDDivMom
ActiveMACDDivMomPct = BuXLMACDDivMomPct
ActiveMACDDivMomBars = BuXLMACDDivMomBars
ActiveUseSMADivMom = BuXLUseSMADivMom
ActiveSMADivMomPct = BuXLSMADivMomPct
ActiveSMADivMomBars = BuXLSMADivMomBars
ActiveUseMACDHistMom = BuXLUseMACDHistMom
ActiveMACDHistMomPct = BuXLMACDHistMomPct
ActiveMACDHistMomBars = BuXLMACDHistMomBars
ActiveMACDHistAboveZero = BuXLMACDHistAboveZero
ActiveUseHAGreen = BuXLUseHAGreen
ActiveEntryHAGreenBars = BuXLEntryHAGreenBars
ActiveUseRSI1m = BuXLUseRSI1m
ActiveEntryRSI1mMin = BuXLEntryRSI1mMin
ActiveUseExitSMABear = BuXLUseExitSMABear
ActiveExitSMABearBars = BuXLExitSMABearBars
ActiveUseExitMACDNeg = BuXLUseExitMACDNeg
ActiveExitMACDNegBars = BuXLExitMACDNegBars
ActiveUseExitMACDTrough = BuXLUseExitMACDTrough
ActiveExitMACDTroughPct = BuXLExitMACDTroughPct
ActiveCooldownBars = BuXLCooldownBars
ActiveUseSL = BuXLUseSL
ActiveSLMult = BuXLSLMult
ActiveUseTP = BuXLUseTP
ActiveTPMult = BuXLTPMult
ActiveUseTrail = BuXLUseTrail
ActiveTrailTrigMult = BuXLTrailTrigMult
ActiveTrailDistMult = BuXLTrailDistMult
ActiveMaxDailyGain = BuXLMaxDailyGain
ActiveMaxDailyLoss = BuXLMaxDailyLoss
ENDIF
IF IsBuL = 1 THEN
ActiveUseMACDDivMom = BuLUseMACDDivMom
ActiveMACDDivMomPct = BuLMACDDivMomPct
ActiveMACDDivMomBars = BuLMACDDivMomBars
ActiveUseSMADivMom = BuLUseSMADivMom
ActiveSMADivMomPct = BuLSMADivMomPct
ActiveSMADivMomBars = BuLSMADivMomBars
ActiveUseMACDHistMom = BuLUseMACDHistMom
ActiveMACDHistMomPct = BuLMACDHistMomPct
ActiveMACDHistMomBars = BuLMACDHistMomBars
ActiveMACDHistAboveZero = BuLMACDHistAboveZero
ActiveUseHAGreen = BuLUseHAGreen
ActiveEntryHAGreenBars = BuLEntryHAGreenBars
ActiveUseRSI1m = BuLUseRSI1m
ActiveEntryRSI1mMin = BuLEntryRSI1mMin
ActiveUseExitSMABear = BuLUseExitSMABear
ActiveExitSMABearBars = BuLExitSMABearBars
ActiveUseExitMACDNeg = BuLUseExitMACDNeg
ActiveExitMACDNegBars = BuLExitMACDNegBars
ActiveUseExitMACDTrough = BuLUseExitMACDTrough
ActiveExitMACDTroughPct = BuLExitMACDTroughPct
ActiveCooldownBars = BuLCooldownBars
ActiveUseSL = BuLUseSL
ActiveSLMult = BuLSLMult
ActiveUseTP = BuLUseTP
ActiveTPMult = BuLTPMult
ActiveUseTrail = BuLUseTrail
ActiveTrailTrigMult = BuLTrailTrigMult
ActiveTrailDistMult = BuLTrailDistMult
ActiveMaxDailyGain = BuLMaxDailyGain
ActiveMaxDailyLoss = BuLMaxDailyLoss
ENDIF
IF IsBeL = 1 THEN
ActiveUseMACDDivMom = BeLUseMACDDivMom
ActiveMACDDivMomPct = BeLMACDDivMomPct
ActiveMACDDivMomBars = BeLMACDDivMomBars
ActiveUseSMADivMom = BeLUseSMADivMom
ActiveSMADivMomPct = BeLSMADivMomPct
ActiveSMADivMomBars = BeLSMADivMomBars
ActiveUseMACDHistMom = BeLUseMACDHistMom
ActiveMACDHistMomPct = BeLMACDHistMomPct
ActiveMACDHistMomBars = BeLMACDHistMomBars
ActiveMACDHistAboveZero = BeLMACDHistAboveZero
ActiveUseHAGreen = BeLUseHAGreen
ActiveEntryHAGreenBars = BeLEntryHAGreenBars
ActiveUseRSI1m = BeLUseRSI1m
ActiveEntryRSI1mMin = BeLEntryRSI1mMin
ActiveUseExitSMABear = BeLUseExitSMABear
ActiveExitSMABearBars = BeLExitSMABearBars
ActiveUseExitMACDNeg = BeLUseExitMACDNeg
ActiveExitMACDNegBars = BeLExitMACDNegBars
ActiveUseExitMACDTrough = BeLUseExitMACDTrough
ActiveExitMACDTroughPct = BeLExitMACDTroughPct
ActiveCooldownBars = BeLCooldownBars
ActiveUseSL = BeLUseSL
ActiveSLMult = BeLSLMult
ActiveUseTP = BeLUseTP
ActiveTPMult = BeLTPMult
ActiveUseTrail = BeLUseTrail
ActiveTrailTrigMult = BeLTrailTrigMult
ActiveTrailDistMult = BeLTrailDistMult
ActiveMaxDailyGain = BeLMaxDailyGain
ActiveMaxDailyLoss = BeLMaxDailyLoss
ENDIF
IF IsBeXL = 1 THEN
ActiveUseMACDDivMom = BeXLUseMACDDivMom
ActiveMACDDivMomPct = BeXLMACDDivMomPct
ActiveMACDDivMomBars = BeXLMACDDivMomBars
ActiveUseSMADivMom = BeXLUseSMADivMom
ActiveSMADivMomPct = BeXLSMADivMomPct
ActiveSMADivMomBars = BeXLSMADivMomBars
ActiveUseMACDHistMom = BeXLUseMACDHistMom
ActiveMACDHistMomPct = BeXLMACDHistMomPct
ActiveMACDHistMomBars = BeXLMACDHistMomBars
ActiveMACDHistAboveZero = BeXLMACDHistAboveZero
ActiveUseHAGreen = BeXLUseHAGreen
ActiveEntryHAGreenBars = BeXLEntryHAGreenBars
ActiveUseRSI1m = BeXLUseRSI1m
ActiveEntryRSI1mMin = BeXLEntryRSI1mMin
ActiveUseExitSMABear = BeXLUseExitSMABear
ActiveExitSMABearBars = BeXLExitSMABearBars
ActiveUseExitMACDNeg = BeXLUseExitMACDNeg
ActiveExitMACDNegBars = BeXLExitMACDNegBars
ActiveUseExitMACDTrough = BeXLUseExitMACDTrough
ActiveExitMACDTroughPct = BeXLExitMACDTroughPct
ActiveCooldownBars = BeXLCooldownBars
ActiveUseSL = BeXLUseSL
ActiveSLMult = BeXLSLMult
ActiveUseTP = BeXLUseTP
ActiveTPMult = BeXLTPMult
ActiveUseTrail = BeXLUseTrail
ActiveTrailTrigMult = BeXLTrailTrigMult
ActiveTrailDistMult = BeXLTrailDistMult
ActiveMaxDailyGain = BeXLMaxDailyGain
ActiveMaxDailyLoss = BeXLMaxDailyLoss
ENDIF
// ================================================================
// SECTION 3 — 1-MINUTE HEIKIN ASHI
// ================================================================
// HA candles are computed manually from standard OHLC data so the
// strategy can run on a standard 1-minute chart rather than
// requiring a Heikin Ashi chart type in PRT.
HAClose1 = (Open + High + Low + Close) / 4
IF BarIndex = 0 THEN
HAOpen1 = Open
ELSE
HAOpen1 = (HAOpen1[1] + HAClose1[1]) / 2
ENDIF
HAGreen1 = 0
HARed1 = 0
IF HAClose1 > HAOpen1 THEN
HAGreen1 = 1
ENDIF
IF HAClose1 <= HAOpen1 THEN
HARed1 = 1
ENDIF
// ================================================================
// SECTION 4 — 1-MINUTE INDICATORS
// ================================================================
MyATR = AverageTrueRange[ATRPeriod](Close)
MyRSI1m = RSI[14](Close)
MyMACDLine = ExponentialAverage[12](Close) - ExponentialAverage[26](Close)
MyMACDSigLn = ExponentialAverage[9](MyMACDLine)
MACDHist = MyMACDLine - MyMACDSigLn
MACDDiv = MyMACDLine - MyMACDSigLn
SMA1mFastVal = Average[20](Close)
SMA1mSlowVal = Average[50](Close)
SMA1mDivPct = 0
IF SMA1mSlowVal <> 0 THEN
SMA1mDivPct = (SMA1mFastVal - SMA1mSlowVal) / SMA1mSlowVal * 100
ENDIF
// ================================================================
// SECTION 5 — CONSECUTIVE BAR COUNTS
// ================================================================
IF HAGreen1 = 1 THEN
ConsecGreenHA = ConsecGreenHA[1] + 1
ELSE
ConsecGreenHA = 0
ENDIF
IF HARed1 = 1 THEN
ConsecRedHA = ConsecRedHA[1] + 1
ELSE
ConsecRedHA = 0
ENDIF
IF MACDHist > 0 THEN
ConsecPosMACDHist = ConsecPosMACDHist[1] + 1
ELSE
ConsecPosMACDHist = 0
ENDIF
IF MACDHist < 0 THEN
ConsecNegMACDHist = ConsecNegMACDHist[1] + 1
ELSE
ConsecNegMACDHist = 0
ENDIF
IF SMA1mFastVal < SMA1mSlowVal THEN
ConsecSMABear = ConsecSMABear[1] + 1
ELSE
ConsecSMABear = 0
ENDIF
// ================================================================
// SECTION 6 — MACD TROUGH TRACKING
// ================================================================
// Tracks the most negative MACD histogram value in the current
// bearish histogram cycle (CurrentMACDLow) and stores the trough
// from the previous cycle (PrevMACDLow) for use in the exit condition.
ONCE PrevMACDLow = 0
ONCE CurrentMACDLow = 0
IF MACDHist < 0 THEN
IF MACDHist < CurrentMACDLow THEN
CurrentMACDLow = MACDHist
ENDIF
ENDIF
IF MACDHist >= 0 AND MACDHist[1] < 0 THEN
PrevMACDLow = CurrentMACDLow
CurrentMACDLow = 0
ENDIF
// ================================================================
// SECTION 7 — COOLDOWN
// ================================================================
// Counts bars since the last trade closed. Prevents immediate
// re-entry by enforcing a minimum wait period after each trade.
ONCE BarsSinceClose = 9999
IF NOT LongOnMarket AND LongOnMarket[1] THEN
BarsSinceClose = 0
ELSIF NOT LongOnMarket THEN
BarsSinceClose = BarsSinceClose[1] + 1
ENDIF
CooldownOK = 1
IF FrozenCooldown > 0 AND BarsSinceClose < FrozenCooldown THEN
CooldownOK = 0
ENDIF
// ================================================================
// SECTION 8 — DAILY GAIN/LOSS TRACKING
// ================================================================
// Tracks cumulative intraday PnL in points. Resets each day.
// Blocks new trades if daily gain or loss limit is reached.
ONCE DailyPnL = 0
IF BarIndex = 0 THEN
EntryPxStore = Close
BarsSinceEntry = 0
ENDIF
IF Day <> Day[1] THEN
DailyPnL = 0
ENDIF
IF LongOnMarket AND NOT LongOnMarket[1] THEN
EntryPxStore = Close
BarsSinceEntry = 0
ELSIF LongOnMarket THEN
BarsSinceEntry = BarsSinceEntry[1] + 1
ELSE
BarsSinceEntry = 0
ENDIF
IF NOT LongOnMarket AND LongOnMarket[1] THEN
DailyPnL = DailyPnL + (Close - EntryPxStore)
ENDIF
DailyLimitReached = 0
IF ActiveMaxDailyGain > 0 AND DailyPnL >= ActiveMaxDailyGain THEN
DailyLimitReached = 1
ENDIF
IF ActiveMaxDailyLoss > 0 AND DailyPnL <= -ActiveMaxDailyLoss THEN
DailyLimitReached = 1
ENDIF
// ================================================================
// SECTION 9 — ATR BASED SL/TP/TRAIL
// ================================================================
// ATR is sourced from the hourly timeframe for stability.
// All risk levels are frozen at entry and held constant for
// the duration of the trade.
//
// *** THIS SECTION MAY ALSO CONTRIBUTE TO THE PRODUCTION ERROR ***
// AverageTrueRange[14] on the hourly timeframe requires 14 complete
// hourly bars. In production this may not be available immediately
// on strategy launch. SafeATR falls back to 1-minute ATR when
// the hourly ATR is not yet valid (below 1).
TIMEFRAME(1 hour, updateonclose)
HourlyATR = AverageTrueRange[14](close)
TIMEFRAME(1 minute, default)
SafeATR = MyATR
IF HourlyATR > 1 THEN
SafeATR = HourlyATR
ENDIF
IF BarIndex = 0 THEN
ATRAtEntry = SafeATR
FrozenUseSL = 1
FrozenSLMult = 1.5
FrozenUseTP = 1
FrozenTPMult = 2.0
FrozenUseTrail = 0
FrozenTrailTrig = 1.0
FrozenTrailDist = 1.5
FrozenExitSMABears = 10
FrozenUseExitSMA = 0
FrozenExitNegMACD = 5
FrozenUseExitNegMACD = 0
FrozenExitTrough = 80
FrozenUseExitTrough = 0
FrozenCooldown = 5
ENDIF
IF LongOnMarket AND NOT LongOnMarket[1] THEN
ATRAtEntry = SafeATR
FrozenUseSL = ActiveUseSL
FrozenSLMult = ActiveSLMult
FrozenUseTP = ActiveUseTP
FrozenTPMult = ActiveTPMult
FrozenUseTrail = ActiveUseTrail
FrozenTrailTrig = ActiveTrailTrigMult
FrozenTrailDist = ActiveTrailDistMult
FrozenExitSMABears = ActiveExitSMABearBars
FrozenUseExitSMA = ActiveUseExitSMABear
FrozenExitNegMACD = ActiveExitMACDNegBars
FrozenUseExitNegMACD = ActiveUseExitMACDNeg
FrozenExitTrough = ActiveExitMACDTroughPct
FrozenUseExitTrough = ActiveUseExitMACDTrough
FrozenCooldown = ActiveCooldownBars
ENDIF
IF ATRAtEntry < 1 THEN
ATRAtEntry = SafeATR
ENDIF
DynSL = ATRAtEntry * FrozenSLMult
DynTP = ATRAtEntry * FrozenTPMult
DynTrailTrig = ATRAtEntry * FrozenTrailTrig
DynTrailDist = ATRAtEntry * FrozenTrailDist
// ================================================================
// SECTION 10 — TRAILING STOP
// ================================================================
ONCE TrailSLLevel = 0
ONCE TrailActive = 0
IF LongOnMarket AND NOT LongOnMarket[1] THEN
TrailSLLevel = 0
TrailActive = 0
ENDIF
IF LongOnMarket AND FrozenUseTrail = 1 THEN
IF DynTrailTrig > 0 AND Close >= EntryPxStore + DynTrailTrig THEN
TrailActive = 1
ENDIF
IF TrailActive = 1 THEN
NewTrail = Close - DynTrailDist
IF NewTrail > TrailSLLevel THEN
TrailSLLevel = NewTrail
ENDIF
ENDIF
ENDIF
IF NOT LongOnMarket THEN
TrailSLLevel = 0
TrailActive = 0
ENDIF
// ================================================================
// SECTION 11 — ENTRY CONDITIONS
// ================================================================
// All momentum lookbacks are pre-computed at fixed depths so
// ProOrder can determine the maximum history required at compile
// time. This resolves the "insufficient historical data" error
// that occurs in production when variable lookbacks are used.
MACDDivN1 = MACDDiv[1]
MACDDivN2 = MACDDiv[2]
MACDDivN3 = MACDDiv[3]
MACDDivN4 = MACDDiv[4]
MACDDivN5 = MACDDiv[5]
MACDDivN6 = MACDDiv[6]
MACDDivN7 = MACDDiv[7]
MACDDivN8 = MACDDiv[8]
MACDDivN9 = MACDDiv[9]
MACDDivN10 = MACDDiv[10]
SMADivN1 = SMA1mDivPct[1]
SMADivN2 = SMA1mDivPct[2]
SMADivN3 = SMA1mDivPct[3]
SMADivN4 = SMA1mDivPct[4]
SMADivN5 = SMA1mDivPct[5]
SMADivN6 = SMA1mDivPct[6]
SMADivN7 = SMA1mDivPct[7]
SMADivN8 = SMA1mDivPct[8]
SMADivN9 = SMA1mDivPct[9]
SMADivN10 = SMA1mDivPct[10]
SMADivN12 = SMA1mDivPct[12]
MACDHistN1 = MACDHist[1]
MACDHistN2 = MACDHist[2]
MACDHistN3 = MACDHist[3]
MACDHistN4 = MACDHist[4]
MACDHistN5 = MACDHist[5]
MACDHistN6 = MACDHist[6]
MACDHistN7 = MACDHist[7]
MACDHistN8 = MACDHist[8]
MACDHistN9 = MACDHist[9]
MACDHistN10 = MACDHist[10]
MACDDivLookback = MACDDiv
IF ActiveMACDDivMomBars = 1 THEN
MACDDivLookback = MACDDivN1
ENDIF
IF ActiveMACDDivMomBars = 2 THEN
MACDDivLookback = MACDDivN2
ENDIF
IF ActiveMACDDivMomBars = 3 THEN
MACDDivLookback = MACDDivN3
ENDIF
IF ActiveMACDDivMomBars = 4 THEN
MACDDivLookback = MACDDivN4
ENDIF
IF ActiveMACDDivMomBars = 5 THEN
MACDDivLookback = MACDDivN5
ENDIF
IF ActiveMACDDivMomBars = 6 THEN
MACDDivLookback = MACDDivN6
ENDIF
IF ActiveMACDDivMomBars = 7 THEN
MACDDivLookback = MACDDivN7
ENDIF
IF ActiveMACDDivMomBars = 8 THEN
MACDDivLookback = MACDDivN8
ENDIF
IF ActiveMACDDivMomBars = 9 THEN
MACDDivLookback = MACDDivN9
ENDIF
IF ActiveMACDDivMomBars = 10 THEN
MACDDivLookback = MACDDivN10
ENDIF
SMADivLookback = SMA1mDivPct
IF ActiveSMADivMomBars = 1 THEN
SMADivLookback = SMADivN1
ENDIF
IF ActiveSMADivMomBars = 2 THEN
SMADivLookback = SMADivN2
ENDIF
IF ActiveSMADivMomBars = 3 THEN
SMADivLookback = SMADivN3
ENDIF
IF ActiveSMADivMomBars = 4 THEN
SMADivLookback = SMADivN4
ENDIF
IF ActiveSMADivMomBars = 5 THEN
SMADivLookback = SMADivN5
ENDIF
IF ActiveSMADivMomBars = 6 THEN
SMADivLookback = SMADivN6
ENDIF
IF ActiveSMADivMomBars = 7 THEN
SMADivLookback = SMADivN7
ENDIF
IF ActiveSMADivMomBars = 8 THEN
SMADivLookback = SMADivN8
ENDIF
IF ActiveSMADivMomBars = 9 THEN
SMADivLookback = SMADivN9
ENDIF
IF ActiveSMADivMomBars = 10 THEN
SMADivLookback = SMADivN10
ENDIF
IF ActiveSMADivMomBars = 12 THEN
SMADivLookback = SMADivN12
ENDIF
MACDHistLookback = MACDHist
IF ActiveMACDHistMomBars = 1 THEN
MACDHistLookback = MACDHistN1
ENDIF
IF ActiveMACDHistMomBars = 2 THEN
MACDHistLookback = MACDHistN2
ENDIF
IF ActiveMACDHistMomBars = 3 THEN
MACDHistLookback = MACDHistN3
ENDIF
IF ActiveMACDHistMomBars = 4 THEN
MACDHistLookback = MACDHistN4
ENDIF
IF ActiveMACDHistMomBars = 5 THEN
MACDHistLookback = MACDHistN5
ENDIF
IF ActiveMACDHistMomBars = 6 THEN
MACDHistLookback = MACDHistN6
ENDIF
IF ActiveMACDHistMomBars = 7 THEN
MACDHistLookback = MACDHistN7
ENDIF
IF ActiveMACDHistMomBars = 8 THEN
MACDHistLookback = MACDHistN8
ENDIF
IF ActiveMACDHistMomBars = 9 THEN
MACDHistLookback = MACDHistN9
ENDIF
IF ActiveMACDHistMomBars = 10 THEN
MACDHistLookback = MACDHistN10
ENDIF
MACDDivMomOK = 1
IF ActiveUseMACDDivMom = 1 AND ActiveMACDDivMomBars > 0 THEN
MACDDivChange = MACDDiv - MACDDivLookback
IF MACDDivChange < ActiveMACDDivMomPct THEN
MACDDivMomOK = 0
ENDIF
ENDIF
SMADivMomOK = 1
IF ActiveUseSMADivMom = 1 AND ActiveSMADivMomBars > 0 THEN
SMADivChange = SMA1mDivPct - SMADivLookback
IF SMADivChange < ActiveSMADivMomPct THEN
SMADivMomOK = 0
ENDIF
ENDIF
MACDHistMomOK = 1
IF ActiveUseMACDHistMom = 1 AND ActiveMACDHistMomBars > 0 THEN
MACDHistChange = MACDHist - MACDHistLookback
IF MACDHistChange < ActiveMACDHistMomPct THEN
MACDHistMomOK = 0
ENDIF
IF ActiveMACDHistAboveZero = 1 AND MACDHist <= 0 THEN
MACDHistMomOK = 0
ENDIF
ENDIF
HAGreenOK = 1
IF ActiveUseHAGreen = 1 AND ActiveEntryHAGreenBars > 0 THEN
IF ConsecGreenHA < ActiveEntryHAGreenBars THEN
HAGreenOK = 0
ENDIF
ENDIF
RSI1mOK = 1
IF ActiveUseRSI1m = 1 AND ActiveEntryRSI1mMin > 0 THEN
IF MyRSI1m < ActiveEntryRSI1mMin THEN
RSI1mOK = 0
ENDIF
ENDIF
EntryConditionMet = 0
IF MACDDivMomOK = 1 AND SMADivMomOK = 1 AND MACDHistMomOK = 1 AND HAGreenOK = 1 AND RSI1mOK = 1 THEN
EntryConditionMet = 1
ENDIF
// ================================================================
// SECTION 12 — EXIT CONDITIONS
// ================================================================
// Exit conditions only fire when the relevant toggle is set to 1.
// All thresholds are frozen at entry so they remain consistent
// even if the environment changes during the trade.
ExitConditionMet = 0
SMABearExitOK = 0
MACDNegExitOK = 0
MACDTroughExitOK = 0
IF LongOnMarket AND BarsSinceEntry >= 2 THEN
IF FrozenUseExitSMA = 1 THEN
IF FrozenExitSMABears > 0 AND ConsecSMABear >= FrozenExitSMABears THEN
SMABearExitOK = 1
ENDIF
ENDIF
IF FrozenUseExitNegMACD = 1 THEN
IF FrozenExitNegMACD > 0 AND ConsecNegMACDHist >= FrozenExitNegMACD THEN
MACDNegExitOK = 1
ENDIF
ENDIF
IF FrozenUseExitTrough = 1 THEN
IF FrozenExitTrough > 0 AND PrevMACDLow < 0 THEN
TroughThreshold = PrevMACDLow * (FrozenExitTrough / 100)
IF MACDHist <= TroughThreshold THEN
MACDTroughExitOK = 1
ENDIF
ENDIF
ENDIF
IF SMABearExitOK = 1 OR MACDNegExitOK = 1 OR MACDTroughExitOK = 1 THEN
ExitConditionMet = 1
ENDIF
ENDIF
// ================================================================
// SECTION 13 — STRATEGY ACTIVE
// ================================================================
StrategyActive = 0
IF AnyEnvActive = 1 AND InSession = 1 AND DayDropBlocked = 0 AND DailyLimitReached = 0 THEN
StrategyActive = 1
ENDIF
PositionClear = 0
IF NOT LongOnMarket AND NOT ShortOnMarket THEN
PositionClear = 1
ENDIF
// ================================================================
// SECTION 14 — TRADE EXECUTION
// ================================================================
IF StrategyActive = 1 AND PositionClear = 1 AND EntryConditionMet = 1 AND CooldownOK = 1 THEN
BUY 1 CONTRACTS AT MARKET
ENDIF
IF LongOnMarket AND ExitConditionMet = 1 THEN
SELL AT MARKET
ENDIF
IF LongOnMarket AND FrozenUseTrail = 1 AND TrailActive = 1 AND TrailSLLevel > 0 THEN
SELL AT TrailSLLevel STOP
ELSIF LongOnMarket AND FrozenUseSL = 1 AND DynSL > 0 THEN
SELL AT EntryPxStore - DynSL STOP
ENDIF
IF LongOnMarket AND FrozenUseTP = 1 AND DynTP > 0 THEN
SELL AT EntryPxStore + DynTP LIMIT
ENDIF
IF Hour * 100 + Minute >= SessionClose AND LongOnMarket THEN
SELL AT MARKET
ENDIF
Hello,
Personally, I have no problems activating the strategy.
Do you have PRT version 12?
Do you have the PRT Premium or complete version?
I don’t know if you plan to use your strategy in a live or demo account, but if I may offer some advice, don’t do it. It’s not a viable strategy. If you use the correct spread, your max drawdown is greater than the global performance of the last 3 years.
Your strategy was clearly generated by AI. To my knowledge, I don’t know of any viable long-term AI-generated strategies accessible to general public (including paid subscriptions). Humans are currently much better at creating effective long-term strategies than AI. But for how much longer…?
You’re right to be interested in AI in trading, but in my opinion it’s still too early to delegate entirely this task.
Hi turame, thanks a lot for your feedback
It is weird as when in blacktest it with 1.4pt spread (IG spread on Germany 40) both on PRT and Tradingview it comes with constant positive pnl for the past 1.5yrs.
If you could back test it for a longer period (which I am not able to do) with 1.4pt spread, could you please share a screenshot of what the pnl looks over time?
fyi, I have been trading dax and nasdaq100 with the same strategy for 8 years, I created my own strategy but would like to automate it and not look at my screen since I have a busy job.
also the version I have is 12 on PRT and plan is linked to IG
I’m also using IG with PRT v12. However, I have the premium version, which you apparently don’t. This version provides 1 million historical bars. Here’s the backtest on 1 million historical bars with a spread of 1.4.
However, be aware that the spread isn’t 1.4 on the DAX 1€ contract.
The spread on the DAX is between 1.8 and 2.0 between 9:00 AM and 5:30 PM.
This spread is 2.8 between 8:00 AM and 9:00 AM.
If you’ve been profitable for 8 years, this robot probably doesn’t perfectly reflect your strategy.
thank you very much for your help!
could the spread not be the same between “spread bet” account and “cfd” account on IG maybe? on my spread bet account the spread is always between 1.4 and 1.6 between 0900 and 1700 CET, then it is 2.8 pre and post market.
With CFDs, I know it depends on the contract value. For example, if you’re trading the DAX at €5, then the spread is 1.4/1.5.
Spread betting accounts aren’t available in France, only in the UK and Ireland, I believe. So I only use CFDs.
Even with a spread of 1.4, the result isn’t grea unfortunatly.
Emmanuel Beaucarnot wrote: idea about this?
The code lines below running on 1mn TF would need 20,160 preload bars for the RSI and 28,800 preload bars for MA … clearly well beyond the 10,000 bars preload in the code.
If you drop your RSI and MS to 6 days it might work without you getting the error message about not enough history etc?
Let us know how you get on please?
TIMEFRAME(daily, UpdateOnClose)
DailyRSI = RSI[14](close)
DailySMA20 = Average[20](close)
“Historical data loaded was insufficient” when making strategy live
This topic contains 8 replies,
has 3 voices, and was last updated by GraHal
2 hours, 29 minutes ago.
| Forum: | Platform Support: Charts, Data & Broker Setup |
| Language: | English |
| Started: | 05/20/2026 |
| Status: | Active |
| Attachments: | 2 files |
The information collected on this form is stored in a computer file by ProRealCode to create and access your ProRealCode profile. This data is kept in a secure database for the duration of the member's membership. They will be kept as long as you use our services and will be automatically deleted after 3 years of inactivity. Your personal data is used to create your private profile on ProRealCode. This data is maintained by SAS ProRealCode, 407 rue Freycinet, 59151 Arleux, France. If you subscribe to our newsletters, your email address is provided to our service provider "MailChimp" located in the United States, with whom we have signed a confidentiality agreement. This company is also compliant with the EU/Swiss Privacy Shield, and the GDPR. For any request for correction or deletion concerning your data, you can directly contact the ProRealCode team by email at privacy@prorealcode.com If you would like to lodge a complaint regarding the use of your personal data, you can contact your data protection supervisory authority.