how to set target and stop for backtesting?

Forums ProRealTime English forum ProOrder support how to set target and stop for backtesting?

Viewing 13 posts - 1 through 13 (of 13 total)
  • #106570

    Hello,
    I try to backtest a strategy in a tickchart. Everytime the a bullish candle crosses the bullish sma50 with the opening below the sma 50 and the close above the sma20, or a bearish candle crosses the bearish sma5o with the opening above the sma 50 and the close below the sma20, I want to buy 1 contract with a target from 5 and a stoploss from 2
    This is what I have created, but I see in the output of the backtest that something isn’t right. I see profits and losses far above my presets.
    Thank you, Marc

     

    #106571

    Please use the ProOrder forum for automated trading related question, and the ‘insert code button’ to add a embed a code in a post.

    If you want to use takeprofit and stoploss values in points, you should use the pprofit and ploss instruction instead:

     

    #106576

    Thanks Nicolas,

    I will in the future. I was doubting where to post this, because I had problems with the coding.
    I was already looking for a way to embed the code.
    Thanks again, Marc

    #106579

    Hi again, I still have strange losses and profits in my backtest list. If 1 point = $50,- then the max of my loss will be constantly $100,- and my profits will be always $250,-
    Now I have variable profits and losses.

    I want to check how often the strategy as described above reaches the target or the stop.

    So I guess there is something else I didn’t do right.

    Thanks, Marc

     

    #106586

    @Malend … you may like to consider attached … it’s your code but on DAX 5M over 10k bars with spread = 2

    #106590

    Thanks a lot Grahal,
    I am gonna check it out right now.
    Marc

    #106591

    So I guess there is something else I didn’t do right.

    Try below as the 1st line of code

     

    #106599

    Thanks Graham,

    Makes definitely sense.
    I also see some bugs in my strategy definitions and what happens when I am in a buy postion and a sell signal shows up.

    Work for me to do. Great.

    Thanks a lot, again. Marc

    1 user thanked author for this post.
    #106600

    Be good to share any improvements please?

    I have the version I posted above running in Demo Forward Test.

    #106649

    It works Graham, I am testing it also with other backtest variations.

     

    #106650

    The only thing I would like to have is that when I am in an a position that the TA or the SL stops that position, and not a start from a new postion the other direction. It can open a new position, but better for me would be to have only one psotion open.

    #106656

    but better for me would be to have only one psotion open.

    Which version / code are you referring to … your original code, my version or some new version of yours?

    Always best to post the code then others may spot the reason for your Issue.

    Also if you have optimised a lot of variables then it is very useful to post the .itf with the optimiser already set up with variable names, range and steps … as I did in the .itf I posted above to help you.  Makes it easier / quicker for folks to help and improve further.

    Cheers

    1 user thanked author for this post.
    #106677

    Thanks Graham for your feedback how to use this platform. I will post my latest update today with the questions and when itb works in the end.

     

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

Create your free account now and post your request to benefit from the help of the community
Register or Login