Strategy Parameters keep getting moved
Author: maninjapan
Creation Date: 6/15/2018 4:46 PM
profile picture

maninjapan

#1
I am having an ongoing issue where my Strategy Parameters occasionally from below public class to below the public section. It can happen to any strategy and a strategy will be working fine for a number of Runs and then suddenly stop working. going back to the code I see the Strategy Parameters have moved themselves creating errors in the strategy. Cut and pasting them back to the correct section fixes the problem and the strategy will continue to work for a period of time but will happen again at some time.



Following is a before and after example to show what I mean

BEFORE ( strategy running fine)
CODE:
Please log in to see this code.


AFTER
CODE:
Please log in to see this code.
profile picture

Eugene

#2
I won't believe this happens to a random strategy at random times. You must be occasionally doing something that makes Editor fail at preserving the correct syntax. Like "Apply Changes to Code" or "Assign Preferred Values..." from the Optimizer or "Push all indicators ... into the Strategy code". Could you recall what exactly?

If we succeed with finding the culprit, then to reproduce this issue it would be helpful for me to have an idea about the Strategy structure. Maybe its peculiarity makes Editor fail? Or maybe it's your regional settings? etc. The more information the better. tia.
profile picture

maninjapan

#3
I mean it can happen to any strategy that I have open ( it does not limited to a specific individual or small group of strategies).
Timing of the issue, I find it happens in a number of different instances. Following are a couple examples

- making changes to the code, compiling successfully, saving then running the strategy only to get an error and find the Strategy parameters moved

- saving and closing a strategy, then reopening the strategy to find the Strategy parameters moved

- making changes to the code, compiling successfully, saving then running the strategy once successfully to test, then going to optimization (making no changes to parameter settings) then after running an optmization and returning no results. Going back to the code I find the parameters have moved. ( this pattern happened today)

It may or may not have also occurred with Apply Changes to code, but from memory it usually occurs around saving, closing, opening and running strategies

I used the word random because it does not happen all the time. I can have one of the above issues occur, fix the code and then do the same process where the issue occurred and it will be fine for some time, only to happen again at some later stage ( sometimes 10 minutes later, other times not until next time I use it).

I am using Japanese windows but my Regional settings are set to English / US



Below is a simple strategy that I experienced the issue with today. I actually modified it from an existing strategy in Wealth Lab, ADX Consolidation Breakout

CODE:
Please log in to see this code.

profile picture

Eugene

#4
Thanks, this helps. I think I saw this before, that's why I suggested the Optimizer as the culprit but I think your words have reason: it's about compilation which takes place in many aspects of WL. So I was able to reproduce this very quickly with your code by going to Optimizer and making a couple of edits (unchecking a parameter, changing Step, then "Apply"). Regardless of the context, the problem is that your code is unnecessarily generous with regard to spaces in quite important places:
CODE:
Please log in to see this code.

Not only inserting random spaces makes the code look unpretty, it throws off the compiler. All we have to stick to code conventions. Neither you'd find a programmer formatting code like that nor stumble on this style in WL Editor's templates. This may be a bug in the outdated Editor component - or maybe not. Anyway, once your code adheres to the guidelines the issue will disappear. Just don't insert unnecessary spaces before the opening brace of the class constructor:

CODE:
Please log in to see this code.
profile picture

maninjapan

#5
Thanks Eugene, I will apply these changes immediately and keep an eye on it. Agree my formatting (or complete lack of it ) is not great, I never realized it was more than just a visual thing though and will definitely be more aware of this going forward.

Thanks again
profile picture

Eugene

#6
At your service.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).