One Buy Per Condition

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #44239 quote
    Qw3rtyQw3rty
    Participant
    New

    Hi,

    How can I limit the number of times a trade occurs based on a set of conditions BUT have multiple orders (CumulateOrders= True)

    Example Using a basic Bollinger Band strategy:

    Enter 1 buy when close < BB low. Even if the next candle closes below the BB low it should not enter another buy. Now I only want to enter another buy, ONLY when the close > BB high and retraces to close < BB low

    This will be a total of 2 cumulative buy orders.

    I have attached a visual example to help explain where I am coming from.

     

    Thank you for the help

    Example.png Example.png
    #44242 quote
    DespairDespair
    Blocked
    Master
    If close crosses under BBlow and not onmarket then
      counter=1
      buy 1 contract at market 
    endif
    if longonmarket and close crosses over then
      counter=counter+1
    endif
    if longonmarket and close crosses under BBlow and counter>1 then
      counter=1
      buy 1 contract at market 
    endif
    

    Here you go… šŸ™‚

    Qw3rty thanked this post
    #44279 quote
    Qw3rtyQw3rty
    Participant
    New

    Thank you so much! This is exactly what I have been after.

    #44287 quote
    DespairDespair
    Blocked
    Master

    Ops, you surely saw that in the second if-loop it should be “…and close crosses over BBhigh then”. I obviously forgot BBhigh.

    #44330 quote
    Qw3rtyQw3rty
    Participant
    New

    Yeah I included that, thanks once again

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

One Buy Per Condition


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Qw3rty @qw3rty Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by Qw3rtyQw3rty
9 years, 1 month ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 08/20/2017
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...