If you want folk on here to offer reasons then you need to post your code and a few screen shots of what you consider the System is not doing correct etc?
Also screen shots of comparison between Fwd Test and Back Test with you highlighting on the screenshot where trades are not the same etc?
Make it easy for folk to help you?
Without looking at your code, there are not other help we can afford, sorry.
Hey, here’s the code for a system I’m running on the DAX 4H timeframe. I was thinking, can it have anything to do with the space between the lines of text? Because this is exactly how the code is written in PRT. It does look a bit messy maybe.
Defparam FlatBefore = 125500
Defparam FlatAfter = 170000
xClose = (Open+High+Low+Close)/4
if(barindex>2) then
xOpen = (xOpen[1] + xClose[1])/2
endif
c1 = xClose>xOpen AND xClose[1]<xOpen[1]
c2 = xClose<xOpen AND xClose[1]>xOpen[1]
if c2 AND Not LongOnMarket then
BUY 1 SHARE AT MARKET
EXITSHORT AT MARKET
endif
if c1 AND Not ShortOnMarket then
SELLSHORT 1 SHARE AT MARKET
SELL AT MARKET
endif
SET STOP $TRAILING 20
set target pprofit 40
I edited it so that NOW it is exactly how it shold look in PRT.
As for blank lines you can add/remove them as you like.
Line 7 should read
if(barindex>1) then
and line 5 should be included within IF … ENDIF, just before line 8.
Line 7 should read
and line 5 should be included within IF … ENDIF, just before line 8.
Thanks a lot. I also noticed this trailing stop is automatically set to trail in 5 pip steps, although I don’t seem to have defined that anywhere in the code. Maybe that has to do with the broker?
At line 24 you set a TRAILING STOP.
At line 24 you set a TRAILING STOP.
Yeah I know. What I meant was that even though my trailing stop is 20, the steps are 5 pips, not 20 pips.
Anyway, right now I should have an open position running on my 4H system but no order has been triggered. No canceled or rejected orders either.
The code is the same as above, the only difference is the timeframe:
Defparam FlatBefore = 085500
Defparam FlatAfter = 130000
My system should have opened a long position at 09:00. If I do a backtest tomorrow it will probably show a trade taken on Aug 15, 09:00. We’ll see.
I’m running on the DAX 4H timeframe.
If so then:
Defparam FlatBefore = 085500
Defparam FlatAfter = 130000
….will never be met as there is no 085500 or 130000 candles on a 4 hour chart.
Your line 24 orders the system to trail each 20 units of your currency (€ if your account is in Euros, or whatever it is). If you want to trail each 20 pips you should use
SET STOP pTRAILING 20
As for your dsired time, do you want to enter a trade only if the 4-hour bar starting at 090000 meets your conditions?
I’m running on the DAX 4H timeframe.
If so then:
|
|
Defparam FlatBefore = 085500
Defparam FlatAfter = 130000
|
….will never be met as there is no 085500 or 130000 candles on a 4 hour chart.
There is a candle starting at 130000, it’s the one after 090000.
I am not sure whether
DEFPARAM FlatBefore/After match the timing of candlesticks. I think they are system dependent, so that, no matter what TF you use, ProOrder won’t accept orders before that time and will cancel any open trade after that time. But I am not sure about that!
There is a candle starting at 130000, it’s the one after 090000. I am not sure whether DEFPARAM FlatBefore/After match the timing of candlesticks. I think they are system dependent, so that, no matter what TF you use, ProOrder won’t accept orders before that time and will cancel any open trade after that time. But I am not sure about that!
You are obviously working in a different time zone to me then – but there is still no 085500 candle which means that condition will never be met. PRT can only see candles that actually exist on the chart so you will have 010000, 050000, 090000, 130000, 170000 and 210000 candles and nothing else. These are the only times you can use in any strategy used on a 4 hour chart.
I might be wrong on this as I never use FLATBEFORE and FLATAFTER – maybe Nicolas can confirm for us how fussy these defined parameters are about the time used.