Maybe somebody has already done this, but I'm trying to determine how many bars have passed since a trade has been opened. I'm trying to think about ways of counting the bars that have passed (let's say on the M15) as opposed to finding out how many seconds old it is.
I know one way of doing it would be to get the time of the open trade from selecting it, and subtracting it from the current time. Maybe dividing the result by the time period?
trade age bar count
- milanese
- TechAdmin
- Posts: 3293
- Joined: Wed Jan 09, 2013 9:02 am
- Location: btr rdx, r8 +
trade age bar count
this will give you the result:Rio » Tue May 13, 2014 3:15 am wrote:Maybe somebody has already done this, but I'm trying to determine how many bars have passed since a trade has been opened. I'm trying to think about ways of counting the bars that have passed (let's say on the M15) as opposed to finding out how many seconds old it is.
I know one way of doing it would be to get the time of the open trade from selecting it, and subtracting it from the current time. Maybe dividing the result by the time period?
Code: Select all
double BarsAfterOpen=iBarShift(NULL,Period(),OrderOpenTime(),false);Tommaso
Global Prime is the official SHF broker 
Searching for Servers and Workstations with individual configuration?
Just PM
Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
Searching for Servers and Workstations with individual configuration?
Just PM
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
-
phil_trade
trade age bar count
What is great with Tomamaso, is you don't have even think about your question...he already have the answermilanese » 7 minutes ago wrote:this will give you the result:Rio » Tue May 13, 2014 3:15 am wrote:Maybe somebody has already done this, but I'm trying to determine how many bars have passed since a trade has been opened. I'm trying to think about ways of counting the bars that have passed (let's say on the M15) as opposed to finding out how many seconds old it is.
I know one way of doing it would be to get the time of the open trade from selecting it, and subtracting it from the current time. Maybe dividing the result by the time period?CheersCode: Select all
double BarsAfterOpen=iBarShift(NULL,Period(),OrderOpenTime(),false);
Tommaso