gpt-3.5-turbo-0613· OpenAI
WildChat-4.8M (AI2)
Can you prepare in mql5 language script the expert advisor with CCI indicator?
- User
Can you prepare in mql5 language script the expert advisor with CCI indicator?
- Assistant
Certainly! Below is an expert advisor script written in MQL5 language that uses the Commodity Channel Index (CCI) indicator:
//+------------------------------------------------------------------+ //| CCI Expert Advisor | //| Copyright © 2021 MyCompany | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright © 2021 MyCompany" #property link "https://www.mql5.com" #property version "1.00" // Input parameters input int period = 14; // CCI calculation period input int threshold = 100; // CCI threshold for trade entry //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void OnTick() { // Check the CCI value double cci = iCCI(Symbol(), PERIOD_CURRENT, period, PRICE_TYPICAL, 0); // Buy signal: CCI crosses above the threshold if (cci > threshold && iCCI(Symbol(), PERIOD_CURRENT, period, PRICE_TYPICAL, 1) <= threshold) { // Place a buy trade // Add your trade execution logic here } // Sell signal: CCI crosses below the threshold if (cci < -threshold && iCCI(Symbol(), PERIOD_CURRENT, period, PRICE_TYPICAL, 1) >= -threshold) { // Place a sell trade // Add your trade execution logic here } }
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.