Thank you Glenn for sharing this code with us. I post the code below for a better comprehension of the strategy:
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
ONCEBull=2
ONCEBear=2
ONCExOpen=0
xClose=(Open+High+Low+Close)/4
if(barindex>2)then
xOpen=(xOpen[1]+xClose[1])/2
endif
c1=xClose>xOpen[1]
c2=xClose<xOpen[1]
IFc1THEN
Bear=0
Bull=Bull+1
ifnotonmarketthen
buy1perpointatmarket
endif
ELSIFc2THEN
Bull=0
Bear=Bear-1
ifnotonmarketthen
sellshort1perpointatmarket
endif
ELSE// IF xClose and xOpen are exactly the same value
ENDIF
set targetpprofit20
//set stop ploss 25
IMO, a major problem with the strategy is that there is no stoploss or no closure of any kind (except the 20 points takeprofit) and because you are waiting to be not on market anymore to open a contrarian order. So depending on when you launch the strategy, the order could last forever, waiting for the price to give us our 20 points.. but it can also never happen like in the attached example, sorry for that 🙁
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.