Support Board
Date/Time: Sun, 22 Dec 2024 12:11:35 +0000
Post From: ACSIL - How to run part of code only once per bar
[2015-04-20 04:28:43] |
ejtrader - Posts: 688 |
You can try this.. int &lastIndex = sc.GetPersistentInt(0); if (sc.UpdateStartIndex == 0) { lastIndex = -1; } // Place all code that needs to execute all ticks here {......} if (lastIndex == sc.Index) { return; } lastIndex = sc.Index; // Place all code that needs to execute only once per bar below - this would get executed on first tick of each bar {....} Date Time Of Last Edit: 2018-12-13 03:48:54
|