I am learning to code MQL4 (about 3/4 through course on Udemy) and am editing an EA that I use, bit by bit, to add things to it that I do manually now. But I've hit a snag, one that I can't seem to wrap my brain around (though I suspect it's something easy).
I start each day at 6:00 am by changing the "beginning daily balance" in my EA, as I have a daily profit target and my EA closes all trades when it hits that. But I don't want to manually go to 20 charts and put in my daily starting balance. I thought I learned how to get the daily balance by using:
if(Hour() > 6 && Minute() <1)
{
double dailyStartingBalance = AccountBalance();
double GlobalVariableSet(DailyStartingBalance, dailyStartingBalance);
}
You can imagine that this gets me an error about only setting global variables globally.
is there any way to define a global variable within an IF statement?
Thanks,
Pepper...
I start each day at 6:00 am by changing the "beginning daily balance" in my EA, as I have a daily profit target and my EA closes all trades when it hits that. But I don't want to manually go to 20 charts and put in my daily starting balance. I thought I learned how to get the daily balance by using:
if(Hour() > 6 && Minute() <1)
{
double dailyStartingBalance = AccountBalance();
double GlobalVariableSet(DailyStartingBalance, dailyStartingBalance);
}
You can imagine that this gets me an error about only setting global variables globally.
is there any way to define a global variable within an IF statement?
Thanks,
Pepper...