Backtester help

Optuma Forums Optuma Scripting Backtester help

This topic contains 6 replies, has 3 voices, and was last updated by Matthew Matthew 2 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #51951
    Avatar
    Steve
    • Topics: 9
    • Replies: 19
    • Posts: 28

    Hello

    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!

    Thanks
    Steve

     

    #51979
    Matthew
    Matthew
    • Topics: 4
    • Replies: 137
    • Posts: 141

    Hi Steve,

    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:

    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.

    Ex2

    #51995
    Avatar
    Steve
    • Topics: 9
    • Replies: 19
    • Posts: 28

    Hi Matthew

    Sort of!

    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 Steve        

    #52011
    Matthew
    Matthew
    • Topics: 4
    • Replies: 137
    • Posts: 141

    Hi Steve,

    As far as i am aware this can’t be done for the type of criteria you are after.

    #52027
    Avatar
    Trevor R
    • Topics: 32
    • Replies: 106
    • Posts: 138

    Hi Steve,

    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[1] and V2, HIGH(1) + 0.1, 0);

    Entry

    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.

    20190325 Steve's Script - Ticket #51995 20190325

    Let’s know if that helps.

    Cheers

    Trevor

    #52035
    Avatar
    Steve
    • Topics: 9
    • Replies: 19
    • Posts: 28

    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?)

     

    Regards
    Steve

     

     

    #52047
    Matthew
    Matthew
    • Topics: 4
    • Replies: 137
    • Posts: 141

    Hi Steve,

    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.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

Pin It on Pinterest

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close