how to get the exit price

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #240164 quote
    oliTRoliTR
    Participant
    Average

    Hello,

    depending on the exit condition it is not rare that the exit price of a position differs from the bar close price when the position get closed.

    (often the exit is made before the last bar ends)

    As it seems that the “exitprice” command doesn’t exist then does anyone know how to get it?

    Many thanks?

    Oli

    #240167 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    exitprice doesn’t exist, as there are other ways to exit a trade:

    • SELL or EXITSHORT to exit a Long or Short trade at market (when a candle closes);
    • SELL AT myExitPrice STOP/LIMIT or EXITSHORT AT myExitPrice STOP/LIMIT if you prefer to exit exactly at a price (use STOP or LIMIT according to where the current price is sitting compared to myExitPrice);
    • using SET STOP PRICE myExitPrice or SET TARGET PRICE myExitPrice.

    Bear that there is no guarantee that the exit price will exactly mirror CLOSE, due to slippage that may occur at anytime.

    Iván González thanked this post
    #240169 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Only post in the language of the forum that you are posting in. For example English only in the English speaking forums and French only in the French speaking forums. Thanks 🙂

    I moved it from the French forum.

    oliTR thanked this post
    #240173 quote
    PeterStPeterSt
    Participant
    Master

    Hi there Oli,

    You can use TradePrice for that.

    Please be aware that TradePrice is given from indeed the last TradePrice. This can also be an Entry. As far as I recall it even can be a lastly set Limit or Stop Price (not Target or StopLoss). Thus in brief, it goes like this :

    If Not OnMarket and OnMarket[1] then
      LastExitPrice = TradePrice
    endif

    Regards,
    Peter

    robertogozzi, oliTR and Iván González thanked this post
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

how to get the exit price


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
oliTR @olitr Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by PeterStPeterSt
1 year, 10 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/09/2024
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...