Set price to buy

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #113524 quote
    AE
    Participant
    Senior

    Hi folks!

    I would like to know if there is any way to set a price to buy using the last positionprice of my last operation.

    Example:

    Step 1. Strategy condition is met and buy DAX at 13.200. Set TP at 13.230

    Step 2. DAX move up to 13.230 so it closed the position

    Step 3. Create a new order limit to buy at last positionprice (13.200)

    Thanks

    #114285 quote
    GraHal
    Participant
    Master

    Yes use TRADEPRICE(1)

    https://www.prorealcode.com/documentation/tradeprice/

    However, reading the link above confused me a bit … to use your example …

    IS

    TRADEPRICE(1) =  13.230 (exit order)

    AND

    TRADEPRICE(2) =  13.200 (entry order)

    I’m sure some helpful member will spot this post and clarify for us?

    #114286 quote
    Vonasi
    Moderator
    Master

    Yes TRADEPRICE is the last order price (or last Nth order price) so if the last order was an exit that is what TRADEPRICE will be so this does not work for position price.

    You need to record POSITIONPRICE at the close of each bar.

    if onmarket then
    lastprice = positionprice
    endif
    

    Then you can buy at that price using a pending order.

    GraHal and AE thanked this post
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Set price to buy


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
AE @alberto_aguilera Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/25/2019
Status: Active
Attachments: No files
Logo Logo
Loading...