The resource loading... loading...

How to use code to fine-tune the filter feedback system to set the filter by default

Author: Inventors quantify - small dreams, Created: 2017-05-05 19:03:55, Updated: 2020-03-30 13:51:24

How to use code to fine-tune the filter feedback system to set the filter by default

Some of the content has been modified, see the latest API documentation.

In parameter testing of the policy, repeating at different time intervals, repeating objects of multiple parameters, etc., the repeating policy is reset the next time because the parameters need to be repeatedly adjusted, and cannot be recorded.

  • 1, when not using the function

    img

    As you can see, this is a test strategy, the code is as follows:

    function main(){
        while(true){
            LogStatus("测试默认参数!");
            Sleep();
        }
    }
    

    The following are the strategic parameters:

    img

    At this time, the parameters in the query query interface are the default settings as shown in the figure below.

    img

  • 2, use code, adjust the default setting for retesting

    • The system parameters are:
      /*backtest
        start: 2017-03-01        
        end: 2017-03-02           
        period: 15                
        mode: 1                 
      */
      

      img

      Please note:

      • period: 15 15 refers to 15 minutes, the platform supports periods of 1 minute, 5 minutes, 15 minutes, 30 minutes, 1 hour, 1 day So what's 1 hour? 1 hour is equal to 60 minutes.period : 60I'm not going to lie to you. So what does 1 day look like? 1 day is equal to 24 times 60 minutes.period : 1440I'm not going to lie.

      • mode: 1 mode refers to the mode of retesting, supported by the retesting system模拟级别回测实盘级别回测^ Here 1 represents the index of the drop-down box, 0 is the index of the drop-down box.模拟级别回测, 1 is实盘级别回测

    • The policy parameter part of the retest:
      /*defaults
        number : 0
        bool: false
        string: Hello BotVS!
        comboBox : 2
      */
      

      img

      Please note:

      • comboBox : 2 This 2 refers to the index of the drop-down box, the index of the first option in the drop-down box is 0, the index of the second option is 1, and the index of the third option is 2.
      • Encrypt string The type parameter and the type of string are the same operation settings.
    • Full test code

Javascript

/*backtest
  start: 2017-03-01        
  end: 2017-03-02           
  period: 15              
  mode: 1                 
*/

/*defaults
  number : 0
  bool: false
  string: Hello BotVS!
  comboBox : 2
*/

function main(){
    while(true){
        LogStatus("测试默认参数!");
        Sleep();
    }
}

Python

'''
/*backtest
  start: 2017-03-01        
  end: 2017-03-02           
  period: 15              
  mode: 1                 
*/

/*defaults
  number : 0
  bool: false
  string: Hello BotVS!
  comboBox : 2
*/
'''
def main():
  Log("OK")  

Refresh it, and then see if the page has changed from the previous one. Note: The default parameter setting for code modifications takes effect when you first enter the page, midway modifications do not take effect, and refresh after saving takes effect.

img

You can see that both the default parameter array of the query retrieval system and the default parameter array of the query policy have been modified accordingly based on the code. Save the desired settings, no more point-to-point to set the retrieval parameters.

  • Use the MATE button to insert the parameters of the page setting in the policy code in the form of code:

    img

    This way, the default retrieval parameters are not written by hand when they are first set in code, and can be set on the retrieval page and inserted directly into the code.

  • The test policy address:

    img

    https://www.fmz.com/strategy/40155

Note: Change args to the default

  • 2017.12.17 Optimization of META (formerly known as META)

    img

    For example: When you have set the retest option (e.g. time, exchange, K-line cycle, etc.) You can click the Save Reset Settings button on the Policy Edit page to save the reset configuration in code form in the policy, and the next reset will be in this code.

    img

    Code is automatically added to the beginning of the edit area and saved as an annotation.

    img

    This way, you can save it manually, so you don't have to reconfigure the information next time.

    If the rate setting of the exchange object is adjusted:

    img

    Then save the retest settings and you can see that a rate setting appears in the retested settings.

    # 注意: 尽量不要手动修改 或者 设置 回测设置 (即 backtest 段代码) 代码。
    

More

kaizi1231Is it possible to generate this configuration information that can be called directly into the strategy?

hokshelato`mode: 1` seems to be invalid, and the interface always shows **analogue-level Tick**.

edwardgywNice work! is it that you add the exchange and set the buy and sell transaction fees together and give the code, you have to adjust these numbers every time

The AquariusIf you can set the balance and the balance, it's better.

Inventors quantify - small dreamsThe rate can be set directly in the policy interface.

kaizi1231Is there a way to get the rate parameter set by the retesting platform in the strategy?

Inventors quantify - small dreamsThis doesn't work, it's just code for parameters that are configured for the retest system.

Inventors quantify - small dreamsOkay, so this is the comment code itself, and it's possible that re-commenting it will cause a parsing error.

hokshelatoThis is not a refresh problem, it's because I added a comment after the sentence that BotVS can't solve correctly. You know what? /* backtest mode: 1 // tick at the disk level */ What's up? With an annotation, `mode` is always set to **0** ((analogue level)).

Inventors quantify - small dreamsHey, you said these can't be set in the code.

Inventors quantify - small dreamsIf you have a problem with this, you can try it.

hokshelatoI also asked if the current ** balance **, ** surplus **, ** buy **, ** sell ** can be set in backtest.

ZeroYou can save the configuration of the fee.

J +1

edwardgywIt's simple, set a button to save the current setting as the default setting. Once you've done that, you can generate the code yourself, insert it, or record it in the background. It's easier than it is now.

Inventors quantify - small dreamsThis is because some things are complicated and are still in the design phase, so it's up to you to decide which design is most reasonable, convenient, and efficient.

Inventors quantify - small dreamsThanks for the suggestion, this one needs to be set up too, I have documented the report Z major.