Horace,
That is not what I ment. I'm sorry if I didn't explained it clearly enough. English isn't my mother language either;)
What I ment is that not only the trades of today or yesterday are executed 2 days too late.. but ALL trades are executed 2 bars too late. And that's why I can't...
The more I think about it the more I find it strange that the platform doesn't calculates the code in the right way.
When using EOD I can imagine the code doesn't work on today's bar, but when I activate real time data in PRT, the platform exactly knows the open of today and the close of...
"The code I provided is usefull for backtest but not for real time trading of course."
How do you mean that the code is usefull for backtesting? When I try to backtest it the trades are executed too late and therefore it isn't usefull for backtesting.. Or am I missing something?
Thanks for...
Horace,
I've tested your last code and unfortunatelly this code is even 2 bars too late in the execution.
I think I'm going to try some other platform.
Tim
@ eminiglobex: Thanks! I've tested my strategy with 2 ticks of slippage and 0,2 spread and the result were pretty good.
@ Poem 101: Yes, I need some very liquid markets and contracts because I want to keep the slippage to a minimum. Large slippage on small stop sizes can really ruin the overall...
Hi Poem 101,
I was referring to CfDs on the S&P500. I don't really know yet on which specific product I want to trade my system, it could be ETF, CfD, Futures or something else.
Tim
Ok good to know.
Hmm I will need to investigate this some more, because I actually want the system to trade fully automatic. Ofcourse I will monitor it daily (when it goes live), but I don't want to put in the orders myself.
Well the problem is that the system usually wants to enter the market directly when the market opens. Is there a way to work with limit orders when you want to enter at the opening of the market?
Thanks Horace,
That's a lot more then I expected. That amount of slippage will probably have a big negative effect on the results from my backtests, because the strategy I developed makes intraday trades with very small stopsizes.
ps. Interesting blog you have, I will keep an eye on that.
Thank you very much Horace!
This is the best answer I got till now, unfortunalety it is not what I hoped for.
But I'm glad that I now know the reason why my code doesn't work.
Still I find it strange that the backtesting software doesn't just leave today's bar out of the calculations.
I'm...
You are right Shakone, I didn't notice the difference between Open[1] in your code and dOpen(1) in my code.
However, your code also executes trades 1 bar too late. I have attached a screenshot that shows the problem.
As you can see in the screenshot there was a red candle on December 28th...
Shakone, the code you posted is exactly the same as the code I posted in my first post. With that code signals get executed 1 day too late.
The problem is that dOpen(0) refers to the opening price of yesterday instead of today, dOpen(1) refers to the day before yesterday instead of yesterday...
Horace, I checked your code and it works :)
Somehow dOpen(0) refers to yesterday instead of today.. strange
But now I got trouble making a code that refers to today, I tried dOpen(-1) but obviously that didn't work..
If for example I want to go Long when today's open is higher than...