Have something to say?

Tell us how we could make the product more useful to you.

Java Error, when running a backtest:

java.lang.NullPointerException: Cannot invoke "com.strategyquant.tradinglib.IBlock.evaluateBlock(int)" because "this.Indicator" is null DATA: MetaTrader5 (hedged), USA500IDXUSD_dukascopy, M15, 2015.01.01 - 2025.05.26 Spread: 460, Slippage: 0 Commission: $ 0.00 per full lot, Swap: -979.17/396.54 points per day MONEY MANAGEMENT: Initial Capital: $10000, RiskFixedBalancePct, Risk: 1, Decimals: 1, LotsIfNoMM: 1, MaxLots: 50 TRADING OPTIONS: ExitAtEndOfDay: false EODExitTime: 23:55 ExitOnFriday: false FridayExitTime: 23:00 MarketOpenSession: No Session PSEUDO CODE: #Strategy Name = US500_RSI2_Long_Improved Type = MetaTrader4 Symbol = US500 Timeframe = M15 #StrategyCharts Main chart = US500 / M15 #MoneyManagement Method = Fixed size, 0.1 lots Initial Capital = 10000 #Variables #Signals LongEntrySignal = MABarClosesAbove(Simple,Close,200)[1] AND RSI(Close,2)[1] < 15 AND ATR(14)[1] 60 ShortExitSignal = False #Long entry [If-Then, OnBarUpdate, OnBarOpen] ------------- #If Condition = LongEntrySignal AND NOT ShortEntrySignal #Then #EnterAtMarket Direction = Long Size = 0.1 MagicNumber = 11111 Profit Target = 4xATR(14) Stop Loss = 3xATR(14) #Long exit [If-Then, OnBarUpdate, OnBarOpen] ------------- #If Condition = LongExitSignal AND NOT LongEntrySignal #Then #ClosePosition Direction = Long Symbol = Current MagicNumber = 11111 #Description Long-only improved mean reversion for US500 M15: Buy if price is above 200-SMA, RSI(2) < 15, and ATR(14) is below its recent high (limits exposure to calmer periods). Exit when RSI(2) > 60. Fixed 0.1 lot size, PT=4xATR(14), SL=3xATR(14). No shorts; trend and volatility filters slow overtrading. Mode = CreateMode

ottigermichael 7 months ago

AI Demo

Error when running backtest

pseudocode #Strategy Name = Multi-Indicator Hard-Vote with Trend Filter (GBPUSD H4, Optimized) Type = MetaTrader Symbol = GBPUSD Timeframe = H4 #StrategyCharts Main chart = GBPUSD / H4 #MoneyManagement Method = Fixed size, 0.1 lots Initial Capital = 10000 #Variables #Signals [Signals, OnBarUpdate, OnBarOpen] -------------------- LongEntrySignal = ( (Close[1] CrossesAbove BollingerBands(20, 2, Lower)[1]) + (Stochastic(9, 3, 3, Simple, Close/Close, Fast %K)[1] > 20 AND Stochastic(9, 3, 3, Simple, Close/Close, Fast %K)[1] CrossesAbove Stochastic(9, 3, 3, Simple, Close/Close, Slow %D)[1]) + (BearsPower(10)[1] > 0) + (BullsPower(10)[1] > 0) + (HeikenAshi(HAClose)[1] > HeikenAshi(HAOpen)[1]) ) >= 3 ShortEntrySignal = ( (Close[1] CrossesBelow BollingerBands(20, 2, Upper)[1]) + (Stochastic(9, 3, 3, Simple, Close/Close, Fast %K)[1] < 80 AND Stochastic(9, 3, 3, Simple, Close/Close, Fast %K)[1] CrossesBelow Stochastic(9, 3, 3, Simple, Close/Close, Slow %D)[1]) + (BearsPower(10)[1] < 0) + (BullsPower(10)[1] < 0) + (HeikenAshi(HAClose)[1] < HeikenAshi(HAOpen)[1]) ) >= 3 #Long [If-Then, OnBarUpdate, OnBarOpen] -------------------- #If Condition = LongEntrySignal AND SMA(50)[1] > SMA(200)[1] AND ATR(14)[1] > 0.0008 #Then #ClosePosition Direction = Short #EnterAtMarket Direction = Long Profit Target = 1.5xATR(14) Stop Loss = 1.5xATR(14) Trailing Stop = 1xATR(14) TS Activation Level = 1.5xATR(14) #Short [If-Then, OnBarUpdate, OnBarOpen] -------------------- #If Condition = ShortEntrySignal AND SMA(50)[1] < SMA(200)[1] AND ATR(14)[1] > 0.0008 #Then #ClosePosition Direction = Long #EnterAtMarket Direction = Short Profit Target = 1.5xATR(14) Stop Loss = 1.5xATR(14) Trailing Stop = 1xATR(14) TS Activation Level = 1.5xATR(14) #Description This optimized GBPUSD H4 strategy introduces a trend filter, only allowing long positions when the 50-period SMA is above the 200-period SMA, and shorts when the 50-period SMA is below the 200-period SMA. The volatility filter ATR(14) > 0.0008 avoids low-volatility noise. Indicator voting uses updated, faster parameters (Stochastic 9,3,3 and Bulls/Bears Power 10), with 3 of 5 signals required for entry. Exits are tightened to 1.5xATR(14) for both target and stop loss. A 1xATR trailing stop, activated at 1.5xATR, locks in gains on moves. This configuration aims for higher-quality, trend-aligned trades and controlled drawdowns. Error while running backtest: Error while converting text to strategy - Error: Invalid JSON response from llm: Unterminated string in JSON at position 5405 (line 1 column 5406)

joeleong817 11 months ago

AI Demo

Issue with Money Management Removal – StrategyQuant Builder

Summary of the Issue: When attempting to remove dynamic or percentage-based money management from the generated trading strategy in StrategyQuant Builder, the system automatically reverts to the default setting of "Fixed size, 0.1 lots" for the #MoneyManagement section, instead of allowing full deletion or omission. This behavior prevents users from generating a strategy file that contains no money management settings or leaves position sizing for manual management. **Details:** - The original strategy used “Risk fixed % balance” money management. - The request was to “delete the money management,” expecting the #MoneyManagement section to be removed or not included at all. - Instead, the builder replaced the dynamic method with the default "Fixed size, 0.1 lots" method automatically. **Problems Encountered:** - There is currently no way to generate a strategy without any money management section, as one is always imposed. - This limits the flexibility of users who wish to manage position sizing externally or through other means. - It may also cause confusion if users expect the tool to allow a "no money management" option. **Feedback & Suggestions:** - Please add the ability to fully omit or remove the #MoneyManagement section when requested by the user, instead of defaulting perpetually to "Fixed size."- Consider introducing an explicit “None” or “External” option for Money Management for advanced users. - Clarify in documentation or in the builder interface that at least one money management method is always required, or provide a warning if none is allowed. **Impact:** This limitation reduces the usability of the strategy builder for advanced users and can lead to unintended risk settings or deployment problems. **Request:** Please review this logic and provide a fix or alternative to allow users to exclude money management settings as needed. --- pseudocode #Strategy Name = Multi-Indicator Hard Voting Forex Strategy Type = MetaTrader Symbol = GBPUSD Timeframe = H4 #StrategyCharts Main chart = GBPUSD / H4 #MoneyManagement Method = Fixed size, 0.1 lots Initial Capital = 10000 #Variables StopLossCandles = 5 #Signals [Signals, OnBarUpdate, OnBarOpen] -------------------- LongEntrySignal = ( ( (Close[1] CrossesAbove BollingerBands(20, 2, Lower)[1]) + (Stochastic(14, 3, 3, Simple, Low/High, Fast %K)[1] CrossesAbove 20) + (BullsPower(13)[1] > 0) + (HeikenAshi(HAClose)[1] > HeikenAshi(HAOpen)[1]) + (BearsPower(13)[1] < 0) ) >= 3 ) ShortEntrySignal = ( ( (Close[1] CrossesBelow BollingerBands(20, 2, Upper)[1]) + (Stochastic(14, 3, 3, Simple, Low/High, Fast %K)[1] CrossesBelow 80) + (BearsPower(13)[1] > 0) + (HeikenAshi(HAClose)[1] < HeikenAshi(HAOpen)[1]) + (BullsPower(13)[1] < 0) ) >= 3 ) #Long [If-Then, OnBarUpdate, OnBarOpen] -------------------- #If Condition = LongEntrySignal #Then #ClosePosition Direction = Short #EnterAtMarket Direction = Long Stop Loss = Lowest(Low, 5)[1] Profit Target = 2x(LatestEntryPrice[1] - Lowest(Low, 5)[1]) Trailing Stop = 450 points TS Activation Level = 700 points #Short [If-Then, OnBarUpdate, OnBarOpen] -------------------- #If Condition = ShortEntrySignal #Then #ClosePosition Direction = Long #EnterAtMarket Direction = Short Stop Loss = Highest(High, 5)[1] Profit Target = 2x(Highest(High, 5)[1] - LatestEntryPrice[1]) Trailing Stop = 450 points TS Activation Level = 700 points #Description This strategy trades the 4-hour chart using a confluence of five technical indicators for high-confidence trade entries. A hard-voting system requires at least 3 of 5 "voters” (Bollinger Bands(20,2), Stochastic(14,3,3), Bulls Power(13), Bears Power(13), Heiken Ashi candles) to generate the appropriate bullish or bearish signals before allowing a trade. For long entries, signals include price reversals from the lower Bollinger Band, Stochastic crossing up from oversold, Bulls Power positive, Heiken Ashi turning green, or Bears Power negative. For short entries, signals are triggered by reversals from the upper Bollinger Band, Stochastic crossing down from overbought, Bears Power positive, Heiken Ashi turning red, or Bulls Power negative. The strategy uses a fixed position size. Stop loss for longs is just below the lowest low of the past 5 candles; shorts above the highest high. The take profit is 2x this SL distance for a 2:1 RR. Optional trailing stop of 450 points is activated upon 700 points of profit. The strategy is applicable to all major/minor pairs as listed, enabling portfolio-level diversification.

joeleong817 11 months ago

AI Demo