Hi coder, please help.
I have a "Multi-symbols EA" trading both forex currency (running 24/5) and crypto (running 24/7) pairs. I normally load the EA onto EURUSD D1 chart as the EURUSD is normally the highest volume and most ticks pair. All the entry and exit instructions are written in the OnTick() function.
When comes to weekend (dd==0 || dd==6), the EA loaded chart (EURUSD) does not have any tick, leading to the EA does not function at all.
Knowing that there is a command ChartSetSymbolPeriod (https://docs.mql4.com/chart_operatio...etsymbolperiod) where the user can change Symbol and/or Period.
How to write an instruction in my EA so that :-
if(dd>=1 & dd<=5), the chart symbol will always stick to EURUSD D1 chart during the weekdays :-
if(dd==0 || dd==6), the chart symbol will always stick to BTCUSD D1 chart during the weekends :-
I mean, I need kind coder to provide me a set of instruction codes so that the ChartSymbol (where my EA is loaded on a ChartSymbol) will switch to EURUSD D1 chart during the weekdays automatically, whereas ChartSymbol will switch to BTCUSD D1 chart during the weekends automatically. Thanks
FYI, I need the "instruction / command codes" on Friday before 23:30 (server time) to switch the EA loaded chart to BTCUSD so that there are tick activity during the day 0 or 6.
I have a "Multi-symbols EA" trading both forex currency (running 24/5) and crypto (running 24/7) pairs. I normally load the EA onto EURUSD D1 chart as the EURUSD is normally the highest volume and most ticks pair. All the entry and exit instructions are written in the OnTick() function.
Inserted Code
int dd=TimeDayOfWeek(TimeCurrent()); // 0(Sun),1,2, ... 6(Sat)
When comes to weekend (dd==0 || dd==6), the EA loaded chart (EURUSD) does not have any tick, leading to the EA does not function at all.
Knowing that there is a command ChartSetSymbolPeriod (https://docs.mql4.com/chart_operatio...etsymbolperiod) where the user can change Symbol and/or Period.
How to write an instruction in my EA so that :-
if(dd>=1 & dd<=5), the chart symbol will always stick to EURUSD D1 chart during the weekdays :-
Inserted Code
bool ChartSetSymbolPeriod(0,"EURUSD",1440);
if(dd==0 || dd==6), the chart symbol will always stick to BTCUSD D1 chart during the weekends :-
Inserted Code
bool ChartSetSymbolPeriod(0,"BTCUSD",1440);
I mean, I need kind coder to provide me a set of instruction codes so that the ChartSymbol (where my EA is loaded on a ChartSymbol) will switch to EURUSD D1 chart during the weekdays automatically, whereas ChartSymbol will switch to BTCUSD D1 chart during the weekends automatically. Thanks
FYI, I need the "instruction / command codes" on Friday before 23:30 (server time) to switch the EA loaded chart to BTCUSD so that there are tick activity during the day 0 or 6.