ProOrder backtest opens trade late

Forums ProRealTime English forum ProOrder support ProOrder backtest opens trade late

Viewing 15 posts - 1 through 15 (of 18 total)
  • #58690

    Hello, I’m BackTesting with some Exponential moving averages, and the backtest often opens a trade a candle or 2 after the first candle after the EMA cross. Making the results inaccurate. Using a slightly faster EMA to compensate is what I’ve been doing, but that creates other problems.

    My code is very basic and is just calculating EMA on the close of the candle, and so is my indicator on the chart. So nothing wrong there.

    Attached is an example.

    Any ideas on how to fix this?

     

    #58695

    If you actually just have the 2 averages that constitute your signal we might be able to see exactly what you are describing but with 4 averages i am clueless to what you are actually describing   ? Ambiguity isnt helping here , Clarity makes it much easier  …

    #58698

    You should post your complete code for anyone to be of help.

    Roberto

    #58705
    1. A cross between 2 lines is confirmed at Close
    2. Code is read at Close and orders are launched at next bar Open

     

    #58709
    1. A cross between 2 lines is confirmed at Close
    2. Code is read at Close and orders are launched at next bar Open

    which in effect is a lag of what really should be 1 tick .

    a signal during bar is useless thats why it is done this way  ,  only once a bar is complete can a signal truly be verified

    #58778

    Hi, here’s my code.  It’s very basic, so hopefully theres nothing wrong there.

     

    #58780

    Sorry, I thought circling the only cross near the backtest order would be clear enough.

    #58781

    So to get ProOrder to execute when I want it, should I change by indicator/code to calculate on the open instead of the close? Because when I do so, it still opens the trade ‘late’.

     

    The pictures attachted are with the code calculating the EMA on ‘open’ instead of ‘close’

    #58782

    You need to move your set stop %loss 0.5 down to the last line of code. Code is read from top to bottom at the close of each candle and so you will have to wait for a candle to pass after opening trades before it is read. At the bottom below the buy/sells it will put an order to the market just after buying or selling.

    #58785

    Thanks I’ve moved the stop loss to the bottom. Is there anyway to get my code to execute when I want it too? i.e. open of first candle after EMA cross

    #58798

    No all decisions are made at the close of a candle and new position are opened at the open of the next – so be aware of markets with big gaps!

    The only way to open a position mid candle is to set market stop and limit orders at a chosen price but these orders will once again not be placed until the current candle has closed.

    #58805

    So, I guess I have to use a faster EMA in the ProOrder code, which is annoying since it stops me from being able to fully trust the data.

    #58812

    If PRT was able to check for MA crosses mid candle then I think that you would get many false signals anyway when markets are going sideways.

    #58813

    I get that, but in my case I dont want to open mid candle as soon as the EMAs cross, I want to open on the open of the first candle after the cross happens. This works fine in real time trading since the EMAs move, visually, on the open of a new candle(even if counting from ‘close’) but it backtesting they work differently it seems.

    #58814

    I dont want to open mid candle as soon as the EMAs cross, I want to open on the open of the first candle after the cross happens.

    When a candle closes PRT will just check that a cross has occurred at that point in time (I guess it just compares the MA positions from this close to the previous close). It then opens a position at the next open. So it is doing what you want. I have to confess that I am struggling to see the problem at the moment 🙂

Viewing 15 posts - 1 through 15 (of 18 total)

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