How to leave orders open when using automated trading

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #156224 quote
    TraderArun
    Participant
    Junior

    Hi,

    During automated trading, an order to open seems to cancel on the next bar if the order is not filled during the current bar. Is there a way where we can leave the order open either 1. indefinitely or 2. until the end of day?

    Thanks

    #156228 quote
    Vonasi
    Moderator
    Master

    Yes set a flag that says your entry conditions have been met and then keep placing the order bar after bar. Not tested.

    if onmarket then 
    flag = 0
    endif
    
    if not onmarket and (your entry conditions) and not flag then
    flag = 1
    entryprice = high
    endif
    
    if flag = 1 then 
    buy 1 contract at entryprice stop
    endif
    
    
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

How to leave orders open when using automated trading


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
TraderArun @traderarun Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Vonasi
5 years, 1 month ago.

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