Hi all, Dan here.
Im a new member of the forum and also to PRT coding, and I am finding it a little tricky thus far to say the least! I tend to get the hang of things reasonably well so I’m sure it’ll fall into place soon enough.
What I’m trying to do is backtest a simple end of day forex trading strategy, initially on GBP/USD. I want to enter long 1 pip above the previous days high, or enter short 1 pip below the previous days low, whichever appears first (if any). I want to trade a maximum of once per day, with a fixed profit target of 30 pip and stop loss at 20 pip. If no trade has been entered by the end of the day I assume it will just ‘reset’ at midnight, and then tomorrow will be looking to trade above/below todays high/low instead?
I initially tried using the assisted programmer, utilising an indicator I had made displaying yesterdays high and low as a line on the chart. I selected to ‘buy’ when ‘price’ ‘>”yesterdays high’ and also did the opposite for short, and it basically entered either long or short each day but always at 00:00 so basically on open, and then the trade would end also at 00:00, i.e. the same minute. Yesterdays price didn’t seem to have been considered whatsoever. Another thing, is I read in another thread on here that I will have to use shorter timeframe charts as the test will not recognise whether the profit or stop was hit first due to the bar only being considered as the finished article? I hope I’m getting this right. That leads me to thinking that the minute charts are the way to go if i want most accuracy, but this compromises on how far back the data will go? I then tried on a minute chart and the same thing happened, but then lots more trades were entered throughout the course of the day.
I’m literally starting from the beginning so i apologise in advance, but if anyone has any advice about anything I’ve written it will be gratefully received.
Cheers
Dan