Code for Extended limit orders (more than one bar)

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #68225 quote
    Jan
    Participant
    Veteran

    Hi all,

    could not find the answer here around, that’s why I  made a new topic :

     

    If close > close[1] then
    
    BUY 3 shares AT Lowest[5](low) limit
    
    endif

     

    The command BUY 3 shares AT Lowest[5](low) limit :  gives a limit buy order each time a bar close, defined as the minimum/lowest value of the last 5 closed bars;

    as long as the condition  close > close[1]  is true, the minimum value is recalculated after each bar close.

    Two questions:

    1. can the inital limit order be valid for more than one bar ? If yes, what is the PRT-code?
    2. can the initial minimal value be fixed in the code (not being recalculated after a bar) ?  If yes, how to code it in  PRT ? (with help of barindex – tradeindex or ??)

    Thanks in advance for your help !

    Kind regards, Jan

    #68227 quote
    robertogozzi
    Moderator
    Master

    1 – No, pending Limit/Stop orders expire after one bar and need to be placed again and again as conditions are still met

    2 – You need to save that value and not let it be recalculated each new candle (but you will have to, sooner or later, recalculate it, maybe after some bars or at the beginning of a new day)

    ONCE EntryPrice = 0
    IF close > close[1] AND EntryPrice = 0 THEN
       EntryPrice = Lowest[5](low)
    ENDIF
    BUY 3 shares AT EntryPrice limit
    
    Nicolas thanked this post
    #75897 quote
    Jan
    Participant
    Veteran

    Using limit orders for more than one bar is also clearly described at the PRT  Trading programming Help manual,   https://www.prorealtime.com/en/pdf/probacktest.pdf   at page 11.

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

Code for Extended limit orders (more than one bar)


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Jan @janwd Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Jan
7 years, 7 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/12/2018
Status: Active
Attachments: No files
Logo Logo
Loading...