Buying at the second Boll band violation

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #209524 quote
    Gaby
    Participant
    Average

    Hello,

    I would like to code a buy entry when the close is lower the low Bollinger band for two consecutive periods. I have coded this, but it not working; I appreciate any help, Thanks. Gaby

     

    // Definition of code parameters
    DEFPARAM CumulateOrders = False
    Once COUNT = 0

    // variables ===================================

    LowBoll = Average[20](close)- (3*std[20](close))

    // conditions ====================================

    c1 = close < LowBoll

    IF NOT onmarket AND c1 AND COUNT = 0 THEN
    COUNT = 1

    ELSIF NOT onmarket AND c1 AND COUNT =1 THEN
    BUY 1 PERPOINT AT MARKET
    COUNT = 0

    ENDIF

    #209527 quote
    Gaby
    Participant
    Average

    This version of the code seems to work, you can ignore my previous request:

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    Once COUNT = 0
    
    // variables ===================================
    
    LowBoll = Average[20](close)- (3*std[20](close))
    //LowerTail = min(open,close) - low
    
    // conditions ====================================
    
    c0 = close > Lowboll
    
    If c0 THEN
    COUNT = 0
    ENDIF
    
    c1 = close < LowBoll
    //c2 = Lowertail > 12
    
    IF NOT onmarket AND c1 AND COUNT = 0 THEN
    COUNT = 1
    
    ELSIF NOT onmarket AND c1 AND COUNT = 1 THEN
    BUY 1 PERPOINT AT MARKET
    COUNT = 0
    
    ENDIF
    
    IF LONGonmarket THEN //and BARINDEX-TRADEINDEX(1) = 0 then
    SELL AT MARKET
    ENDIF
    Nicolas thanked this post
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

Buying at the second Boll band violation


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Gaby @gaby Participant
Summary

This topic contains 1 reply,
has 1 voice, and was last updated by Gaby
3 years, 7 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/10/2023
Status: Active
Attachments: No files
Logo Logo
Loading...