Bollinger Band Strategy – Help in coding

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #5693 quote
    bewise
    Participant
    New

    Dear forum experts,
    I am trying to trade 30min, using the bollinger band. Any spikes above the bollinger to take a reversal trade on the same bar, both on the long and short side. Can someone help me see what’s wrong with my code (below)? The backtest does not show the trades according to my thought process. Sometimes it opens where I see the price overshoots the bollinger, and sometimes it does not open a trade where I see the spike. Ideally, this strategy uses the same (current) bar to get the signal and to open the trade but not the next open bar. Appreciate any help here. Tks.

    —————————————————————————————————————

    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    Boll = 20
    
    // Conditions to enter long positions
    indicator1 = high
    indicator2 = BollingerDown[Boll](close)
    c1 = (indicator1 < indicator2)
    
    IF c1 THEN
    BUY 1 CONTRACT AT MARKET
    
    
    Endif
    
    // Conditions to enter short positions
    indicator5 = close
    indicator6 = BollingerUp[Boll](close)
    c3 = (indicator5 > indicator6)
    
    IF c3 THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    
    // Stops and targets
    SET TARGET $PROFIT 1
    
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.

Bollinger Band Strategy – Help in coding


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
bewise @bewise Participant
Summary

This topic contains 1 voice and has 0 replies.

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