Author of the Idea: Vasiliy
MQ5 Code Author: barabashkakvn
The FT CCI MA Expert Advisor (EA) harnesses the power of the iCCI (Commodity Channel Index) and iMA (Moving Average) indicators to help you make informed trading decisions.
When the Moving Average indicates an upward trend, the iCCI signals you to buy when it hits -100 and to sell at 200!
Conversely, if the Moving Average is on a downward trend, look for buying opportunities at 100 and selling at -200!
This setup significantly reduces the chances of making “wrong” trades during strong market movements, allowing the EA to capitalize on the remaining trends.
You also have the option to set a specific trading time window. The Use Time Interval parameter lets you enable or disable trading within a defined timeframe, set between the Start Hour and End Hour. You can customize this both for intraday trading and for transitions that cross over to the next day. Here’s a snippet from the time interval function:
//+------------------------------------------------------------------+ //| TimeControl | //+------------------------------------------------------------------+ bool TimeControl(void) { MqlDateTime STimeCurrent; datetime time_current=TimeCurrent(); if(time_current==D'1970.01.01 00:00') return(false); TimeToStruct(time_current,STimeCurrent); if(InpStartHour<InpEndHour) // intraday time interval { /* Example: input uchar InpStartHour = 5; // Start hour input uchar InpEndHour = 10; // End hour 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 _ _ _ _ _ + + + + + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + + + + + _ _ _ _ _ _ */ if(STimeCurrent.hour>=InpStartHour && STimeCurrent.hour<InpEndHour) return(true); } else if(InpStartHour>InpEndHour) // time interval with the transition in a day { /* Example: input uchar InpStartHour = 10; // Start hour input uchar InpEndHour = 5; // End hour 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 _ _ _ _ _ _ _ _ _ _ + + + + + + + + + + + + + + + + + + + _ _ _ _ _ + + + + + + */ if(STimeCurrent.hour>=InpStartHour || STimeCurrent.hour<InpEndHour) return(true); } else return(false); //--- return(false); }

Comments 0