Parsing Error when Call Value from Indicator
Forums › ProRealTime English forum › ProBuilder support › Parsing Error when Call Value from Indicator
- This topic has 10 replies, 6 voices, and was last updated 3 months ago by dsk2293.
-
-
10/05/2023 at 12:42 PM #222060
I have been researching this topic and also tried creating the indicator with parameters but I still get this error when calling the value from the indicator into my code. Now I know the code of the indicator could have been done in the Builder itself but this is just the beginning and I wanted to keep it simple so we can get to the bottom of the problem.
Error: Backtest cant start because of a parsing error in the code : line 1, column 0.
Here is the Pro Builder code.
Call value TradeOk from indicator TurnofMonth1234567891011Tradeok = Call "TurnofMonth"[22,4]// Conditions to enter long positionsIF NOT LongOnMarket AND Tradeok THENBUY 1 CONTRACTS AT MARKETENDIF// Conditions to exit long positionsIf LongOnMarket AND Not Tradeok THENSELL AT MARKETENDIFHere is the indicator code
Tradeok between days leading to month end and just thereafter123456789101112131415Timeframe(Daily)IF Openmonth<>openmonth[1] ThenDayofmonth =1elseDayofmonth= Dayofmonth+1endifTradeok=1If Dayofmonth > End and Dayofmonth<Start ThenTradeok = Tradeok-1elseTradeok = TradeokendifReturn Tradeok as "Tradeok"Thank you
10/05/2023 at 5:12 PM #222065Hi,
Adjust the following in your indicator:
Remove: Timeframe(Daily)
Verander “If Dayofmonth>End OR Dayofmonth<Start then
1 user thanked author for this post.
10/05/2023 at 9:01 PM #222072How dumb of me, thank you.
1 user thanked author for this post.
10/10/2023 at 9:41 AM #222224Just a follow up question why do the Timeframe(Daily) code line also cause an error?
10/10/2023 at 10:04 AM #222226Just a follow up question why do the Timeframe(Daily) code line also cause an error?
So from further testing it looks like the Timeframe command is only to be used in ProBuilder not in ProBackTest or the Indicator module. Please confirm.
10/10/2023 at 2:53 PM #22223608/04/2024 at 2:42 PM #23611908/04/2024 at 5:33 PM #23612008/04/2024 at 6:18 PM #236121I can’t comment for screeners because I don’t use. For indicators this doesn’t seem to be a problem. With back-test and beyond it is.
I don’t know the exact reasons why, but the ‘Parsing Error’ comes up when ‘Timeframe()’ is placed in a ‘Call’ed file.
In example above, ‘ Timeframe(Daily)’ is in the called file. This triggers the parsing error.
Though above solution by @JS removed the need for ‘Timeframe(Daily)’ it indirectly removed the condition triggering the ‘parsing error’.
To use the ‘Timeframe’ instruction and ‘CALL’ files, when this happens, is to put ‘Timeframe()’ in the Main file and call the other file(s) from within the timeframe block.
The other file(s) will be generic and not use ‘Timeframe’.
This is just to avoid this error with back-test, however if you skip back-test and create an Auto trading file, it fails to run because of an ‘internal error’.
When you look at the Auto code, the call files code is represented as a function, and after the main code. Maybe this points to a possible reason why it works one way but not the other. I’m assuming the same process happens when back-test is done. The lack of additional processing of the code values with BT and AT may be the reason why it works with indicators.
08/04/2024 at 7:12 PM #236122Maybe as a supplement….
Of course, parsing errors can arise from different situations, but what I’ve seen in PRT is usually a combination of arrays with certain instructions, for example when you use the “Crosses Over” or “Crosses Under” instruction in combination with values from an array, a “parsing error” follows because the array is not related to the time frame in which these statements are used… (the times cannot be linked)…
One solution could be to use “normal” variables instead of arrays… (if possible)
Because arrays are not related to a time frame, statements such as, $myArray[n][1] also return a parsing error…
As has been pointed out several times on the forum, a “Call” instruction, in combination with an indicator that uses MTF, also results in a passing error…
The current solution is to incorporate the indicator into the system from which the “Call” takes place…
When everything has been tried but has failed, the last option is to send a technical report and have your code checked for, syntax errors, unexpected symbols, incorrectly nested structures, wrong data format, etc.
08/04/2024 at 8:45 PM #236124 -
AuthorPosts
Find exclusive trading pro-tools on