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