Two limit orders to close position

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #74845 quote
    Vonasi
    Moderator
    Master

    I’ve written a strategy and when it opens a position with a limit order it sets two limit orders to sell the complete position at medianprice and high and repeats them until the position is closed.

    Sell 1 contract at MedianPrice limit
    Sell 1 contract at high limit

    I get great results (too good to be true!) but I noticed that they are different depending upon which order I place the limit orders in. At first I thought it was because maybe you can only have one limit order and so it ignores the first one but checking the trades this does not seem to be the case. I tested each limit order on its own and the results are totally different to the combined limit orders so it can’t be that.

    Here is the equity curve with the median price limit first in the code followed by the high limit:

    [attachment file=”MedianPrice First.png”]

    …and here is the same code with the high limit listed first:

    [attachment file=”high limit first.png”]

    ….and the median price limit on its own:

    [attachment file=”Just medianPrice limit.png”]

    ….and the high limit on its own:

    [attachment file=”Just high limit.png”]

    The entry is at a low price and so should always be below the last bars median price and high so I am a bit confused by the results. I do get a lot of zero bar exits (entry and exit in the same bar) but these appear to be valid when the candles are checked – and yes I do have tick by tick turned on.

    Any suggestions what is going on.

    MedianPrice-First.png MedianPrice-First.png high-limit-first.png high-limit-first.png Just-medianPrice-limit.png Just-medianPrice-limit.png Just-high-limit.png Just-high-limit.png
    #74851 quote
    Vonasi
    Moderator
    Master

    Here is an image confirming that it is using both limit orders. I would expect it to always hit the previous bars median price limit first but sometimes it does and sometimes it ignores it and closes at the level of the previous bars high.

    [attachment file=74852]

    Screenshot_5-8.png Screenshot_5-8.png
    #74885 quote
    Madrosat
    Participant
    Master

    Vonassi

    What do you mean by ” these appear to be valid when the candles are checked ” for me all my backtests with entrance and exit on  same candle are false??

    #74890 quote
    Vonasi
    Moderator
    Master

    What do you mean by ” these appear to be valid when the candles are checked ” for me all my backtests with entrance and exit on  same candle are false??

    They should not be false if tick by tick data is used. If tick by tick is not selected then yes any strategy that has intra-bar opening and closing will give false results. Before tick by tick was available in PRT this was a major source of people thinking that they had great results when in fact they didn’t.

    #74893 quote
    Vonasi
    Moderator
    Master

    My original intention was to have partial closure at the last bars median price and then full closure at the last bars high but I found when optimizing that I got the wonderful equity curves with full closure at either median price or high but only if both limits were in the code. Then I realised that it should always hit the median price limit first and so something was not right. While testing each limit I then noticed that the results changed depending upon the order in which they are put in the code. So I then looked at the candles and noticed that sometimes the median price limit is completely ignored as price moves through it and at other times it is not. It is almost as if it is random as to which limit order is put on the market – either that or the tick by tick data is flawed or the tick by tick test is not carried out correctly.

    If a reason cannot be given here then I will send a report to PRT and post something in the support forum pointing to this topic.

    #74895 quote
    GraHal
    Participant
    Master

    for me all my backtests with entrance and exit on  same candle are false??

    You mean – up to this point – you thought they were false??

    If you go back through a trade with a tick chart then you can check what is happening. This is how I discovered – nearly 3 years ago – that the zero bars garbage that PRT Platform was allowing us – during backtest and before tick by tick mode was available  – to think we could be millionaires! 🙂

    #74971 quote
    Madrosat
    Participant
    Master

    I repeat all backtest with entrance and exit on the same candle are false

    see one example on graph   with tick by tick coché

     

    May be with the multitime frame they will be right ???

    Graph-30-6.png Graph-30-6.png
    #74975 quote
    Vonasi
    Moderator
    Master

    I repeat all backtest with entrance and exit on the same candle are false

    When was that test carried out? If during this weekend then you might want to read this post that I put in the support forum yesterday – I think I worked out my own answer:

    Tick by tick not working correctly.

    #75046 quote
    Madrosat
    Participant
    Master

    this morning 2 false trades Iin backtest

    tick by tick coché and exit on set target pprofit

    Why???

    graph-02-7.png graph-02-7.png
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.

Two limit orders to close position


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Vonasi @vonasi Moderator
Summary

This topic contains 8 replies,
has 3 voices, and was last updated by Madrosat
7 years, 8 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 06/29/2018
Status: Active
Attachments: 7 files
Logo Logo
Loading...