Why are these buy/sell prices not matching up?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #94317 quote
    deletedaccount06012021
    Participant
    New

    Hi everyone:

    See attached from an AUDNZD currency chart.

    The buy price, which is “TradePrice”, is graphed at 1.04910; the blue arrows indicating the entry show it at over 1.0520. When I run the backtest, I do NOT have the “Spread” option checked (enabled).

    It’s similar for the sell as well.

    Here is the relevant code. This is the only place in the code where the value for theBuyTradePrice is set and also the only place in the code where the values are graphed:

    BUY 1 SHARES AT MARKET
    theBuyTradePrice = TradePrice
    GRAPHONPRICE theBuyTradePrice as "theBuyTradePrice"

    So why is there such a discrepancy?

    Thank you.

    buyandsellprices.jpg buyandsellprices.jpg
    #94320 quote
    Nicolas
    Keymaster
    Master

    Code is read at Close, and orders are launched at next open, it means that at the time when the code is read, we have no hint of what would be the exact open price, you’ll have to wait for the order to be launched for that.. (next bar!).

    thanked this post
    #94321 quote
    deletedaccount06012021
    Participant
    New

    I understand orders are executed at the next bar.

    So then:

    1) the “tradeprice” should be the same “open” price of the next bar if the orders are executed on the next open, correct?

    2) to get the actual price, we have to set a flag to let us know when the next bar comes around. Then, when that next bar does come around, we can do “tradeprice” to get the exact price from the order in the code executed from the previous bar’s close?

    3) Or is there an easier/better way to do #2 above?

    THank you.

    #94362 quote
    Nicolas
    Keymaster
    Master

    1.yes

    2.yes

    3.not really,  you could try with MTF instruction to get the tradeprice faster with a lower timeframe.

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

Why are these buy/sell prices not matching up?


ProOrder: Automated Strategies & Backtesting

New Reply
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/21/2019
Status: Active
Attachments: 1 files
Logo Logo
Loading...