Author: Mohammad Soubra
The Commodity Channel Index, or CCI, is a fantastic tool for traders in the financial markets, including forex. Keep in mind that the example shared here is primarily for coding purposes and not meant to serve as a profitable trading system.
Here’s how the CCI can be utilized to open buy and sell orders based on the typical price:
double CCI_Typical_Curr=iCCI(NULL,0,CCIPeriod,PRICE_TYPICAL,0); double CCI_Typical_Prev=iCCI(NULL,0,CCIPeriod,PRICE_TYPICAL,1); // Buy order ruleif((CCI_Typical_Prev<-90) && CCI_Typical_Curr>-80) // Sell order ruleif((CCI_Typical_Prev>90) && (CCI_Typical_Curr<80))
With these rules, you can pinpoint some excellent entry points, as demonstrated below:
inputstring separator1="--------------- TRADES OPTIONS ---------------";//TRADING INPUTSinputint TradesDuplicator=3;//How many times to duplicate tradesinputdouble Lots=0.03;//Standard Lot Sizeinputint MagicNumber=1982;//ID for tradesinputdouble StopLoss=50;//Set Stop Lossinputdouble TakeProfit=200;//Set Take Profitinputint TrailingStop=50;//Trailing Stopinputint Slippage=3; inputstring separator2="--------------- CCI OPTIONS ---------------";//CCI SETTINGSinputint CCIPeriod=9;//CCI Calculation Periodinputstring separator3="--------------- ON CHART COLORS ---------------";//TRADE ARROW COLORSinputcolor BuyArrowOpen=clrBlue;//Color for Buy Arrowsinputcolor SellArrowOpen=clrRed;//Color for Sell Arrowsinputcolor ModificationArrow=clrWhite;//Color for Modified Trades


Important Notes:
- This code is intended as a demonstration for our community library and should not be used for live trading.
- Feel free to tweak or modify the code as you see fit, whether it's you, me, or another coder!
- Happy Trading!

Comments 0