Post your topic in the correct forum:
_ ProRealTime Platform Support: only platform related issues.
_ ProOrder: only strategy topics.
_ ProBuilder: only indicator topics.
_ ProScreener: only screener topics
_ General Discussion: any other topics.
_ Welcome New Members: for new forum members to introduce themselves.
I moved it from ProBuilder.
Do not append your code to existing topics, create a new one.
Give your topic a meaningful title. Describe your question or your subject in your title. Do not use meaningless titles such as ‘Coding Help Needed’
Read carefully the main rules, highlighted in yellow below.
ALLWAYS post the code, unless it’s hundreds of lines of code, in addition to the ITF file.
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
// TOM DERYCKE
DEFPARAMCumulateOrders=false
// MONEY MANAGEMENT
REINV=0
LEVIER=1
CAPITALinit=10000
IFREINV=0THEN
n=levier
ELSIFREINV=1THEN
capital=CAPITALinit+strategyprofit
n=(capital/CAPITALinit)*levier
IFn<1THEN
n=1
ENDIF
n=round(n)
ENDIF
// 4 hour TF (get the trend of the 4 hour chart)
timeframe(4hour,updateonclose)
MA200=(Average[200](close))
bulltrend=close>MA200
// "default" timeframe (the timeframe you will launch the strategy on)
timeframe(1hour,default)
MA18=(Average[18](close))
MA22=(Average[22](close))
buyc=MA18crosses overMA22
sellc=MA22crosses underMA18
IFbulltrendandbuycTHEN
Buyncontractsatmarket
ENDIF
IFsellcTHEN
Sellncontractsatmarket
ENDIF
What’s wrong with your code?
On which instrument/asset/fx pair and time frame are you using it?
If you insert “graph buyc” and “graph sellc” at the end of your code you will see that both buy and sell are triggered at the same time. That’s because the logic for both buy and sell variables are identical for going long or short.
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.