How to leave orders open when using automated trading

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #156224 quote
    TraderArunTraderArun
    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
    VonasiVonasi
    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.
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 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 VonasiVonasi
5 years, 9 months ago.

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