@Robertogozzi, @ Nicolaas
Can you help my with my code?
Some problems with my pro real time.
I won’t give any backtest.
Thanks in advance!!
Tom
- 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.
// TOM DERYCKE
DEFPARAM CumulateOrders = false
// MONEY MANAGEMENT
REINV = 0
LEVIER = 1
CAPITALinit = 10000
IF REINV = 0 THEN
n = levier
ELSIF REINV = 1 THEN
capital = CAPITALinit + strategyprofit
n = (capital / CAPITALinit)*levier
IF n < 1 THEN
n = 1
ENDIF
n = round(n)
ENDIF
// 4 hour TF (get the trend of the 4 hour chart)
timeframe (4 hour, updateonclose)
MA200 = (Average[200](close))
bulltrend = close > MA200
// "default" timeframe (the timeframe you will launch the strategy on)
timeframe (1 hour, default)
MA18 = (Average[18](close))
MA22 = (Average[22](close))
buyc = MA18 crosses over MA22
sellc = MA22 crosses under MA18
IF bulltrend and buyc THEN
Buy n contracts at market
ENDIF
IF sellc THEN
Sell n contracts at market
ENDIF
What’s wrong with your code?
On which instrument/asset/fx pair and time frame are you using it?
Hi daxtrader3
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.
Hope this helps