Skip to content

Latest commit

 

History

History
70 lines (51 loc) · 1.58 KB

固定间距批量挂单插件.md

File metadata and controls

70 lines (51 loc) · 1.58 KB

Name

固定间距批量挂单插件

Author

小草

Strategy Description

会按固定间隔摆出挂单,可用于期货开仓平仓 插件可以在交易终端一键启动,不收取费用,方便手动交易。详细介绍:https://www.fmz.com/digest-topic/5051

Strategy Arguments

Argument Default Description
Type 0 下单类型: 买单
Start_Price 7000 开始价格
Spread 5 间隔
N 5 挂单个数
Amount 0.1 每单挂单量
Amount_Step false 挂单递增量

Source (javascript)

function main() {
    var ticker = exchange.GetTicker()
    if(!ticker){
        return  'Unable to get price'
    }
    for(var i=0;i<N;i++){
        if(Type == 0){
            if(exchange.GetName().startsWith('Futures')){
                exchange.SetDirection('buy')
            }
            exchange.Buy(Start_Price-i*Spread,Amount+i*Amount_Step)
        }else if(Type == 1){
            if(exchange.GetName().startsWith('Futures')){
                exchange.SetDirection('sell')
            }
            exchange.Sell(Start_Price+i*Spread,Amount+i*Amount_Step)
        }else if(Type == 2){
            exchange.SetDirection('closesell')
            exchange.Buy(Start_Price-i*Spread,Amount+i*Amount_Step)
        }
        else if(Type == 3){
            exchange.SetDirection('closebuy')
            
            exchange.Sell(Start_Price+i*Spread,Amount+i*Amount_Step)
        }
        Sleep(500)
    }
    return 'order complete'
}

Detail

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

Last Modified

2020-04-02 11:26:19