Release of SQX 139 Dev 1 and what’s planned for year 2024
We’d like to announce the release of the new SX 139 Dev 1 version – note that this is a development version for testing, not the final 139 version. Most …
Přejít k obsahu | Přejít k hlavnímu menu | Přejít k vyhledávání
In the previous article (link) I explained how StrategyQuant templating system works and how you can define strategy logic using template. In this article I will continue with practical example directly in StrategyQuant.
How to generate strategies using a template? You can choose which template will be used in Builder/Full Settings/What to build tab. The third option is “Strategy from template”. Let’s choose example template SQ4StrategyTemplateExample.sq4 from folder C:\StrategyQuant X\user\settings\StrategyTemplates
Using templates for generating strategies in StrategyQuant
Now let’s move into AlgoWizard module and load above mentioned template SQ4StrategyTemplateExample.sq4 from folder C:\StrategyQuant X\user\settings\StrategyTemplates
Loading template into AlgoWizard for further editing
On the image below, you can see template loaded in StrategyQuant. It consists of several tabs.
The number of tabs is optional. You can define one or even ten tabs depending on the complexity of the strategy and your preferences. Red markers indicate parts in the template where building blocks or values will be used.
The template can consist of multiple tabs
The section marked with orange frame defines conditions part.
Now let’s focus on the “Long entry” tab and describe its parts. The first section marked with the orange frame is “If conditions”. Here you define which conditions must be met to perform the action. On the image above, you can see that conditions defined on the “Trading signals” tab are being used. However, you can add as many conditions you want, according to your preferences (will be discussed later in an example).
The section marked with the orange frame define actions part.
This part of the template defines what will happen if all conditions are met. You can find it on the image above marked with the orange frame. For now, let me skip the details. You just need to know that this will simply open a trade.
Finally, let me show you how to add your first condition to the example template. Click on the “Add another condition” button.
Select comparison “Is greater”
Now click on the #Left# and choose Close[1], then click on #Right” and select MovingAverage(200)
The new condition has been added
You can save the template as a new file
Saving template
Selecting the template for generating strategies
Now you can start generating strategies using your modified template.
As you can see, using templating system opens almost unlimited possibilities for generating strategies. Many of you have been asking me how to preset StrategyQuant for creating strategies for Gaps , Pullbacks,.. etc. Now you can do it easily by yourself.
Thank you for your attention and I wish you a lot of success with the realization of your trading ideas.
We’d like to announce the release of the new SX 139 Dev 1 version – note that this is a development version for testing, not the final 139 version. Most …
Dive into Algorithmic Trading Without the Coding Headache! Are you intrigued by algorithmic trading but dread the thought of coding? Today marks the beginning of our exciting series that’s about …
In this interview, we catch up with Naoufel, a seasoned trader, to explore his journey through the stormy market of 2023. Naoufel is successful trader with verfied track record who …
Great article.
Is it possible to reference a second data source in the templates above? I am looking into intermarket analysis and an example would be the ES and the NQ. If the ES is leading (and NQ therefore lagging) and the NQ diverge, trade the NQ with the assumption the divergence is temporary and it will follow the ES again eventually.
you can use multiple charts (symbols or TFs) for your randomly generated blocks, but right now it is not possible to choose that random block 1 will use chart 1 and random block 2 will use chart 2.
But we are working on it, templates functionality will be greatly enhanced in the new build 127.
This is very helpful, would it be possible to have more examples :
For example, closing 50% position at target price and breakeven stop
Then closing on random condition the other 50%
Another template, would be to take a second position on the first stop and close
Both position on profit or second stop loss.
Another, possibility, would be to take an hedge position instead of a stop loss
Another template would be multiplier position,
a sideway strategy template would be a good test as well
Partial closing is not possible now. Better open 2 orders with 50% size and set different targets for each
Thank you tomas for your answer, I will use 2 orders 🙂
where is this strategytemplate folder ? i didn’t find these example
It would be helpful to have example of ‘action’, ‘if then’, tab as well.
How do you declare variable ?
Can they work in a template in SQX ?
Thank you for this instructive article ?
The folder is reported in the article 😉 Anyway, it is C:\StrategyQuant X\user\settings\StrategyTemplates
You can create a new variable in the “other properties” menu on the top right of the streen 😉
I dont’ understand file extensions. Templates are .sq4 files, but strategies are saved as .sqx files. Which is the difference between .sq4 and .sqx file?
Another question: is it possible to create a strategy template in java? I mean, create a .sqx file from scratch.
Are there any news regarding these questions?
Now only SQX files are of valid extension for strategy files
Thank you tomas262. Is it possible to create a strategy / strategy template in java? I mean, create a .sqx file from scratch without AlgoWizard?