Help with code for only one trade at a time

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #14861 quote
    peterdukpeterduk
    Participant
    New

    Hi, Is it possible to input a line of code so that a new trade does not execute if there is already a trade open on the instrument? I am finding in testing on shorter timeframe charts such as 1 minute or 2 minute if stops are set quite wide, trades are not lasting their full course due to new trades executing.  Any help would be appreciated. Many thanks.

    #14863 quote
    StefStef
    Participant
    Average
    defparam cumulateorders=false

    or you can test if you have an open position with one of these

    if not onmarket and <rest of your conditions>
    or...
    if not shortonmarket and <rest of your conditions>
    or...
    if not longonmarket and <rest of your conditions>
    Nicolas and Bel thanked this post
    #14889 quote
    peterdukpeterduk
    Participant
    New

    Thanks Stef, that’s a great help.

Viewing 3 posts - 1 through 3 (of 3 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

Help with code for only one trade at a time


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
peterduk @peterduk Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by peterdukpeterduk
9 years, 11 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 10/13/2016
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...