LUA and FXCM shortcomings

Recently I have discovered a couple of shortcomings that I would like to share with you, interestingly both related to including code/resources.

1) Support to include custom common code

LUA Strategies come with a file called helper.lua and helperAlert.lua that provide common helpful code. They are commonly included across many strategies and indeed are very useful. Including common code is one of the best practices in software development, and as a developer myself, I tried to create my own common include files to include across my own strategies but it seems this is not supported well.

While this is easy enough to create in development, the problems come when it comes to deployment and testing
– The Lua Strategy Debugger’s app_path points to the GehtSoft folder, not where the code is, so it fails to find the include file.
– Similarly, FXCM Trading Station failed to import the strategy as it complains it cannot find the include file.
– Compiling the strategy does not embed the included code in the .bin file, and produces the same problem as above.
– FXCM Trading Station will not let me import the helper standalone as it is not a strategy and does not have an init method
– I have tried changing the path such that it doesn’t depend on the app_path but attempts to point at the local directory like “.\customInclude.lua” or “customInclude.lua” etc.

I even tried sneaking extra methods into the standard helperAlert code, but this gets overwritten with each FXCM Trading Station update, breaking all my strategies (and unfortunately you don’t know until it tries to execute that code which might be when it tries to trade!)

At the moment, the only way that works is if I manually copy the file to the expected locations for the debugger and FXCM Trading Station, but this is far from ideal for deployment purposes.

This has been posted on the DailyFX Forum and it has been confirmed that it is not supported. A suggestion has been made to the developers so they can enhance it accordingly. Let’s hope it comes through. In the mean time, I guess we need to stick to old-fashioned copy and paste.

2) Including the common.lua.rc file

Indicators and Strategies usually include a common.lua.rc resource file. This is used for multi-language localization support mostly. This file is distributed with FXCM Trading Station and Lua’s standard indicators/strategies. However, FXCM Trading Station has a different directory structure compared to Lua’s standard deployment.

FXCM chose to store non-custom code under a Standard folder, and custom code under a Custom folder so this means in Trading Station, the common.lua.rc file is available in the CandleworksFXTS2indicatorsStandard folder while Trading Station stores Custom Indicators/Strategies under a different folder, for example – CandleworksFXTS2indicatorsCustom, and the file is missing from there.

This means that when FXCM Trading Station imports custom code that rely on this common file being there, it isn’t! Given this is a standard file, I asked FXCM how other developers have handled this and they recommended that fevelopers change their code to try to use a relational path like ..Standardcommon.lua.rc … I have tested this and it appears to work.

So, I’ll slowly be restructuring my development environment and source control to match, and of course the Live environment. So something for you guys to keep in mind too if you have been playing with your own code.

Posted in FXCM, Indicators, Lua, Strategies, Trading Station and tagged , , , , , .

Leave a Reply

Your email address will not be published. Required fields are marked *