Sumber daya yang dimuat... Pemuatan...

Bantu saya untuk melihat masalah penyebaran sinyal silang.

Penulis:Berhenti, Dibuat: 2021-11-04 11:34:33, Diperbarui:

Ada dua parameter ema, ema1 ((A2) dan ema2 ((A3), ketika salah satu pengaturan ema lebih besar dari 100, ema tidak sesuai dengan nilai binan saat fmz berjalan secara real time, yang menyebabkan sinyal buka lebih awal atau ditunda 5-10 root k.

""Backtest Dimulai: 2021-11-01 00:00:00 Akhir: 2021-11-02 00:00:00 Periode: 5m dasarPeriode: 1m Bursa: [{eid:Futures_Binance,currency:BTC_USDT}] args: [[M,8],[A2,100],[A3,200],[K3,500],[K2,300]] "

def accuracy ((): # mendapatkan akurasi dari bursa global BV1, CV1 exchanges[i].SetContractType ((swap button)) currency1=_C ((exchanges[i].GetCurrency) Ticker1=_C (exchanges[i].GetTicker) account1=_C ((exchanges[i].GetAccount) all_BV1list=[ALICE_USDT,DODO_USDT,UNFI_USDT,LITU_USDT,ZEN_USDT,FIL_USDT,AAVE_USDT,KSM_USDT,EGLD_USDT,TRB_USDT,CRV_USDT, BAL_USDT, DOT_USDT, SNX_USDT, WAVES_USDT, RLC_USDT, BAND_USDT, KAVA_USDT, SXP_USDT, OMG_USDT, ZRX_USDT, ALGO_USDT THETA_USDT, QTUM_USDT, BAT_USDT, IOTA_USDT, ONT_USDT, XTZ_USDT, EOS_USDT, XRP_USDT, ICP_USDT, NEO_USDT, ATOM_USDT, BNB_USDT, LINK_USDT, ETC_USDT, BNB_USDT, YFII_USDT, DEFI_USDT, MKR_USDT, COMP_USDT, ZEC_USDT, DASH_USDT, dan lainnya. XMR_USDT, LTC_USDT, BCH_USDT, ETH_USDT, BTC_USDT] list1=[ALICE_USDT,DODO_USDT,UNFI_USDT,LITU_USDT,ZEN_USDT,FIL_USDT,AAVE_USDT,KSM_USDT,EGLD_USDT,TRB_USDT,CRV_USDT, BAL_USDT, DOT_USDT, SNX_USDT, WAVES_USDT, RLC_USDT, BAND_USDT, KAVA_USDT, SXP_USDT, OMG_USDT, ZRX_USDT, ALGO_USDT THETA_USDT, QTUM_USDT, BAT_USDT, IOTA_USDT, ONT_USDT, XTZ_USDT, EOS_USDT, XRP_USDT] list2=[ICP_USDT,NEO_USDT,ATOM_USDT,BNB_USDT,LINK_USDT,ETC_USDT,BNB_USDT] list3=[ YFII_USDT, YFI_USDT, DEFI_USDT, MKR_USDT, COMP_USDT, ZEC_USDT, DASH_USDT, XMR_USDT, LTC_USDT, BCH_USDT, ETH_USDT, BTC_USDT] if currency1 in list1: BV1 = 1 if currency1 in list2: BV1 = 2. if currency1 in list3: BV1 = 3. if currency1 not in all_BV1list: BV1 = 0. # Perhitungan harga yang akurat if currency1! = YFI_USDT : RR1 = str ((ticker1[Last]) content1=RR1.split ((".") [-1] weishu1=len ((content1) CV1 =weishu1 lainnya: CV1 = 0. global n1 account1=_C ((exchange.GetAccount) walletbalance=account1 [Balance] P = 0.01P0float (saldo dompet) n1=round ((P/ticker1[Last],BV1) jika n1==0: n1=n1+10**(-BV1)

Definisi utama: sementara True: global i untuk i dalam rentang (menukar)): pertukaran[i].SetContractType ((swap) Keakuratan pertukaran[i].SetMarginLevel(M) ticker1=_C(exchanges[i].GetTicker) mata uang1=_C(exchanges[i].GetCurrency) posisi1=_C(bertukar[i].GetPosition) r=_C(exchanges[i].GetRecords) jika r dan len®>9: EMA=TA.EMA(r,A2) EMA2=TA.EMA(r,A3) longsignal=EMA[-3]EMA2[-2] shortsignal=EMA[-3]>EMA2[-3] dan EMA[-2]

                    if longsignal: #1分钟金叉
                        Log(currency1,'多头信号成立')
                        exchanges[i].SetDirection('buy')
                        exchanges[i].Buy(-1,n1)
                        Log('倒数第二个EMA2:',EMA2[-2],'倒数第三个EMA2:',EMA2[-3])
                        Log('倒数第二个EMA1:',EMA[-2],'倒数第三个EMA1:',EMA[-3])
                        
                        
                    #开空信号
                    if shortsignal: #1分钟死叉
                        Log(currency1,'空头信号成立')
                        exchanges[i].SetDirection('sell')
                        exchanges[i].Sell(-1,n1)
                        Log('倒数第二个EMA2:',EMA2[-2],'倒数第三个EMA2:',EMA2[-3])
                        Log('倒数第二个EMA1:',EMA[-2],'倒数第三个EMA1:',EMA[-3])
                        
                if len(position1)==1:
                    if position1[0]["Type"]==0:
                        if ticker1["Last"]>position1[0].Price+K3:
                            Log(currency1,'多头触发止盈')
                            exchanges[i].SetDirection('closebuy')
                            exchanges[i].Sell(-1,position1[0].Amount)
                            Log('倒数第二个EMA2:',EMA2[-2],'倒数第三个EMA2:',EMA2[-3])
                            Log('倒数第二个EMA1:',EMA[-2],'倒数第三个EMA1:',EMA[-3])
                            
                        if ticker1["Last"]<position1[0].Price-K2:
                            Log(currency1,'多头触发止损')
                            exchanges[i].SetDirection('closebuy')
                            exchanges[i].Sell(-1,position1[0].Amount)
                            Log('倒数第二个EMA2:',EMA2[-2],'倒数第三个EMA2:',EMA2[-3])
                            Log('倒数第二个EMA1:',EMA[-2],'倒数第三个EMA1:',EMA[-3])
                            
                    if position1[0]["Type"]==1:
                        if ticker1["Last"]<position1[0].Price-K3:
                            Log(currency1,'空头触发止盈')
                            exchanges[i].SetDirection('closesell')
                            exchanges[i].Buy(-1,position1[0].Amount)
                            Log('倒数第二个EMA2:',EMA2[-2],'倒数第三个EMA2:',EMA2[-3])
                            Log('倒数第二个EMA1:',EMA[-2],'倒数第三个EMA1:',EMA[-3])
                            
                        if ticker1["Last"]>position1[0].Price+K2:
                            Log(currency1,'空头触发止损')
                            exchanges[i].SetDirection('closesell')
                            exchanges[i].Buy(-1,position1[0].Amount)
                            Log('倒数第二个EMA2:',EMA2[-2],'倒数第三个EMA2:',EMA2[-3])
                            Log('倒数第二个EMA1:',EMA[-2],'倒数第三个EMA1:',EMA[-3])
                            
        Sleep(S)

Lebih banyak

Penemu Kuantitas - Mimpi KecilDengan menggunakan algoritma EMA, Anda dapat menghitung EMA 100 dengan cara yang sama, tetapi EMA 200 memiliki kesalahan karena EMA 200 membutuhkan lebih banyak kolom (K-line BAR). Konsep dasar seperti ini ada di Baudacity.