Weirdest thing out, must be a simple answer I am missing surely?
Code below runs fine on DJI, results attached.
Try and optimise any value and results are ZERO!
Please try maperiod first as maybe maperiod is the weird one and that is screwing all the others??
Tell me what I’m missing please … to preserve my sanity and stop me shouting at the wife! 🙂
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
DEFPARAM CUMULATEORDERS = False
//INDICATOR
IBS = (Close - Low ) / (HIGH - LOW ) * 100
RSI2 = RSI [ 2 ] (close )
MA = average [ maperiod] (close )
//CONTRACTSIZE
X = 1
//MOVING AVERAGE PERIOD
maperiod = 144
//SIGNAL
IBSLONGTRIGGER = 50
IBSSHORTTRIGGER = 50
RSILONGTRIGGER = 10
RSILONGEXIT = 80
RSISHORTTRIGGER = 90
RSISHORTEXIT = 20
//ENTRY CONDITION
l1 = NOT LongOnMarket
l1 = l1 and IBS > IBSLONGTRIGGER
l1 = IBS[ 1 ] < IBSLONGTRIGGER[ 1 ]
l1 = l1 and RSI2 > RSILONGTRIGGER
l1 = RSI2[ 1 ] < RSILONGTRIGGER[ 1 ]
l1 = l1 and low [ 1 ] > MA
b1 = NOT ShortOnMarket
b1 = b1 and IBS < IBSSHORTTRIGGER
b1 = IBS[ 1 ] > IBSSHORTTRIGGER[ 1 ]
b1 = b1 and RSI2 < RSISHORTTRIGGER
b1 = RSI2[ 1 ] > RSISHORTTRIGGER[ 1 ]
b1 = b1 and high [ 1 ] < MA
//EXIT CONDITION
l2 = LongOnMarket
l2 = RSI2 > RSILONGEXIT
b2 = ShortOnMarket
b2 = RSI2 < RSISHORTEXIT
//LONG ENTRY
IF l1 THEN
BUY X CONTRACTS AT MARKET NextBarOpen
ENDIF
//LONG EXIT
If l2 THEN
SELL X CONTRACTS AT MARKET NextBarOpen
ENDIF
//SHORT ENTRY
IF b1 THEN
SELLSHORT X CONTRACTS AT MARKET NextBarOpen
ENDIF
//SHORT EXIT
IF b2 THEN
EXITSHORT AT MARKET NextBarOpen
ENDIF