Hey! Sounds like the million dollar question!
I was close to answer:
If Not OnMarket THEN
BUY 1 CONTRACT AT MARKET
ENDIF
SET STOP %LOSS 1
SET TARGET %PROFIT 3
But looks like is no profitable anywhere and was a little joke 🙂
I’m trying to develop a code for this support/resistance strategy and here is the code. Is not finished and i’m still trying to make it works.
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
DEFPARAM PRELOADBARS = 0
DEFPARAM FLATBEFORE = 090000
DEFPARAM FLATAFTER = 220000
REM VARIABLES
maximo = Highest [ 240 ] (high )
minimo = Lowest [ 240 ] (low )
REM PARAMETERS
pipstop = 3
pipsprofit = 10
margin = 1 * PipSize
REM MONEY MANAGEMENT
Capital = 10000
Risk = 0.03
equity = capital+ strategyprofit
maxrisk = round (equity* risk)
myLOT = (maxrisk/ pipstop)/ PointValue
if not shortonmarket then
REM SWING HIGH DEFINITION
c1 = High [ 1 ] > High [ 2 ] AND High < High [ 1 ]
c2 = High [ 1 ] = maximo
IF c2 then
if c1 THEN
venta = 1
swh = High [ 1 ] - margin
endif
endif
REM SHORT CONDITION
IF High > High [ 1 ] THEN
venta = 0
endif
IF venta = 1 THEN
SELLSHORT myLOT CONTRACTS AT swh LIMIT
SET STOP PLOSS pipstop
SET TARGET PPROFIT pipsprofit
ENDIF
ENDIF
IF Not LongOnMarket THEN
c3 = Low [ 1 ] < Low [ 2 ] AND Low > Low [ 1 ]
c4 = Low [ 1 ] = minimo
IF c4 THEN
IF c3 THEN
compra = 1
swl = Low [ 1 ] + margin
ENDIF
ENDIF
IF Low < Low [ 1 ] THEN
compra = 0
ENDIF
IF compra = 1 THEN
BUY myLOT CONTRACTS AT swl LIMIT
SET STOP PLOSS pipstop
SET TARGET PPROFIT pipsprofit
ENDIF
endif
graph swh
graph swl
Glad to here your coments and improvements on it