资源加载中... loading...

Export function of template library

The export function is an interface function of template library, and it can be called by the strategy that refers to template library.

/*
-- After the strategy references the template, call this method directly with $.Test()
-- The main function is not triggered in the strategy, it is only the entry point for template debugging
*/
$.Test = function() {
    Log('Test')
}

function main() {
    $.Test()
}
def Test():
    Log("template call")

# Export the Test function, the main strategy can be called via ext.Test().
ext.Test = Test 
// After the strategy references the template, call this method directly with ext::Test()
void Test() {
    Log("template call");
}

The template library is written in a different format for different programming languages. An example code for exporting functions to be declared in the template library and implemented is as follows: The Blockly Visualization approach to strategy usage library functionality can be implemented by writing a template class library in the JavaScript language, written using the following writing format.

/*blockly
    {
        "type": "ext_testA",
        "message0": "testA|testA",
        "template": "function(){return 99;}()",
        "order": "ORDER_ATOMIC",
        "output": "Number"
    },{
        "type": "ext_MA",
        "message0": "MA 周期 %1| MA Period %1",
        "args0": [{
            "type": "input_value",
            "check": "Number"
        }],
        "template": "(function(){var r = exchange.GetRecords(); return (!r || r.length < %1) ? false : TA.MA(r, %1); })()",
        "order": "ORDER_ATOMIC",
        "output": null,
        "colour": 85
    }
*/
Strategy Framework and API Functions Template Library Parameters