Tagging Strategies for SDK 2.0
Contents
Intro
In SDK 2.0 and 2011-III release of the Marketscope the strategy backtester and optimizer are introduced. To work properly under backtester/optimizer requires special tagging.
Always specify the strategy or alert type
Now the strategy dashboard, backtester and optimizer must be able to distinguish strategies and alerts. So, put the type of the strategy into the Init function.
For signals:
function Init()
...
strategy:type(core.Signal);
...
end
for strategies
function Init()
...
strategy:type(core.Strategy);
...
end
or (in case your code can works as an alert as well as a strategy depending on the parameters):
function Init()
...
strategy:type(core.Both);
...
end
Set flag for the "allow trade" parameter
If your code has the boolean parameter which allows/forbids the trading, please:
1) Mark this parameter using core.FLAG_ALLOW_TRADE
2) Check whether true
value of the parameter turns the trading on
function Init()
...
strategy.parameters:addBoolean("CANTRADE", "Allow Trading", "", false);
strategy.parameters:setFlag("CANTRADE", core.FLAG_ALLOW_TRADE);
...
end
Using this flag, the backtester and optimizer will force trading automatically when the strategy runs in the market simulation mode.
Tag the parameters which cannot be optimized
To simplify configuring of the strategy under optimizer, list all the parameters which cannot be optimized in the NonOptimizableParameters tag. The examples of such parameters are the sound file name or email address, in other words - the parameters which does not affect the trading logic.
function Init()
...
strategy:setTag("NonOptimizableParameters", "EMAIL,SENDEMAIL,SOUND,RECURRENTSOUND,PLAY");
...
This Article in Other Languages
Language: | English • español • français • русский • 中文 • 中文(繁體) |
---|