Type/to search
1
Follow
4
Followers
Sobre a relação entre exchange.SetDirection e exchange.Buy exchange.Sell em futuros
FAQ
Created 2018-12-31 21:54:33  
 10
 2165

Como um amendoim em crescimento, estou confuso com a combinação de direção de escolha e instruções de compra e venda na plataforma de negociação de futuros.

O primeiro a escolher a direção de negociação é o exchange.SetDirection ((buy/sell/closebuy/closesell), com quatro tipos de moeda
Em seguida, chame a função exchange.Buy/Sell () para fazer a compra da barra de negociação.

Uma vez enredado em uma combinação das seguintes situações:
A tendência de compra e venda
"Buy" e "sell" na direção
Buy e sell em direção a closebuy
A compreensão de que os padrões de compra e venda sob a direção de closesell, respectivamente, foram testados manualmente com um método mais fechado, mostrou que os padrões de compra e venda sob a direção de closesell são mais fáceis de entender.
A minha conclusão é a seguinte:
Conclusão 1: Se a tendência atual é comprar ou vender, abrir uma posição é comprar e abrir uma posição é vender.
Conclusão 2: Seja em direção a closebuy ou closesell, a maioria é sell, e a maioria é buy.

Para menores, veja os códigos de cozinha testados:

/*backtest
start: 2018-12-01 00:00:00
end: 2018-12-31 00:00:00
period: 1h
exchanges: [{"eid":"Futures_OKCoin","currency":"BTC_USD"}]
*/

function main() {
exchange.SetContractType("quarter")
exchange.SetMarginLevel(10)
exchange.SetDirection("sell")
var buy1 =exchange.GetTicker()
Log(buy1.Sell)
exchange.Sell(3500,500)
Log(exchange.GetAccount());
Log(exchange.GetPosition());
exchange.SetDirection("closebuy")
exchange.Buy(4000,500)
Log(exchange.GetAccount());
Log(exchange.GetPosition());

}

//buy sell
// [{"Price":3934.21,"Amount":500,"FrozenAmount":0,"Profit":-0.00003230381575061599,"Margin":1.27090318,"MarginLevel":10,"Type":1,"ContractType":"quarter"}]
// {"Balance":0,"FrozenBalance":0,"Stocks":98.72528411046,"FrozenStocks":0}

//buy buy
// [{"Price":3934.23,"Amount":500,"FrozenAmount":0,"Profit":-0.00003230365153283115,"Margin":1.27089671,"MarginLevel":10,"Type":0,"ContractType":"quarter"}]
// {"Balance":0,"FrozenBalance":0,"Stocks":98.725290599843,"FrozenStocks":0}

//sell sell
//[{"Price":3934.21,"Amount":500,"FrozenAmount":0,"Profit":-0.00003230381575061599,"Margin":1.27090318,"MarginLevel":10,"Type":1,"ContractType":"quarter"}]
//{"Balance":0,"FrozenBalance":0,"Stocks":98.72528411046,"FrozenStocks":0}

//sell buy
//[{"Price":3934.23,"Amount":500,"FrozenAmount":0,"Profit":-0.00003230365153283115,"Margin":1.27089671,"MarginLevel":10,"Type":0,"ContractType":"quarter"}]
//{"Balance":0,"FrozenBalance":0,"Stocks":98.725290599843,"FrozenStocks":0}

//---------------------------------------------------------------------------
//buy buy
//[{"Price":3934.23,"Amount":500,"FrozenAmount":0,"Profit":-0.00003230365153283115,"Margin":1.27089671,"MarginLevel":10,"Type":0,"ContractType":"quarter"}]
// {"Balance":0,"FrozenBalance":0,"Stocks":1.725290599843,"FrozenStocks":0}
//sell buy
//[{"Price":3934.23,"Amount":500,"FrozenAmount":0,"Profit":-0.00003230365153283115,"Margin":1.27089671,"MarginLevel":10,"Type":0,"ContractType":"quarter"}]
//{"Balance":0,"FrozenBalance":0,"Stocks":1.725290599843,"FrozenStocks":0}

//buy sell
//[{"Price":3934.21,"Amount":500,"FrozenAmount":0,"Profit":-0.00003230381575061599,"Margin":1.27090318,"MarginLevel":10,"Type":1,"ContractType":"quarter"}]
// {"Balance":0,"FrozenBalance":0,"Stocks":1.72528411046,"FrozenStocks":0}
//sell sell
//[{"Price":3934.21,"Amount":500,"FrozenAmount":0,"Profit":-0.00003230381575061599,"Margin":1.27090318,"MarginLevel":10,"Type":1,"ContractType":"quarter"}]
// {"Balance":0,"FrozenBalance":0,"Stocks":1.72528411046,"FrozenStocks":0}
Conclusão: Seja a direção atual buy ou sell, abrir uma posição é buy, abrir uma posição é sell

  • A posse atual.
    //--------------------------------------------
    //closebuy buy
    //invalid position
    //closebuy sell
    //[]
    //{"Balance":0,"FrozenBalance":0,"Stocks":2.992310000303,"FrozenStocks":0}

//closesell buy
//invalid position
//closesell sell
//[]
//{"Balance":0,"FrozenBalance":0,"Stocks":2.992310000303,"FrozenStocks":0}
//--------------------------------------------
Conclusão: Seja em closebuy ou closesell, a maioria é sell

// Posições em aberto
//--------------------------------------------
//closesell sell
//invalid position
//closesell buy
//[]
//{"Balance":0,"FrozenBalance":0,"Stocks":2.992310000303,"FrozenStocks":0}

//closebuy sell
//invalid position
//closebuy buy
//[]
//{"Balance":0,"FrozenBalance":0,"Stocks":2.992310000303,"FrozenStocks":0}
Conclusão: Seja em closebuy ou closesell, a maioria é buy.

Related Recommendations
Comment
All comments (10)
    下单函数设置方向备注
    exchange.Buy开多仓: exchange.SetDirection("buy") 、 平空仓: exchange.SetDirection("closesell")都是买入,但是一个是开仓 一个是平仓。
    exchange.Sell开空仓: exchange.SetDirection("sell") 、 平多仓:exchange.SetDirection("closebuy")数字货币期货是四个方向,商品期货还有对于今仓的处理。
    7 years ago

    我现在也是这个疑惑,这四个方向是在什么情况下产生作用的? 我设置之后 只用buy sell 不管是平多仓平空仓还是开多仓开空仓全都实现了,那closebuy 跟closesell 不是没有用了吗????

    7 years ago

    那是 BITMEX 吧, BITMEX 永续合约 类似 现货的概念,只有买卖 ,如果是其他 交易所 期货 比如 OKEX 的 你就必须用 平多仓 平空仓 才能平仓了。

    7 years ago

    明白了!

    7 years ago

    这是哪个平台?我试试回测

    7 years ago

    okex 期货模拟回测

    7 years ago

    你现在是如何理解这四个按钮的?

    7 years ago

    exchange.SetDirection 在数字货币期货设置 四个方向 closesell sell 对应 exchange.Sell, closebuy buy 对应 exchange.Buy。<<<<<<官方解释

    7 years ago

    我目前也有这个疑惑,用sell buy全都实现开仓平仓 那close不是没用了吗

    7 years ago

    :)

    7 years ago
  • 1
iPhone Download
Forums
PINE Language
© 2015 - ∞ INVENTOR PTE LTD (SG)