/*[[ Name := CCI Author := Joel Florian Link := none Notes := designed for M1 charts Lots := 1 Stop Loss := 0 Take Profit := 40 Trailing Stop := 0 ]]*/ defines: Slippage(2),cciPeriod(14),MAPeriod(100); var: cnt(0),pos(0),sl(0),tp(0),opentrade(0); If Bars<100 or TakeProfit<10 then Exit; If IsIndirect(Symbol)=TRUE then Exit; If TotalTrades<1 then { opentrade=0; If FreeMargin<1000 then Exit; // not enough money If iCCI(cciPeriod,0) > -100 and icci(cciPeriod,1) <= -100 and PriceBid>ima(MAPeriod,mode_ema,0) then { // calculate Stop Loss sl=Low[Lowest(MODE_LOW,10,10)]; tp=High[Highest(MODE_HIGH,10,10)]; if (tp-Ask)<15 then tp=Ask+15*Point; if (Bid-sl)<15 then sl=Bid-15*Point; SetOrder(OP_BUY,Lots,Ask,Slippage,sl,Ask+TakeProfit*Point,RED); opentrade += 1; Exit; }; If icci(cciPeriod,0) < 100 and icci(cciPeriod,1) >= 100 and Priceask1 and opentrade != 0 then { for cnt = 1 to TotalTrades { if OrderValue(cnt,VAL_SYMBOL) = Symbol then { If icci(cciPeriod,0) > 100 and icci(cciPeriod,1) <= 100 AND OrderValue(cnt,VAL_TYPE) = OP_BUY and PriceBid>ima(MAPeriod,mode_ema,0) then { // calculate Stop Loss sl=Low[Lowest(MODE_LOW,10,10)]; tp=High[Highest(MODE_HIGH,10,10)]; if (tp-Ask)<15 then tp=Ask+15*Point; if (Bid-sl)<15 then sl=Bid-15*Point; SetOrder(OP_BUY,Lots,Ask,Slippage,sl,Ask+TakeProfit*Point,RED); opentrade += 1; Exit; } If icci(cciPeriod,0) < -100 and icci(cciPeriod,1) >= 100 AND OrderValue(cnt,VAL_TYPE) = OP_sell and Priceask