I have a strategy in which the entries are confirmed on the close on the bar and stop loss breaches/profit target reaches are confirmed in real time. What I need to do is have part of my code run on the close of the bar and the rest of it in real time. Anyone have any ideas as to how I would go about doing this? I need to be able to do this on a chart that runs in minutes, not in ticks.
Announcement
Collapse
No announcement yet.
onClose and real time strategies
Collapse
X
-
naifwonder
To accomplish that you would need to enclose inside a BARSTATE_NEWBAR statement the section of code that needs to be run on completed bars only. For a specific explanation of BARSTATE you may want to go through the Tutorial 4: Understanding Bar State and Bar Indexing
Alex
Comment