Forums › ProRealTime English forum › ProOrder support › Bollinger Bounce – Tweezer Strategy – Dax 1h › Reply To: Bollinger Bounce – Tweezer Strategy – Dax 1h
02/07/2017 at 7:00 PM
#24258
Ok, Great to have that sorted, but Nicolas, below, what is wrong with the SL/TSL ?
It does not work in live mode..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
DEFPARAM CumulateOrders = False // Cumulating positions deactivated DEFPARAM preloadbars = 150 n = 1 tweezerTop = ABS(High -(High[1]))<= High * 0.0075 tweezerBottom = ABS(Low -(Low[1]))<= Low * 0.0075 bullindicator = OPEN[1] > CLOSE [1] AND OPEN < CLOSE bearindicator = OPEN[1] < CLOSE [1] AND OPEN > CLOSE Boll = 20 Boldown = BollingerDown[Boll](close) Bolup = BollingerUp[Boll](close) BolliLong = (low < Boldown) and tweezerBottom and bullindicator Bolishort = (high > Bolup) and tweezerTop and bearindicator IF NOT LongOnMarket AND BolliLong THEN BUY n CONTRACTS AT MARKET ENDIF // Conditions to enter short positions IF NOT ShortOnMarket and Bolishort THEN SELLSHORT n CONTRACTS AT MARKET ENDIF //trailing stop function trailingstart = 10 //trailing will start @trailinstart points profit trailingstep = 5 //trailing step to move the "stoploss" //reset the stoploss value IF NOT ONMARKET THEN newSL=0 ENDIF //manage long positions IF LONGONMARKET THEN //first move (breakeven) IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN newSL = tradeprice(1)+trailingstep*pipsize ENDIF //next moves IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN newSL = newSL+trailingstep*pipsize ENDIF ENDIF //manage short positions IF SHORTONMARKET THEN //first move (breakeven) IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN newSL = tradeprice(1)-trailingstep*pipsize ENDIF //next moves IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN newSL = newSL-trailingstep*pipsize ENDIF ENDIF //stop order to exit the positions IF newSL>0 THEN SELL AT newSL STOP EXITSHORT AT newSL STOP ENDIF |