这是我进入澳门之后的第一个简单策略,当时我花了10分钟写出了它,它是一个加仓间隔非常小的马丁变种,通过定投和逐步拉大加仓间隔来控制爆仓的风险,盈亏比比传统马丁好不少。
在三四月份的大牛市中,这个马丁表现非常不错,巅峰时期用小资金跑一天一倍,当时四天用12u跑CHR到了48u。
然而时过境迁,大牛市早已不在,这个马丁用于今天的市场不免会让使用者成为短信接收员,因此我把它分享了出来。
其实实盘还有一些可以跑的价值,但是需要人工择时,现在再也不是那种马丁一开坐着数钱的行情了。
'''backtest start: 2021-05-01 00:00:00 end: 2021-05-14 00:00:00 period: 1m basePeriod: 1m exchanges: [{"eid":"Futures_Binance","currency":"EOS_USDT","balance":1000}] args: [["zuokong",true],["n",3],["E",0.02]] ''' def main(): while True: exchange.SetContractType("swap") exchange.SetMarginLevel(MarginLevel) ticker = _C(exchange.GetTicker) account = _C(exchange.GetAccount) position = _C(exchange.GetPosition) if zuoduo: if len(position) == 0: exchange.SetDirection("buy") exchange.Buy(-1, k, "开多") if len(position) > 0: if position[0].Type==0: if position[0].Price+Q<ticker["Last"]: exchange.SetDirection("closebuy") exchange.Sell(-1, position[0].Amount) account = exchange.GetAccount() LogProfit(account["Balance"]) fx=(E/n)*position[0].Amount if position[0].Profit<position[0].Margin * -fx : #轮询加仓 exchange.SetDirection("buy") exchange.Buy(-1, k) LogProfit(account["Balance"]) if zuokong: if len(position) == 0: exchange.SetDirection("sell") exchange.Sell(-1, k, "开空") if len(position) > 0: if position[0].Type == 1 : fp=Q*position[0].Amount if position[0].Profit > 0.01*fp*ticker["Last"] : exchange.SetDirection("closesell") exchange.Buy(-1, position[0].Amount) account = exchange.GetAccount() LogProfit(account["Balance"]) fx=(E/n)*position[0].Amount if position[0].Profit<position[0].Margin * -fx : #轮询加仓 exchange.SetDirection("sell") exchange.Sell(-1, n) LogProfit(account["Balance"]) Sleep(3000)
Dreams are worth eight figures.Why can't it run both ways?
Treasures from HeavenI can't use~~
cjjklwx/upload/asset/25b56df4d22feadcf17e3.jpg Thank you very much Author This is a joke
Pen OneHow many, pull me. Boss.
caixb1233This is a market price item, can you change it to a limited price item?
The RootsThis can't run in both directions? position[0], this place is dead.
shanzhuFx = ((E/n) * position [0].Amount If position [0].Profit < position [0].Margin * - fx: What do you mean by that?
The baby dinosaurYour API is not working.
The baby dinosaur vx:15001733415
The baby dinosaurYou can sign up for the group rental version (doge)
caixb1233Unfortunately I won't.
The baby dinosaurIf you can, do it yourself, dog.
The baby dinosaurYes, I didn't realize it at first, but then I changed my mind.
The baby dinosaurConstruct a leverage interval function, where fx is the leverage interval, and ((E/n) is the number of positions held, and each position will increase the leverage interval linearly as the position increases.