READ-ONLY

The forum is now a read-only archive.

For bug reports & platform questions → [email protected]

Our community lives on Discord and YouTube — come join us!

Strategy Quant X 136.1451: java.lang.NumberException: String empty

5 replies

Lorenzo

Customer, bbp_participant, community, sq-ultimate, 15 replies.

Visit profile

3 years ago #281288

I am studying the “live trading of automated trading strategies” module of the free course available on Lab.strateyquant.com.
In particular, I am following the “Webinar – More Stable and profitable Strategies”. The use of Algowizard is shown during the course.
The webinar uses a version previous to the one in my possession. The first difference is the lack in the “then” block of the Price section in the “Long Entry” tab, where on the webinar, it sets itself as a formula Highest (150) [1] which seems to be as a Boolean function.
So I tried to set something similar in the “Trading Signals” tab, in the following way:

Highest (150) [1] X = Open (0)

You can see the screenshot below:

By performing the backtest, I get the Java.lang.numberformatexception error: Empty String. As a programmer, I understand that there is a string conversion error to a number. But what does this mistake originate from? I noticed that it is a mistake that often appears, even in simple tests that I have tried independently. Is this due to something I don’t know? How do you adapt the example of the webinar to the current versions of Strategy Quant X? I have an Ultimate Build 136,1451 version which should be the most recent stable version.

Thank you very much.

 

 

 

Attachments:
You must be logged in to view attached files.

0

Lorenzo

Customer, bbp_participant, community, sq-ultimate, 15 replies.

Visit profile

3 years ago #281291

HI,
I apologize. Unfortunately, webinar Youtube compression makes it difficult to read what is set.
I made a mistake, but it was not read to the monitor. It was not to change the then with “Enter at stop” section, previously I had left the Defualt a “Enter at Markert” that’s why rightly there was no possibility of setting up a “price.” But the meaning remains!

I add some information and a question.

Considering my mistake, I tried from the logs to understand which empty field could generate this situation. But I couldn’t understand. The stack trace of the exception is followed.

[coda]17:07:22.613 [qtp22249027-5360] INFO c.s.p.S.i.A.AlgoWizardServlet – Incoming backtest request
17:07:22.614 [qtp22249027-5360] INFO c.s.p.S.i.A.AlgoWizardServlet – Running full backtest for @EW/H1, from 02.01.2009 to 06.04.2022
17:07:23.290 [Blocking computeThread common #0 – Base_Strategy_14] ERROR StandardBlock – NumberFormatException, XML: <Item customSnippet=”false” key=”EnterAtStop” name=”(STOP) Enter at stop” display=”EnterAtStop” returnType=”order” mI=”Open” categoryType=”other”>
<Param key=”#ExitAfterBars.ExitAfterBars#” name=”Exit After Bars” type=”int” defaultValue=”0″ displayOnDefault=”false” controlType=”jspinnerVar” minValue=”0″ maxValue=”99999″ step=”1″ exitMethod=”true” builderMinValue=”5″ builderMaxValue=”500″ builderStep=”1″ />
<Param key=”#MoveSL2BE.MoveSL2BE#” name=”Move SL to BE” type=”double” isFormula=”true” defaultValue=”SQ.Formulas.RangeLevel.None” displayOnDefault=”false” controlType=”RangeLevel” exitMethod=”true” exitMethodType=”SL”>
<Formula key=”SQ.Formulas.RangeLevel.None” />
</Param>
<Param key=”#MoveSL2BE.SL2BEAddPips#” name=”SL to BE – Add pips” type=”double” isFormula=”true” displayOnDefault=”false” controlType=”Range” exitMethod=”true” dependentOn=”MoveSL2BE.MoveSL2BE” exitMethodType=”SL”>
<Formula key=”SQ.Formulas.Range.None” />
</Param>
<Param key=”#ProfitTarget.ProfitTarget#” name=”Profit Target” type=”double” isFormula=”true” displayOnDefault=”false” controlType=”SLPT” exitMethod=”true” exitMethodType=”PT”>
<Formula key=”SQ.Formulas.SLPT.None” />
</Param>
<Param key=”#StopLoss.StopLoss#” name=”Stop Loss” type=”double” isFormula=”true” displayOnDefault=”false” controlType=”SLPT” exitMethod=”true” exitMethodType=”SL”>
<Formula key=”SQ.Formulas.SLPT.FixedValue”>
<Param key=”#Value#” name=”Value” type=”double” defaultValue=”50″ controlType=”jspinnerVar” minValue=”1″ maxValue=”9999999″ step=”1″ postfix=”pips” builderMinValue=”5″ builderMaxValue=”500″ builderStep=”1″ />
</Formula>
</Param>
<Param key=”#TrailingStop.TrailingStop#” name=”Trailing Stop” type=”double” isFormula=”true” displayOnDefault=”false” controlType=”RangeLevel” exitMethod=”true” exitMethodType=”SL”>
<Formula key=”SQ.Formulas.RangeLevel.FixedValue”>
<Param key=”#Value#” name=”Value” type=”double” defaultValue=”50″ controlType=”jspinnerVar” minValue=”1″ maxValue=”9999999″ step=”1″ postfix=”pips” builderMinValue=”5″ builderMaxValue=”500″ builderStep=”1″ />
</Formula>
</Param>
<Param key=”#TrailingStop.TrailingActivation#” name=”TS Activation Level” type=”double” isFormula=”true” displayOnDefault=”false” controlType=”Range” exitMethod=”true” dependentOn=”TrailingStop.TrailingStop” exitMethodType=”SL”>
<Formula key=”SQ.Formulas.Range.None” />
</Param>
<Param key=”#ReplaceExisting#” name=”Replace Existing Order” type=”boolean” defaultValue=”true” displayOnDefault=”false” controlType=”booleanVar” builderStep=”1″>true</Param>
<Param key=”#MagicNumber#” name=”Magic Number” type=”int” defaultValue=”MagicNumber” displayOnDefault=”false” controlType=”comboVar” builderStep=”1″ />
<Param key=”#Comment#” name=”Comment” type=”string” defaultValue=”” displayOnDefault=”false” controlType=”editbox” builderStep=”1″>123</Param>
<Param key=”#AllowDuplicateTrades#” name=”Allow Duplicate Trades” type=”boolean” defaultValue=”false” displayOnDefault=”false” controlType=”booleanVar” builderStep=”1″ />
<Param key=”#BarsValid#” name=”Bars Valid” type=”int” defaultValue=”0″ displayOnDefault=”false” controlType=”jspinnerVar” minValue=”0″ maxValue=”1000″ step=”1″ builderMinValue=”0″ builderMaxValue=”200″ builderStep=”1″ notSupportedFor=”EL” />
<Param key=”#Price#” name=”Price” type=”double” isFormula=”true” controlType=”Price” required=”true”>
<Formula key=”SQ.Formulas.Price.UseFormula”>
<Block key=”#Value#” name=”Value” type=”value” valueType=”price” controlType=”value”>
<Item customSnippet=”false” key=”Highest” name=”Highest” display=”Highest(@Chart@#Period#)[#Shift#]” returnType=”price” mI=”HighestIndex” categoryType=”indicator”>
<Param key=”#Chart#” name=”Chart” type=”data” controlType=”dataVar” defaultValue=”0″>0</Param>
<Param key=”#ComputedFrom#” name=”Computed From” type=”int” controlType=”combo” values=”Close=0,Open=1,High=2,Low=3,Median=4,Typical=5,Weighted=6″ defaultValue=”0″>0</Param>
<Param key=”#Period#” name=”Period” type=”int” defaultValue=”14″ genMinValue=”-1000003″ genMaxValue=”-1000004″ paramType=”period” controlType=”jspinnerVar” minValue=”1″ maxValue=”10000″ step=”1″ builderStep=”1″ value=”150″>150</Param>
<Param key=”#Shift#” name=”Shift” type=”int” defaultValue=”1″ controlType=”jspinnerVar” minValue=”0″ maxValue=”1000″ genMinValue=”-1000001″ genMaxValue=”-1000002″ paramType=”shift” step=”1″ builderStep=”1″>1</Param>
</Item>
</Block>
</Formula>
</Param>
<Param key=”#Symbol#” name=”Symbol” type=”string” defaultValue=”Current” displayOnDefault=”false” controlType=”symbolVar” paramType=”symbol” builderStep=”1″ />
<Param key=”#Direction#” name=”Direction” type=”int” defaultValue=”1″ controlType=”combo” values=”Long=1,Short=-1″ builderStep=”1″>1</Param>
<Param key=”#Size#” name=”Size” type=”double” isFormula=”true” controlType=”Size” required=”true”>
<Formula key=”SQ.Formulas.Size.DefineOwnSize”>
<Param key=”#Value#” name=”Value” type=”double” defaultValue=”0.1″ controlType=”jspinnerVar” minValue=”0.01″ maxValue=”999999999″ step=”1″ builderStep=”1″ />
</Formula>
</Param>
</Item>
17:07:23.290 [Blocking computeThread common #0 – Base_Strategy_14] ERROR SQBacktesterJob – Backtesting strategy ‘Base_Strategy’ failed
17:07:23.291 [Blocking computeThread common #0 – Base_Strategy_14] ERROR c.s.g.c.p.MultithreadComputePerformer – Error while running task: Base_Strategy_14(23d5ad12-3590-4e03-8b62-cb1061ae9a74))
java.lang.NumberFormatException: empty String
at java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1842) ~[na:na]
at java.base/jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110) ~[na:na]
at java.base/java.lang.Double.parseDouble(Double.java:549) ~[na:na]
at com.strategyquant.tradinglib.blocks.ParameterAnnotationParser.parseValue(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.blocks.ParameterAnnotationParser.wizardParsePrimitiveType(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.blocks.ParameterAnnotationParser.wizardParseXml(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.blocks.AnnotationProcessor.wizardParseXml(Unknown Source) ~[SQTradingLib.jar:na]
at SQ.Internal.StandardBlock.parseXml(StandardBlock.java:318) ~[na:na]
at SQ.Internal.StandardBlock.initialize(StandardBlock.java:249) ~[na:na]
at SQ.Internal.ActionBlock.initialize(ActionBlock.java:90) ~[na:na]
at SQ.Internal.StandardBlock.newInstance(StandardBlock.java:90) ~[na:na]
at SQ.Internal.ActionBlock.newInstance(ActionBlock.java:38) ~[na:na]
at com.strategyquant.tradinglib.Blocks.getBlockObject(Unknown Source) ~[SQTradingLib.jar:na]
at SQ.Internal.Rule.parseBlocksInRulePart(Rule.java:222) ~[na:na]
at SQ.Internal.Rule.parseXml(Rule.java:202) ~[na:na]
at SQ.Internal.RulesImpl.IfThen.parseXml(IfThen.java:117) ~[na:na]
at SQ.Internal.Rule.initialize(Rule.java:162) ~[na:na]
at SQ.Internal.Rule.newInstance(Rule.java:129) ~[na:na]
at SQ.Internal.StrategyEvent.parseXml(StrategyEvent.java:107) ~[na:na]
at SQ.Internal.StrategyEvent.<init>(StrategyEvent.java:58) ~[na:na]
at SQ.Internal.XmlStrategy.parseXml(XmlStrategy.java:264) ~[na:na]
at SQ.Internal.XmlStrategy.callOnInit(XmlStrategy.java:160) ~[na:na]
at com.strategyquant.tradinglib.engine.TradingSetup.start(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.engine.BacktestEngine.initializeBacktest(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.engine.BacktestEngine.runBacktest(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.backtestrunner.BacktestRunner.backtestStrategy(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.backtestrunner.BacktestRunner.runBacktestOnMainSetup(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.backtestrunner.BacktestRunner.execute(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.backtestrunner.BacktestRunner.execute(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.backtest.SQBacktesterJob.call(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.tradinglib.backtest.SQBacktesterJob.call(Unknown Source) ~[SQTradingLib.jar:na]
at com.strategyquant.gridlib.compute.performer.MultithreadComputePerformer$1.run(Unknown Source) ~[SQGridLib2.jar:na]
at com.strategyquant.gridlib.concurrent.ThreadPool$TaskExecutor.runCommonExecutor(Unknown Source) ~[SQGridLib2.jar:na]
at com.strategyquant.gridlib.concurrent.ThreadPool$TaskExecutor.run(Unknown Source) ~[SQGridLib2.jar:na]
at java.base/java.lang.Thread.run(Thread.java:832) ~[na:na]
17:07:23.291 [Blocking computeThread common #0] ERROR c.s.tradinglib.backtest.SQBacktester – Backtest failed
[/code]

I seem to understand that something is not good at the moment of the interpretation of the “If then” section. Beyond my error, just described, I would expect the software, before performing the backtest and interpreting the configuration, it warned me if there are non-congruent fields (validation of the parameters).

Then I have a question that by reflecting, I’m not sure I understand. In the webinar, it is set: “In Trading Signal” Lognexitsignal “Always True” this means that the Then section in “Logn Entry” will always be performed. If not already present an order in execution or pending? I am confused here. The Price setting is implemented in then, so I don’t understand until there are open positions, a stop order is performed, and the breaking of the higher level of the 150 candles of the previous ones.

However, having configured it as from the webinar I continue to have the exception of conversion from string to number.

Could you help me if I’m committing an error if it is a bug?

Thanks again,

0

Tomas Matejka

Administrator, sq-ultimate, 2 replies.

Visit profile

3 years ago #281309

Hi Lorenzo,

can you check using the latest build from this link https://strategyquant.com/download/#tab-dev?

The issue should be resolved into that build

0

Lorenzo

Customer, bbp_participant, community, sq-ultimate, 15 replies.

Visit profile

3 years ago #281320

Hello Tomas,

Yes, sure very willingly! I’m going to try it and I’ll let you know ASAP.

Thank you so much.

Lorenzo

0

2nickelstripper

Subscriber, bbp_participant, sq-ultimate, customer, community, 9 replies.

Visit profile

3 years ago #281372

I’m getting the same error.  I tried the most recent version and still the same.  Happens when I put in different types of stop losses and targets.  For example stop loss percentage based or ATR.

0

Lorenzo

Customer, bbp_participant, community, sq-ultimate, 15 replies.

Visit profile

3 years ago #281439

Hi Tomas,

I apologize for my late response. I’m using the SQ Dev3 (Build 137.1542), and the mistake I reported seems to be a resolved issue.

These days, experimenting with Strategy Quant X, I observed other behaviors that seem to be possible bugs. Can I report them in this section of the forum?

Cheers,

Lorenzo

0

Viewing 5 replies - 1 through 5 (of 5 total)