March 24, 2019 at 10:53 am #51951
I’m looking for assistance with the backtester and forex trading.
If I’m testing forex trades, and setting a target exit of 50 pips, does the TARGETTYPE = Point stay as is? Is the value 50 or 0.005 ?
How do I set an entry with a setup bar and then an entry bar. Ie a setup bar is given when a set of entry criteria are met. (Could be anything such as a moving average cross, etc), but then a trade is only entered on the subsequent bar if that subsequent bar breaks the high of the setup bar (for a long entry).
Same for exit. How can I create an exit so that there is an exit setup bar (which meets certain criteria), but then the exit is only triggered if the subsequent bar to the exit setup bar breaks the low of the exit setup bar.
Hope this makes sense!
SteveMarch 25, 2019 at 9:34 am #51979
For you for query i believe 0.005 is what you would use in this scenario.
For your second query, you can set the Back Testers Enter Trade Price and Exit Trade Price to Signal, then in your entry and exit scripts add the two criteria you are after.
For example, if you wanted the Entry signal to be when the Close crosses above a 50SMA line, and have the entry placed on the next day, but only if the high of that bar is higher than the previous bar, you could use something like this:12345V1 = CLOSE() CrossesAbove MA(BARS=50) ;V2 = HIGH() > HIGH(1) ;V1 and V2
The square brackets after V1 are used to offset the criteria, so we’re looking for that to have occurred the day before the High of the current bar is higher than the previous days bar.March 25, 2019 at 11:14 am #51995
In your example, where is the actual entry? (Let’s call the trigger bar in your chart bar 1, then the next one bar 2 and so on.)
I can see in the backtester how to enter the trade at the open of bar 3, or at the close of bar 2. (Or for that matter the open or close of any bar) What I would like to do however is to enter at the very exact time that bar 2 moves one tick /pip / cent higher than the high of bar 1. (Not wait until the bar closes).
Is this something that the backtester can acheive? I know it’s hard to do if we’re not looking at the chart in real time, however can the backtester look at the bars and go, right – bar 2 has broken the high of bar 1 at some point of that session, let’s attach an entry the high of bar 1 (plus a pip say). This would allow (in my case) a more accurate approximation of my entries.
Hope this makes sense.
Thanks SteveMarch 25, 2019 at 11:24 am #52011
As far as i am aware this can’t be done for the type of criteria you are after.March 25, 2019 at 11:40 pm #52027
- Topics: 41
- Replies: 128
- Posts: 169
I think the following script might do what you want, which I understand to be that the script return the entry value. The following script, which adds 0.1 to the High of the signal bar as the Entry price, will do that:
V1 = CLOSE(0) CrossesAbove MA(BARS=50) ;
V2 = HIGH(0) > (HIGH(1) +0.1) ;
Entry = If(V1 and V2, HIGH(1) + 0.1, 0);
The results of that script are shown in Blue on the following chart. The Magenta Showbar arrows are from the script Matthew suggested.
Now, as to using my script in the Backtester, I’m afraid I’m no help there as I haven’t done very much work with it. However, if the Backtester only uses Boolean values, ie this is a signal or there it isn’t, then knowing the entry value is not going to help.That’s a point that Matthew may be able to clarify.
Let’s know if that helps.
TrevorMarch 26, 2019 at 7:13 am #52035
Thank you Trevor – this is what I’m looking for.
I assume though that this script cannot be used in the backtester. (Is that correct Matthew?)
SteveMarch 26, 2019 at 8:18 am #52047
The script would produce the result you wanted on the chart but would not work with the back tester. The output of the script is not a Boolean value which is required for use with the back testers Entry / Exit criteria.
You must be logged in to reply to this topic.