-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathCTIBS.py
1365 lines (1225 loc) · 70.6 KB
/
CTIBS.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import logging
import numpy as np
import pandas as pd
from technical import qtpylib
from pandas import DataFrame
from datetime import datetime, timezone
from typing import Optional
from functools import reduce
import talib.abstract as ta
import pandas_ta as pta
from freqtrade.strategy import (BooleanParameter, CategoricalParameter, DecimalParameter,
IStrategy, IntParameter, RealParameter, merge_informative_pair)
import freqtrade.vendor.qtpylib.indicators as qtpylib
from freqtrade.persistence import Trade
from technical import qtpylib, pivots_points
class CTIBS(IStrategy):
stoploss = -0.20
timeframe ='15m'
use_custom_stoploss = True
trailing_stop = True
ignore_roi_if_entry_signal = True
use_exit_signal = True
minimal_roi = {
"0": 0.10
}
# DCA settings
exit_profit_only = True
position_adjustment_enable = True
max_entry_position_adjustment = 0
max_dca_multiplier = 1
## Optional order time in force.
order_time_in_force = {
'buy': 'gtc',
'sell': 'ioc'
}
# Number of candles the strategy requires before producing valid signals
startup_candle_count: int = 100
### ------------------ HYPER-OPT PARAMETERS ----------------------- ###
### protections ####
# CooldownPeriod
cooldown_lookback = IntParameter(0, 48, default=5, space="protection", optimize=True)
# StoplossGuard
use_stop_protection = BooleanParameter(default=True, space="protection", optimize=True)
stop_duration = IntParameter(12, 200, default=5, space="protection", optimize=True)
stop_protection_only_per_pair = BooleanParameter(default=False, space="protection", optimize=True)
stop_protection_only_per_side = BooleanParameter(default=False, space="protection", optimize=True)
stop_protection_trade_limit = IntParameter(1, 10, default=4, space="protection", optimize=True)
stop_protection_required_profit = DecimalParameter(-1.0, 3.0, default=0.0, space="protection", optimize=True)
# LowProfitPairs
use_lowprofit_protection = BooleanParameter(default=True, space="protection", optimize=True)
lowprofit_protection_lookback = IntParameter(1, 10, default=6, space="protection", optimize=True)
lowprofit_trade_limit = IntParameter(1, 10, default=4, space="protection", optimize=True)
lowprofit_stop_duration = IntParameter(1, 100, default=60, space="protection", optimize=True)
lowprofit_required_profit = DecimalParameter(-1.0, 3.0, default=0.0, space="protection", optimize=True)
lowprofit_only_per_pair = BooleanParameter(default=False, space="protection", optimize=True)
# MaxDrawdown
use_maxdrawdown_protection = BooleanParameter(default=True, space="protection", optimize=True)
maxdrawdown_protection_lookback = IntParameter(1, 10, default=6, space="protection", optimize=True)
maxdrawdown_trade_limit = IntParameter(1, 20, default=10, space="protection", optimize=True)
maxdrawdown_stop_duration = IntParameter(1, 100, default=6, space="protection", optimize=True)
maxdrawdown_allowed_drawdown = DecimalParameter(0.01, 0.10, default=0.0, space="protection", optimize=True)
### DCA ###
# max_epa = CategoricalParameter([0, 1, 2, 3], default=0, space="buy", optimize=True)
### trailing stop loss optimiziation ###
tsl_target5 = DecimalParameter(low=0.2, high=0.4, decimals=1, default=0.3, space='sell', optimize=True, load=True)
ts5 = DecimalParameter(low=0.04, high=0.06, default=0.05, decimals=2,space='sell', optimize=True, load=True)
tsl_target4 = DecimalParameter(low=0.15, high=0.2, default=0.2, decimals=2, space='sell', optimize=True, load=True)
ts4 = DecimalParameter(low=0.03, high=0.05, default=0.045, decimals=2, space='sell', optimize=True, load=True)
tsl_target3 = DecimalParameter(low=0.10, high=0.15, default=0.15, decimals=2, space='sell', optimize=True, load=True)
ts3 = DecimalParameter(low=0.025, high=0.04, default=0.035, decimals=3, space='sell', optimize=True, load=True)
tsl_target2 = DecimalParameter(low=0.08, high=0.10, default=0.1, decimals=3, space='sell', optimize=True, load=True)
ts2 = DecimalParameter(low=0.015, high=0.03, default=0.02, decimals=3, space='sell', optimize=True, load=True)
tsl_target1 = DecimalParameter(low=0.05, high=0.08, default=0.06, decimals=3, space='sell', optimize=True, load=True)
ts1 = DecimalParameter(low=0.01, high=0.016, default=0.013, decimals=3, space='sell', optimize=True, load=True)
tsl_target0 = DecimalParameter(low=0.02, high=0.045, default=0.03, decimals=3, space='sell', optimize=True, load=True)
ts0 = DecimalParameter(low=0.008, high=0.015, default=0.013, decimals=3, space='sell', optimize=True, load=True)
### indicators ###
#buy
reference_ma_length = IntParameter(185, 195, default=200, space="buy" ,optimize=True)
smoothing_length = IntParameter(15, 30, default=30, space="buy", optimize=True)
buy_offset1 = DecimalParameter(low=0.97, high=0.99, decimals=2, default=0.98, space='buy', optimize=True, load=True)
buy_offset2 = DecimalParameter(low=0.92, high=0.97, decimals=2, default=0.96, space='buy', optimize=True, load=True)
buy_change = DecimalParameter(1.2, 2.0, default=1.5, decimals=1, space="buy", optimize=True)
sell_change = DecimalParameter(1.2, 2.0, default=1.5, decimals=1, space="sell", optimize=True)
max_length = CategoricalParameter([24, 48, 72, 96, 144, 192, 240], default=48, space="buy")
# selling
filterlength = IntParameter(low=30, high=40, default=35, space='sell', optimize=True)
sell_offset1 = DecimalParameter(low=1.01, high=1.05, decimals=2, default=1.03, space='sell', optimize=True, load=True)
sell_change = DecimalParameter(1.2, 2.0, default=1.5, decimals=1, space="sell", optimize=True)
### buying values ###
buy_change = DecimalParameter(1.2, 2.0, default=1.5, decimals=1, space="buy", optimize=True)
### selling values ###
sell_slope = DecimalParameter(-0.05, 0.10, default=0.04, decimals=2, space="sell", optimize=True)
### I.B.S. ###
# Reference Ma - Long Term Direction
ref_bull = DecimalParameter(0.075, 0.125, default=0.010, decimals=3, space="buy", optimize=True)
ref_up = DecimalParameter(0.01, 0.075, default=0.01, decimals=3, space="buy", optimize=True)
ref_down = DecimalParameter(-0.075, -0.01, default=-0.01, decimals=3, space="buy", optimize=True)
ref_bear = DecimalParameter(-0.125, -0.075, default=-0.1, decimals=3, space="buy", optimize=True)
# Smooth Change Ma - Short Term Direction
smooth_bull = DecimalParameter(0.075, 0.125, default=0.010, decimals=3, space="buy", optimize=True)
smooth_up = DecimalParameter(0.01, 0.075, default=0.02, decimals=3, space="buy", optimize=True)
smooth_down = DecimalParameter(-0.075, -0.01, default=-0.02, decimals=3, space="buy", optimize=True)
smooth_bear = DecimalParameter(-0.125, -0.075, default=-0.1, decimals=3, space="buy", optimize=True)
# Distance from Long Term High
from_bull = DecimalParameter(-5, -1, default=-1, decimals=1, space="buy", optimize=True)
from_up = DecimalParameter(-5, -2, default=-3.5, decimals=1, space="buy", optimize=True)
from_ranging = DecimalParameter(-6.5, -2, default=-6.5, decimals=1, space="buy", optimize=True)
from_down = DecimalParameter(-7.5, -5.0, default=-7.5, decimals=1, space="buy", optimize=True)
from_bear = DecimalParameter(-12.5, -7.5, default=-10.0, decimals=1, space="buy", optimize=True)
# Selecting what works
buy01 = CategoricalParameter([True, False], default=True, space="buy")
buy02 = CategoricalParameter([True, False], default=True, space="buy")
buy03 = CategoricalParameter([True, False], default=True, space="buy")
buy04 = CategoricalParameter([True, False], default=True, space="buy")
buy05 = CategoricalParameter([True, False], default=True, space="buy")
buy06 = CategoricalParameter([True, False], default=True, space="buy")
buy07 = CategoricalParameter([True, False], default=True, space="buy")
buy08 = CategoricalParameter([True, False], default=True, space="buy")
buy09 = CategoricalParameter([True, False], default=True, space="buy")
buy10 = CategoricalParameter([True, False], default=True, space="buy")
buy11 = CategoricalParameter([True, False], default=True, space="buy")
buy12 = CategoricalParameter([True, False], default=True, space="buy")
buy13 = CategoricalParameter([True, False], default=True, space="buy")
buy14 = CategoricalParameter([True, False], default=True, space="buy")
buy15 = CategoricalParameter([True, False], default=True, space="buy")
buy16 = CategoricalParameter([True, False], default=True, space="buy")
buy17 = CategoricalParameter([True, False], default=True, space="buy")
buy18 = CategoricalParameter([True, False], default=True, space="buy")
buy19 = CategoricalParameter([True, False], default=True, space="buy")
buy20 = CategoricalParameter([True, False], default=True, space="buy")
buy21 = CategoricalParameter([True, False], default=True, space="buy")
buy22 = CategoricalParameter([True, False], default=True, space="buy")
buy23 = CategoricalParameter([True, False], default=True, space="buy")
buy24 = CategoricalParameter([True, False], default=True, space="buy")
buy25 = CategoricalParameter([True, False], default=True, space="buy")
buy26 = CategoricalParameter([True, False], default=True, space="buy")
buy27 = CategoricalParameter([True, False], default=True, space="buy")
buy28 = CategoricalParameter([True, False], default=True, space="buy")
buy29 = CategoricalParameter([True, False], default=True, space="buy")
buy30 = CategoricalParameter([True, False], default=True, space="buy")
sell01 = CategoricalParameter([True, False], default=True, space="sell")
sell02 = CategoricalParameter([True, False], default=True, space="sell")
sell03 = CategoricalParameter([True, False], default=True, space="sell")
sell04 = CategoricalParameter([True, False], default=True, space="sell")
sell05 = CategoricalParameter([True, False], default=True, space="sell")
sell06 = CategoricalParameter([True, False], default=True, space="sell")
sell07 = CategoricalParameter([True, False], default=True, space="sell")
sell08 = CategoricalParameter([True, False], default=True, space="sell")
sell09 = CategoricalParameter([True, False], default=True, space="sell")
sell10 = CategoricalParameter([True, False], default=True, space="sell")
#----------------------- END OF HYPER-OPT PARAMETERS -------------------------#
@property
def protections(self):
prot = []
prot.append({
"method": "CooldownPeriod",
"stop_duration_candles": self.cooldown_lookback.value
})
if self.use_stop_protection.value:
prot.append({
"method": "StoplossGuard",
"lookback_period_candles": 24 * 3,
"trade_limit": self.stop_protection_trade_limit.value,
"stop_duration_candles": self.stop_duration.value,
"only_per_pair": self.stop_protection_only_per_pair.value,
"required_profit": self.stop_protection_required_profit.value,
"only_per_side": self.stop_protection_only_per_side.value
})
if self.use_lowprofit_protection.value:
prot.append({
"method": "LowProfitPairs",
"lookback_period_candles": self.lowprofit_protection_lookback.value,
"trade_limit": self.lowprofit_trade_limit.value,
"stop_duration_candles": self.lowprofit_stop_duration.value,
"required_profit": self.lowprofit_required_profit.value,
"only_per_pair": self.lowprofit_only_per_pair.value
})
if self.use_maxdrawdown_protection.value:
prot.append({
"method": "MaxDrawdown",
"lookback_period_candles": self.maxdrawdown_protection_lookback.value,
"trade_limit": self.maxdrawdown_trade_limit.value,
"stop_duration_candles": self.maxdrawdown_stop_duration.value,
"max_allowed_drawdown": self.maxdrawdown_allowed_drawdown.value
})
return prot
# @property
# def max_entry_position_adjustment(self):
# return self.max_epa.value
### Dollar Cost Averaging ### This can be Turned on ###
# This is called when placing the initial order (opening trade)
def custom_stake_amount(self, pair: str, current_time: datetime, current_rate: float,
proposed_stake: float, min_stake: Optional[float], max_stake: float,
leverage: float, entry_tag: Optional[str], side: str,
**kwargs) -> float:
# We need to leave most of the funds for possible further DCA orders
# This also applies to fixed stakes
return proposed_stake / self.max_dca_multiplier
def adjust_trade_position(self, trade: Trade, current_time: datetime,
current_rate: float, current_profit: float,
min_stake: Optional[float], max_stake: float,
current_entry_rate: float, current_exit_rate: float,
current_entry_profit: float, current_exit_profit: float,
**kwargs) -> Optional[float]:
if current_profit > 0.1 and current_profit < 0.15 and trade.nr_of_successful_exits == 0:
# Take 50% of the profit at +10%
return -(trade.stake_amount / 2)
if current_profit > -0.03 and trade.nr_of_successful_entries == 1:
return None
if current_profit > -0.1 and trade.nr_of_successful_entries == 2:
return None
if current_profit > -0.16 and trade.nr_of_successful_entries == 3:
return None
filled_entries = trade.select_filled_orders(trade.entry_side)
count_of_entries = trade.nr_of_successful_entries
# Allow up to 3 additional increasingly larger buys (4 in total)
# Initial buy is 1x
# If that falls to -5% profit, we buy 1.25x more, average profit should increase to roughly -2.2%
# If that falls down to -5% again, we buy 1.5x more
# If that falls once again down to -5%, we buy 1.75x more
# Total stake for this trade would be 1 + 1.25 + 1.5 + 1.75 = 5.5x of the initial allowed stake.
# Total stake for this trade would be 1 + 1.5 + 2 + 2.5 = 5.5x of the initial allowed stake.
# That is why max_dca_multiplier is 5.5
# Hope you have a deep wallet!
try:
# This returns first order stake size
stake_amount = filled_entries[0].cost
# This then calculates current safety order size
stake_amount = stake_amount * (1 + (count_of_entries * 0.5))
return stake_amount
except Exception as exception:
return None
return None
### Trailing Stop ###
def custom_stoploss(self, pair: str, trade: 'Trade', current_time: datetime,
current_rate: float, current_profit: float, **kwargs) -> float:
for stop5 in self.tsl_target5.range:
if (current_profit > stop5):
for stop5a in self.ts5.range:
self.dp.send_msg(f'*** {pair} *** Profit: {current_profit} - lvl5 {stop5}/{stop5a} activated')
return stop5a
for stop4 in self.tsl_target4.range:
if (current_profit > stop4):
for stop4a in self.ts4.range:
self.dp.send_msg(f'*** {pair} *** Profit {current_profit} - lvl4 {stop4}/{stop4a} activated')
return stop4a
for stop3 in self.tsl_target3.range:
if (current_profit > stop3):
for stop3a in self.ts3.range:
self.dp.send_msg(f'*** {pair} *** Profit {current_profit} - lvl3 {stop3}/{stop3a} activated')
return stop3a
for stop2 in self.tsl_target2.range:
if (current_profit > stop2):
for stop2a in self.ts2.range:
self.dp.send_msg(f'*** {pair} *** Profit {current_profit} - lvl2 {stop2}/{stop2a} activated')
return stop2a
for stop1 in self.tsl_target1.range:
if (current_profit > stop1):
for stop1a in self.ts1.range:
self.dp.send_msg(f'*** {pair} *** Profit {current_profit} - lvl1 {stop1}/{stop1a} activated')
return stop1a
for stop0 in self.tsl_target0.range:
if (current_profit > stop0):
for stop0a in self.ts0.range:
self.dp.send_msg(f'*** {pair} *** Profit {current_profit} - lvl0 {stop0}/{stop0a} activated')
return stop0a
return self.stoploss
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
"""Generate all indicators used by the strategy"""
# Pivot Points
pivots = pivots_points.pivots_points(dataframe, timeperiod=32, levels=5) #50
dataframe['pivot'] = pivots['pivot']
dataframe['s5'] = pivots['s5']
dataframe['r5'] = pivots['r5']
dataframe['s3'] = pivots['s3']
dataframe['r3'] = pivots['r3']
dataframe['s2'] = pivots['s2']
dataframe['r2'] = pivots['r2']
dataframe['r3-dif'] = (dataframe['r3'] - dataframe['r2']) / 4
dataframe['r2.25'] = dataframe['r2'] + dataframe['r3-dif']
dataframe['r2.50'] = dataframe['r2'] + (dataframe['r3-dif'] * 2)
dataframe['r2.75'] = dataframe['r2'] + (dataframe['r3-dif'] * 3)
# Filter ZEMA for selling
for length in self.filterlength.range:
dataframe[f'ema_1{length}'] = ta.EMA(dataframe['close'], timeperiod=length)
dataframe[f'ema_2{length}'] = ta.EMA(dataframe[f'ema_1{length}'], timeperiod=length)
dataframe[f'ema_dif{length}'] = dataframe[f'ema_1{length}'] - dataframe[f'ema_2{length}']
dataframe[f'zema_{length}'] = dataframe[f'ema_1{length}'] + dataframe[f'ema_dif{length}']
# Reference MA and offsets
for valma in self.reference_ma_length.range:
dataframe[f'reference_ma_{valma}'] = ta.SMA(dataframe['close'], timeperiod=valma)
dataframe['buy_offset1'] = dataframe[f'reference_ma_{valma}'] * self.buy_offset1.value
dataframe['buy_offset2'] = dataframe[f'reference_ma_{valma}'] * self.buy_offset2.value
dataframe['sell_offset1'] = dataframe[f'reference_ma_{valma}'] * self.sell_offset1.value
dataframe['ref_slope'] =((dataframe[f'reference_ma_{valma}'] - dataframe[f'reference_ma_{valma}'].shift(1)) / dataframe[f'reference_ma_{valma}'].shift(1))
dataframe['ref_slope_sma'] = ta.SMA((dataframe['ref_slope'] *100), timeperiod=5)
# distance from reference ma to current close
dataframe['change'] = ((dataframe['close'] - dataframe[f'reference_ma_{valma}']) / dataframe['close']) * 100
# smoothing the change and offsets
for valsma in self.smoothing_length.range:
dataframe[f'smooth_change_{valsma}'] = ta.SMA(dataframe['change'], timeperiod=valsma)
dataframe['buy_offset3'] = dataframe[f'smooth_change_{valsma}'] - self.buy_change.value
dataframe['sell_offset2'] = dataframe[f'smooth_change_{valsma}'] + self.sell_change.value
dataframe['smooth_ma_slope'] = pta.momentum.slope(dataframe[f'smooth_change_{valsma}'])
dataframe['smooth_slope_sma'] = ta.SMA(dataframe['smooth_ma_slope'], timeperiod=5)
### I.ntelligent B.uying S.ystem ###
# 300 Candle Rolling Min-Max
for l in self.max_length.range:
dataframe['min'] = dataframe['open'].rolling(l).min()
dataframe['max'] = dataframe['close'].rolling(l).max()
# distance from the rolling max in percent
dataframe['from_max'] = ((dataframe['close'] - dataframe['max']) / dataframe['close']) * 100
# distance from the rolling min in percent
dataframe['from_min'] = ((dataframe['open'] - dataframe['max']) / dataframe['open']) * 100
return dataframe
def populate_entry_trend(self, df: DataFrame, metadata: dict) -> DataFrame:
conditions = []
df.loc[
(
(qtpylib.crossed_above(df['smooth_slope_sma'], self.smooth_bull.value)) &
(df['ref_slope_sma'] > self.ref_bull.value) &
(df['from_max'] > self.from_bull.value) &
(self.buy01.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '1 Smooth Bull - Ref Bull')
#not using
df.loc[
(
(qtpylib.crossed_above(df['smooth_slope_sma'], self.smooth_up.value)) &
(df['smooth_slope_sma'] < self.smooth_bull.value) &
(df['from_max'] < self.from_bull.value) &
(df['ref_slope_sma'] > self.ref_bull.value) &
(self.buy02.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '2 Smooth Up - Ref Bull')
df.loc[
(
# (qtpylib.crossed_above(df['smooth_slope_sma'], -self.smooth_ranging.value)) &
(df['smooth_slope_sma'] < self.smooth_up.value) &
(df['smooth_slope_sma'] > self.smooth_down.value) &
(df['from_max'] < self.from_ranging.value) &
(df['ref_slope_sma'] > self.ref_bull.value) &
(self.buy03.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '3 Smooth Range - Ref Bull')
df.loc[
(
(qtpylib.crossed_below(df['smooth_slope_sma'], self.smooth_down.value)) &
(df['smooth_slope_sma'] > self.smooth_bear.value) &
(df['ref_slope_sma'] > self.ref_bull.value) &
(df['from_max'] < self.from_down.value) &
(self.buy04.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '4Smooth Down - Ref Bull')
#not using
df.loc[
(
(qtpylib.crossed_below(df['smooth_slope_sma'], self.smooth_bear.value)) &
(df['close'] < df['buy_offset2']) & # changed from 1 - 2
(df['smooth_slope_sma'] < self.smooth_bear.value) &
(df['ref_slope_sma'] > self.ref_bull.value) &
(df['from_max'] < self.from_bear.value) &
(self.buy05.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '5 Smooth Bear - Ref Bull')
df.loc[
(
(qtpylib.crossed_above(df['smooth_slope_sma'], self.smooth_bull.value)) &
(df['ref_slope_sma'] < self.ref_bull.value) &
(df['ref_slope_sma'] > self.ref_up.value) &
(df['from_max'] < self.from_up.value) &
(self.buy06.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '6 Smooth Bull - Ref Up')
df.loc[
(
(qtpylib.crossed_above(df['smooth_slope_sma'], self.smooth_up.value)) &
(df['smooth_slope_sma'] < self.smooth_bull.value) &
(df['ref_slope_sma'] < self.ref_bull.value) &
(df['ref_slope_sma'] > self.ref_up.value) &
(df['from_max'] < self.from_up.value) &
(self.buy07.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '7 Smooth Up - Ref Up')
# not using
df.loc[
(
(qtpylib.crossed_above(df['smooth_slope_sma'], self.smooth_down.value)) &
(df['smooth_slope_sma'] < self.smooth_up.value) &
(df['smooth_slope_sma'] > self.smooth_down.value) &
(df['ref_slope_sma'] < self.ref_bull.value) &
(df['ref_slope_sma'] > self.ref_up.value) &
(df['from_max'] < self.from_ranging.value) &
(self.buy08.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '8 Smooth Range - Ref Up')
# not using
df.loc[
(
(qtpylib.crossed_above(df['smooth_slope_sma'], self.smooth_down.value)) &
(df['smooth_slope_sma'] > self.smooth_bear.value) &
(df['ref_slope_sma'] < self.ref_bull.value) &
(df['ref_slope_sma'] > self.ref_up.value) &
(df['from_max'] < self.from_down.value) &
(self.buy09.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '9 Smooth Down - Ref Up')
df.loc[
(
(qtpylib.crossed_above(df['smooth_slope_sma'], self.smooth_bear.value)) &
(df['close'] < df['buy_offset1']) &
(df['smooth_slope_sma'] < self.smooth_bear.value) &
(df['ref_slope_sma'] < self.ref_bull.value) &
(df['ref_slope_sma'] > self.ref_up.value) &
(df['from_max'] < self.from_bear.value) &
(self.buy10.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '10 Smooth Bear - Ref Up')
df.loc[
(
(qtpylib.crossed_above(df['smooth_slope_sma'], self.smooth_bull.value)) &
(df['ref_slope_sma'] < self.ref_up.value) &
(df['ref_slope_sma'] > self.ref_down.value) &
(df['from_max'] < self.from_ranging.value) &
(self.buy11.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '11 Smooth Bull - Ref Range')
df.loc[
(
(qtpylib.crossed_above(df['smooth_slope_sma'], self.smooth_up.value)) &
(df['smooth_slope_sma'] < self.smooth_bull.value) &
(df['ref_slope_sma'] < self.ref_up.value) &
(df['ref_slope_sma'] > self.ref_down.value) &
(df['from_max'] < self.from_ranging.value) &
(self.buy12.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '12 Smooth Up - Ref Range')
df.loc[
(
(qtpylib.crossed_above(df['smooth_slope_sma'], self.smooth_down.value)) &
(df['smooth_slope_sma'] < self.smooth_up.value) &
(df['smooth_slope_sma'] > self.smooth_down.value) &
(df['ref_slope_sma'] < self.ref_up.value) &
(df['ref_slope_sma'] > self.ref_down.value) &
(df['from_max'] < self.from_ranging.value) &
(self.buy13.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '13 Smooth Range - Ref Range')
df.loc[
(
(qtpylib.crossed_above(df['smooth_slope_sma'], self.smooth_down.value)) &
(df['smooth_slope_sma'] > self.smooth_bear.value) &
(df['ref_slope_sma'] < self.ref_up.value) &
(df['ref_slope_sma'] > self.ref_down.value) &
(df['from_max'] < self.from_down.value) &
(self.buy14.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '14 Smooth Down - Ref Range')
df.loc[
(
(qtpylib.crossed_above(df['smooth_slope_sma'], self.smooth_bear.value)) &
(df['close'] < df['buy_offset1']) &
(df['smooth_slope_sma'] < self.smooth_bear.value) &
(df['ref_slope_sma'] < self.ref_up.value) &
(df['ref_slope_sma'] > self.ref_down.value) &
(df['from_max'] < self.from_bear.value) &
(self.buy15.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '15 Smooth Bear - Ref Range')
df.loc[
(
(qtpylib.crossed_above(df['smooth_slope_sma'], self.smooth_bull.value)) &
(df['ref_slope_sma'] < self.ref_down.value) &
(df['ref_slope_sma'] > self.ref_bear.value) &
(df['from_max'] < self.from_down.value) &
(self.buy16.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '16 Smooth Bull - Ref Down')
df.loc[
(
(qtpylib.crossed_above(df['smooth_slope_sma'], self.smooth_up.value)) &
(df['smooth_slope_sma'] > self.smooth_bull.value) &
(df['ref_slope_sma'] < self.ref_down.value) &
(df['ref_slope_sma'] > self.ref_bear.value) &
(df['from_max'] < self.from_down.value) &
(self.buy17.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '17 Smooth Up - Ref Down')
df.loc[
(
(qtpylib.crossed_above(df['change'], df[f'smooth_change_{self.smoothing_length.value}'])) &
(df['close'] < df['buy_offset1']) &
(df['smooth_slope_sma'] < self.smooth_up.value) &
(df['smooth_slope_sma'] > self.smooth_down.value) &
(df['ref_slope_sma'] < self.ref_down.value) &
(df['ref_slope_sma'] > self.ref_bear.value) &
(df['from_max'] < self.from_down.value) &
(self.buy18.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '18 Smooth Range - Ref Down')
df.loc[
(
(qtpylib.crossed_above(df['change'], df[f'smooth_change_{self.smoothing_length.value}'])) &
(df['smooth_slope_sma'] > self.smooth_bear.value) &
(df['ref_slope_sma'] < self.ref_down.value) &
(df['ref_slope_sma'] > self.ref_bear.value) &
(df['from_max'] < self.from_down.value) &
(self.buy19.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '19 Smooth Down - Ref Down - % XO')
df.loc[
(
(df['min'] > df['close']) &
(df['smooth_slope_sma'] > self.smooth_bear.value) &
(df['ref_slope_sma'] < self.ref_down.value) &
(df['ref_slope_sma'] > self.ref_bear.value) &
(df['from_max'] < self.from_down.value) &
(self.buy20.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '20 Smooth Down - Ref Down - Open < Min')
df.loc[
(
(qtpylib.crossed_above(df['smooth_slope_sma'], self.smooth_bear.value)) &
(df['smooth_slope_sma'] < self.smooth_bear.value) &
(df['ref_slope_sma'] < self.ref_down.value) &
(df['ref_slope_sma'] > self.ref_bear.value) &
(df['from_max'] < self.from_down.value) &
(self.buy21.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '21 Smooth Bear - Ref Down')
df.loc[
(
(qtpylib.crossed_above(df['smooth_slope_sma'], self.smooth_bull.value)) &
(df['ref_slope_sma'] < self.ref_bear.value) &
(df['from_max'] < self.from_bear.value) &
(self.buy22.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '22 Smooth Bull - Ref Bear')
df.loc[
(
(qtpylib.crossed_above(df['smooth_slope_sma'], self.smooth_up.value)) &
(df['smooth_slope_sma'] < self.smooth_bull.value) &
(df['ref_slope_sma'] < self.ref_bear.value) &
(df['from_max'] < self.from_bear.value) &
(self.buy23.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '23 Smooth Up - Ref Bear')
df.loc[
(
(qtpylib.crossed_above(df['smooth_slope_sma'], self.smooth_down.value)) &
(df['smooth_slope_sma'] < self.smooth_up.value) &
(df['smooth_slope_sma'] > self.smooth_down.value) &
(df['ref_slope_sma'] < self.ref_bear.value) &
(df['from_max'] < self.from_bear.value) &
(self.buy24.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '24 Smooth Range - Ref Bear')
df.loc[
(
(qtpylib.crossed_above(df['smooth_slope_sma'], self.smooth_down.value)) &
(df['smooth_slope_sma'] > self.smooth_bear.value) &
(df['ref_slope_sma'] < self.ref_bear.value) &
(df['from_max'] < self.from_bear.value) &
(self.buy25.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '25 Smooth Down - Ref Bear')
df.loc[
(
(qtpylib.crossed_above(df['smooth_slope_sma'], self.smooth_bear.value)) &
# (df['close'] < df['buy_offset2']) &
(df['smooth_slope_sma'] < self.smooth_bear.value) &
(df['ref_slope_sma'] < self.ref_bear.value) &
(df['from_max'] < self.from_bear.value) &
(self.buy26.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '26 Smooth Bear - Ref Bear')
df.loc[
(
(qtpylib.crossed_above(df['change'], df['buy_offset3'])) &
(df['pivot'] < df['sell_offset1']) &
(df['close'] < df['buy_offset1']) &
(df['smooth_slope_sma'] > self.smooth_down.value) &
(df['from_max'] < self.from_ranging.value) &
(self.buy27.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '27 XO above buy_offset3 | Range - Bull')
df.loc[
(
(df['min'] < df['buy_offset1']) &
((df['from_max'] - df['from_max'].shift(8)) < self.from_down.value) &
(df['close'] < df['buy_offset1']) &
(self.buy28.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '28 Low XB Min < buy_offset1')
df.loc[
(
(qtpylib.crossed_above(df['change'], df['buy_offset3'])) &
(df['pivot'] < df['sell_offset1']) &
(df['close'] < df['buy_offset1']) &
(df['smooth_slope_sma'] < self.smooth_down.value) &
(df['from_max'] < self.from_down.value) &
(self.buy29.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, '29 XO above buy_offset3 | Down - Bear')
# df.loc[
# (
# (qtpylib.crossed_above(df['pivot'], df[f'reference_ma_{self.reference_ma_length.value}'])) &
# # (df['close'] < df[f'reference_ma_{self.reference_ma_length.value}']) &
# # (df[f'reference_ma_{self.reference_ma_length.value}'] > df[f'reference_ma_{self.reference_ma_length.value}'].shift(1)) &
# (df['smooth_ma_slope'] > df['ref_slope_sma']) &
# (df['ref_slope_sma'] > 0) &
# (self.buy30.value == True) &
# (df['volume'] > 0) # Make sure Volume is not 0
# ),
# ['enter_long', 'enter_tag']] = (1, '30 Golden XO')
# df.loc[
# (
# (qtpylib.crossed_above(df['change'], df['buy_offset3'])) &
# (df['smooth_ma_slope'] < 0) &
# (df['close'] < df[f'reference_ma_{self.reference_ma_length.value}']) &
# (df['volume'] > 0) # Make sure Volume is not 0
# ),
# ['enter_long', 'enter_tag']] = (1, 'XO above buy_offset|slope down')
# df.loc[
# (
# (qtpylib.crossed_above(df['change'], df['buy_offset3'])) &
# (df['smooth_ma_slope'] > -0.005) &
# (df['close'] < df[f'reference_ma_{self.reference_ma_length.value}']) &
# (df['volume'] > 0) # Make sure Volume is not 0
# ),
# ['enter_long', 'enter_tag']] = (1, 'XO above buy_offset|slope up')
# df.loc[
# (
# (df['min'] < df['buy_offset1']) &
# ((df['from_max'] - df['from_max'].shift(8)) < self.bear_from_max.value) &
# (df['close'] < df['buy_offset1']) &
# (df['volume'] > 0) # Make sure Volume is not 0
# ),
# ['enter_long', 'enter_tag']] = (1, 'Low XB Min < buy_offset1')
# df.loc[
# (
# (qtpylib.crossed_above(df['close'], df['buy_offset2'])) &
# (df['change'] < df['buy_offset3']) &
# (df['volume'] > 0) # Make sure Volume is not 0
# ),
# ['enter_long', 'enter_tag']] = (1, 'XO above buy_offset2')
# df.loc[
# (
# (qtpylib.crossed_above(df['change'], df[f'smooth_change_{self.smoothing_length.value}'])) &
# (df['close'] < df[f'reference_ma_{self.reference_ma_length.value}']) &
# (df[f'reference_ma_{self.reference_ma_length.value}'] > df[f'reference_ma_{self.reference_ma_length.value}'].shift(1)) &
# (df['close'] > df['buy_offset1']) &
# (df['smooth_ma_slope'] < 0) &
# (df['volume'] > 0) # Make sure Volume is not 0
# ),
# ['enter_long', 'enter_tag']] = (1, 'XO above Ref')
return df
def populate_exit_trend(self, df: DataFrame, metadata: dict) -> DataFrame:
df.loc[
(
(qtpylib.crossed_below(df[f'zema_{self.filterlength.value}'], df['r5'])) &
(df['close'] > (df[f'reference_ma_{self.reference_ma_length.value}'] * self.sell_offset1.value)) &
(self.sell01.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['exit_long', 'exit_tag']] = (1, 'R5 - XO')
df.loc[
(
(qtpylib.crossed_below(df[f'zema_{self.filterlength.value}'], df['r3'])) &
(df['smooth_ma_slope'] < self.sell_slope.value) &
(self.sell02.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['exit_long', 'exit_tag']] = (1, 'R3 - XO')
df.loc[
(
(qtpylib.crossed_below(df[f'zema_{self.filterlength.value}'], df['r2.75'])) &
(df['smooth_ma_slope'] < self.sell_slope.value) &
(self.sell03.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['exit_long', 'exit_tag']] = (1, 'R2.75 - XO')
df.loc[
(
(qtpylib.crossed_below(df[f'zema_{self.filterlength.value}'], df['r2.50'])) &
(df['smooth_ma_slope'] < self.sell_slope.value) &
(self.sell04.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['exit_long', 'exit_tag']] = (1, 'R2.5 - XO')
df.loc[
(
(qtpylib.crossed_below(df[f'zema_{self.filterlength.value}'], df['r2.25'])) &
(df['smooth_ma_slope'] < self.sell_slope.value) &
(self.sell05.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['exit_long', 'exit_tag']] = (1, 'R2.25 - XO')
df.loc[
(
(qtpylib.crossed_below(df[f'zema_{self.filterlength.value}'], df['r2'])) &
(df['smooth_ma_slope'] < self.sell_slope.value) &
(self.sell06.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['exit_long', 'exit_tag']] = (1, 'R2 - XO')
df.loc[
(
(qtpylib.crossed_below(df[f'zema_{self.filterlength.value}'], df['pivot'])) &
(df['smooth_ma_slope'] < self.sell_slope.value) &
(self.sell07.value == True) &
(df['volume'] > 0) # Make sure Volume is not 0
),
['exit_long', 'exit_tag']] = (1, 'Pivot - XO')
return df
# Best result:
# 585/1000: 279 trades. 259/0/20 Wins/Draws/Losses. Avg profit 2.54%. Median profit 3.90%. Total profit 2061.56810074 USDT ( 206.16%). Avg duration 1 day, 23:57:00 min. Objective: -2061.56810
# # Buy hyperspace params:
# buy_params = {
# "buy1": True, # value loaded from strategy
# "buy10": True, # value loaded from strategy
# "buy11": False, # value loaded from strategy
# "buy12": False, # value loaded from strategy
# "buy13": False, # value loaded from strategy
# "buy14": False, # value loaded from strategy
# "buy15": False, # value loaded from strategy
# "buy16": True, # value loaded from strategy
# "buy17": True, # value loaded from strategy
# "buy18": True, # value loaded from strategy
# "buy19": False, # value loaded from strategy
# "buy2": False, # value loaded from strategy
# "buy20": True, # value loaded from strategy
# "buy21": True, # value loaded from strategy
# "buy22": True, # value loaded from strategy
# "buy23": True, # value loaded from strategy
# "buy24": False, # value loaded from strategy
# "buy25": True, # value loaded from strategy
# "buy26": True, # value loaded from strategy
# "buy27": True, # value loaded from strategy
# "buy28": False, # value loaded from strategy
# "buy29": True, # value loaded from strategy
# "buy3": True, # value loaded from strategy
# "buy4": True, # value loaded from strategy
# "buy5": False, # value loaded from strategy
# "buy6": True, # value loaded from strategy
# "buy7": True, # value loaded from strategy
# "buy8": False, # value loaded from strategy
# "buy9": False, # value loaded from strategy
# "buy_change": 1.6, # value loaded from strategy
# "buy_offset1": 0.99, # value loaded from strategy
# "buy_offset2": 0.92, # value loaded from strategy
# "from_bear": -11.7, # value loaded from strategy
# "from_bull": -3.1, # value loaded from strategy
# "from_down": -5.4, # value loaded from strategy
# "from_ranging": -3.5, # value loaded from strategy
# "from_up": -4.7, # value loaded from strategy
# "ref_bear": -0.113, # value loaded from strategy
# "ref_bull": 0.098, # value loaded from strategy
# "ref_down": -0.067, # value loaded from strategy
# "ref_up": 0.027, # value loaded from strategy
# "reference_ma_length": 192, # value loaded from strategy
# "smooth_bear": -0.117, # value loaded from strategy
# "smooth_bull": 0.086, # value loaded from strategy
# "smooth_down": -0.013, # value loaded from strategy
# "smooth_up": 0.073, # value loaded from strategy
# "smoothing_length": 23, # value loaded from strategy
# }
# # Sell hyperspace params:
# sell_params = {
# "filterlength": 35,
# "sell_change": 1.8,
# "sell_offset1": 1.03,
# "sell_slope": -0.04,
# "ts0": 0.008,
# "ts1": 0.011,
# "ts2": 0.021,
# "ts3": 0.031,
# "ts4": 0.03,
# "ts5": 0.05,
# "tsl_target0": 0.044,
# "tsl_target1": 0.055,
# "tsl_target2": 0.083,
# "tsl_target3": 0.12,
# "tsl_target4": 0.2,
# "tsl_target5": 0.4,
# }
# # Protection hyperspace params:
# protection_params = {
# "cooldown_lookback": 1,
# "lowprofit_only_per_pair": True,
# "lowprofit_protection_lookback": 1,
# "lowprofit_required_profit": -0.829,
# "lowprofit_stop_duration": 83,
# "lowprofit_trade_limit": 1,
# "maxdrawdown_allowed_drawdown": 0.1,
# "maxdrawdown_protection_lookback": 3,
# "maxdrawdown_stop_duration": 74,
# "maxdrawdown_trade_limit": 1,
# "stop_duration": 102,
# "stop_protection_only_per_pair": True,
# "stop_protection_only_per_side": True,
# "stop_protection_required_profit": -0.924,
# "stop_protection_trade_limit": 9,
# "use_lowprofit_protection": False,
# "use_maxdrawdown_protection": True,
# "use_stop_protection": False,
# }
# # ROI table: # value loaded from strategy
# minimal_roi = {
# "0": 0.1
# }
# # Stoploss:
# stoploss = -0.2 # value loaded from strategy
# # Trailing stop:
# trailing_stop = True # value loaded from strategy
# trailing_stop_positive = None # value loaded from strategy
# trailing_stop_positive_offset = 0.0 # value loaded from strategy
# trailing_only_offset_is_reached = False # value loaded from strategy
# {
# "strategy_name": "CTIBS",
# "params": {
# "roi": {
# "0": 0.14300000000000002,
# "736": 0.099,
# "2369": 0.024,
# "5731": 0
# },
# "stoploss": {
# "stoploss": -0.28
# },
# "trailing": {
# "trailing_stop": true,
# "trailing_stop_positive": null,
# "trailing_stop_positive_offset": 0.0,
# "trailing_only_offset_is_reached": false
# },
# "max_open_trades": {
# "max_open_trades": 6
# },
# "buy": {
# "buy1": true,
# "buy10": false,