How to open/close trade using time

 
How to close/open  trade using time..... Please give any hint or references....

int bars = iBars(_Symbol, PERIOD_CURRENT); for (int i=0; i<bars && i<20; i++) { }
 
vilas korke:
How to close/open  trade using time..... Please give any hint or references....

int bars = iBars(_Symbol, PERIOD_CURRENT); for (int i=0; i<bars && i<20; i++) { }

https://docs.mql4.com/constants/structures/mqldatetime

Structure of the Date Type - Data Structures - Constants, Enumerations and Structures - MQL4 Reference
Structure of the Date Type - Data Structures - Constants, Enumerations and Structures - MQL4 Reference
  • docs.mql4.com
Structure of the Date Type - Data Structures - Constants, Enumerations and Structures - MQL4 Reference
 
vilas korke:
How to close/open  trade using time..... Please give any hint or references....

int bars = iBars(_Symbol, PERIOD_CURRENT); for (int i=0; i<bars && i<20; i++) { }
  1. Your code has nothing to do with time. It just iterates over all bars. No need for the function call in MT4, just use Bars.
  2. Get the current time and check.
              Find bar of the same time one day ago - Simple Trading Strategies - MQL4 programming forum
 
William Roeder:
  1. Your code has nothing to do with time. It just iterates over all bars. No need for the function call in MT4, just use Bars.
  2. Get the current time and check.
              Find bar of the same time one day ago - Simple Trading Strategies - MQL4 programming forum
Thanks... Sir for your guidance. 
Reason: