Strange results for variables

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #165038 quote
    reppy123
    Participant
    New

    Hi,

    I noticed some strange results for indicators that are used in my pro order code.

    I have now created a very simple example to show the issue. Of course, the real code that I want to use is different and the following example doesn’t make any sense, but it clearly shows the issue:

    test = close * 100
    IF date = 20210308 THEN
    BUY test CONTRACTS AT MARKET
    ENDIF

    If I run this example in the German DAX in 1-day-chart, I get the results shown in the scrrenshot below.

    The close (displayed as “Schluss” in the screenshot) is 14,391.7, so with the code above, 1,439,170 contracts should be bought. I don’t know why, but only 1,409,430 contracts are bought. This means, the value for close must have been 14,094.3 and not 14,391.7.

    Do you have an idea what happens here and how to fix it?

    PRT_Test.jpg PRT_Test.jpg
    #165042 quote
    GraHal
    Participant
    Master

    Partial fill due to market not able to supply full fill?

    #165044 quote
    reppy123
    Participant
    New

    No, there is no limit for the number of contracts you buy. You can buy 10 million contracts. If you do so, you will probably be bankrupt a few seconds later, but the buy order is fulfilled.

    I used the “buy test contracts” only to get the value of the variable.

    #165047 quote
    JC_Bywan
    Moderator
    Master

    Proorder code read at end of a candle, order sent to be executed as soon as the following tick, which is the beginning of next candle, if the candle you’re looking at is the one when the buy order was executed, then you need to watch the close of the previous candle to check test

    #165048 quote
    JC_Bywan
    Moderator
    Master

    (“date” being the date of close of candle, which in a 24h market is not the same date as the open of the candle “opendate”)

    #165051 quote
    reppy123
    Participant
    New

    I understand. But close should be the closing price of a day if you use the 1 day time frame. In the example above, the value for close must have been 14,094.3 which was never a closing price in the 1 day chart.

    #165052 quote
    JC_Bywan
    Moderator
    Master

    Your graph seems to go from march 5 to march 8, so it seems to be with custom time settings (not displaying sunday’s). Proorder is server side and doesn’t use the custom settings, only probuilder on individual pc does. There is a close at 14094.3 on sunday March 7, opendate 20210307, date 20210308

    reppy123 thanked this post
    CaptureDaxSundayMarch7.png CaptureDaxSundayMarch7.png
    #165057 quote
    reppy123
    Participant
    New

    Aaah, very interesting. I will check the local time settings.

    Many thanks!

    #165058 quote
    robertogozzi
    Moderator
    Master

    It’s must be due to the fact that the order was placed at the closing of the Friday bar, while the trade was entered at the beginning of the Monday bars and there was a gap.

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

Strange results for variables


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
reppy123 @reppy123 Participant
Summary

This topic contains 8 replies,
has 4 voices, and was last updated by robertogozzi
4 years, 11 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/23/2021
Status: Active
Attachments: 2 files
Logo Logo
Loading...