Hello
How can I induce a delay of 1 second in my indicator
Under a given condition, I need to let time to other indicator to respond from a global variable command
Martin
Is there a way to induce a delay in an indicator [SOLVED]
Re: Is there a way to induce a delay in an indicator
How can I induce a delay of 1 second in my indicator
Code: Select all
DEFINEDLLFUNC: ThreadSafe, "Kernel32.dll", void, "Sleep", dword;
Sleep(1000);
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Is there a way to induce a delay in an indicator
Nice.How can I induce a delay of 1 second in my indicatorCode: Select all
DEFINEDLLFUNC: ThreadSafe, "Kernel32.dll", void, "Sleep", dword;
Sleep(1000);
Is every indicator in MultiCharts running on a different thread? (As this code implies)
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Is there a way to induce a delay in an indicator
1 chart window = 1 calculation thread for all studies on this chart.Is every indicator in MultiCharts running on a different thread? (As this code implies)
Re: Is there a way to induce a delay in an indicator
If I understood Henry correctly, it confirms my understanding (from my tests) that all studies within a chart are executed in alphabetical order and this is done very quickly since they are all stored in memory. At the same time all the studies in chart #1 will be randomly executed before or after all the studies in chart #2, chart #3, etc. Okay so I have had situations where I had a series of up to 6 studies processing data (in addition to an external program also doing some processing) and these studies were scattered across two charts (1 minute bars and 10 second bars). For this reason I used a control GV which started at value zero and was incremented as each study finished the processing. Each successive study will not execute until that GV is set to the value it is looking for and once that study is finished the processing it increments the value of the GV. I believe this is the only way to handle a situation where you have multiple studies doing the work scattered across charts (including scattered across other programs).
Re: Is there a way to induce a delay in an indicator
Question to MC team related to process execution
Is it faster or using less memory to have a single big indicator that contain all process to be done or have a separated indicator for each operation
Martin
Is it faster or using less memory to have a single big indicator that contain all process to be done or have a separated indicator for each operation
Martin
Re: Is there a way to induce a delay in an indicator
I'm using a similar approach, but not for the same reason. I'm using a handshake protocol where the slave wrote to GV that the process is over. The master will process the data only after verifying that the slave has put the message that the operation is complete. Once process, the master will erase the completed message in GV. The slave won't put new process result before he seen that the data has been read by the masterIf I understood Henry correctly, it confirms my understanding (from my tests) that all studies within a chart are executed in alphabetical order and this is done very quickly since they are all stored in memory. At the same time all the studies in chart #1 will be randomly executed before or after all the studies in chart #2, chart #3, etc. Okay so I have had situations where I had a series of up to 6 studies processing data (in addition to an external program also doing some processing) and these studies were scattered across two charts (1 minute bars and 10 second bars). For this reason I used a control GV which started at value zero and was incremented as each study finished the processing. Each successive study will not execute until that GV is set to the value it is looking for and once that study is finished the processing it increments the value of the GV. I believe this is the only way to handle a situation where you have multiple studies doing the work scattered across charts (including scattered across other programs).
Using this, I'm insuring that either the master and slave are in sync.
Martin
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Is there a way to induce a delay in an indicator
Fewer indicators use less memory. But the more code you have inside one indicator - the more difficult it is to design, understand and debug the code.Question to MC team related to process execution
Is it faster or using less memory to have a single big indicator that contain all process to be done or have a separated indicator for each operation
Martin