Hello everyone,
I have an EA which trade once a week. In order to further develop and improve the capabilities, i want to make the EA trade only once a month. I've tried:
if(DayOfYear()==245) return(true);
1 until 365 days. But if the year only has 364 days, the EA will not trade on the specific time. Which is not my strategy.
Any help is highly appreciated.
Here is the code used to make the EA trade only once a week.
bool GetOnTrade()
{
bool CanTrade;
if (OnTrade)
{
if (TimeHour(TimeCurrent())>=StartHour && TimeHour(TimeCurrent())<EndHour) CanTrade=true;
else CanTrade = false;
}
else CanTrade = false;
if (!MondayTrade && DayOfWeek()==1) CanTrade = false;
if (!TuesdayTrade && DayOfWeek()==2) CanTrade = false;
if (!WednesdayTrade && DayOfWeek()==3) CanTrade = false;
if (!ThursdayTrade && DayOfWeek()==4) CanTrade = false;
if (!FridayTrade && DayOfWeek()==5) CanTrade = false;
return (CanTrade);
- #2
- Sep 11, 2012 2:54pm Sep 11, 2012 2:54pm
- Joined Sep 2009 | Status: Making Code While Making Pips | 1,672 Posts
- #4
- Sep 12, 2012 2:50pm Sep 12, 2012 2:50pm
- Joined Sep 2009 | Status: Making Code While Making Pips | 1,672 Posts