策略源码
JavaScript
var _StopLoss = 0
var _StopWin = 0
var _Grid = []
function UpdateGrid(nowBidsPrice, nowAsksPrice, direction){ // up 1, down -1
if(_Grid.length == 0 || (direction == 1 && nowBidsPrice - _Grid[_Grid.length - 1].price > _GridPointDis) ||
(direction == -1 && _Grid[_Grid.length - 1].price - nowAsksPrice > _GridPointDis)){
var nowPrice = direction == 1 ? nowBidsPrice : nowAsksPrice
_Grid.push({
price: _Grid.length == 0 ? nowPrice : _Grid[_Grid.length - 1].price + _GridPointDis * direction,
hold : {price: 0, amount: 0}, 策略参数
相关策略
评论
全部评论 (7)
提问:期货软件平仓时,得选择某个开仓,平掉该仓。我看代码里在平仓的时候,操作和开仓一样的,只是新开了一个和之前相反的仓位。所以就比较纠结,希望小梦老大有时间了解答下:)
8 年前
- 1
