So Exit_MA_Shift should equal the number of candles that have elapsed since the first trade was opened.
It seems to work, except when it goes over the weekend. Does anyone have an idea how I can exclude the time over the weekend from the candle calculation, and know when to do it.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I have some code that depends on the number of candles that have elapsed since a trade was opened.
I set a global variable when a position is opened
First_Pos_time=Time[0];
Then when the next position is opened i calculate the number of candles that have elapsed by
Exit_MA_Shift= MathRound((Time[0]-First_Pos_time)/60/Time_Frame);
where Time_Frame=15 for a 15 minute chart.
So Exit_MA_Shift should equal the number of candles that have elapsed since the first trade was opened.
It seems to work, except when it goes over the weekend. Does anyone have an idea how I can exclude the time over the weekend from the candle calculation, and know when to do it.
Thanks
surveyman