stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

passing values between programs
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=834
Page 1 of 1
Author:  jjasper7 [ Sun Sep 23, 2012 11:05 pm ]
Post subject:  passing values between programs

would someone please explain how to place a value calculated by an indicator somewhere so the ea can pick it up an use it? I am thinking of running the indi to calculate and chart recent values, and if the ea is running, instead of calling the indi to run and re-calculate the value for each tick, it uses storage that can be common to any program, and would just pick it up and use the last value calculated... and, probably, should have some way to confirm that the indi has run recently. for example, if i wanted to run the stochastic indicator or the timeslope indi, instead of running the indi for each value needed, to have the ea be able to pick up the last calculated value and test it for the condition i need. as fast as these computers are nowdays, it would not save that much processing time, but could simplify/shorten the length (and consequent debugging) of any other program that needs to find that value (rather than needing to add the code into the program or make an icustom call).
Author:  gaheitman [ Mon Sep 24, 2012 3:46 am ]
Post subject:  Re: passing values between programs

jjasper7 wrote:would someone please explain how to place a value calculated by an indicator somewhere so the ea can pick it up an use it? I am thinking of running the indi to calculate and chart recent values, and if the ea is running, instead of calling the indi to run and re-calculate the value for each tick, it uses storage that can be common to any program, and would just pick it up and use the last value calculated... and, probably, should have some way to confirm that the indi has run recently. for example, if i wanted to run the stochastic indicator or the timeslope indi, instead of running the indi for each value needed, to have the ea be able to pick up the last calculated value and test it for the condition i need. as fast as these computers are nowdays, it would not save that much processing time, but could simplify/shorten the length (and consequent debugging) of any other program that needs to find that value (rather than needing to add the code into the program or make an icustom call).
You could come up with a bunch of ways to write a value and read it again either in memory via DLL or on disk. You could also write/read values to global variables. None of these will be as reliable as using iCustom() and they all require MUCH more time to implement correctly. If the code doesn't bog down your system running via indicator, I would recommend using iCustom().

BTW, most indicators don't really need to recalculate the values on each tick, it may be that you can optimize the indicator so that it's less of a strain in the first place.

George
Author:  jjasper7 [ Mon Sep 24, 2012 3:50 pm ]
Post subject:  Re: passing values between programs

thank you, george. i have no idea how to generate a dll, and can understand that other options would not be simple and therefore not simplify. i appreciate the explanation, thanks for the help
Author:  jjasper7 [ Tue Sep 25, 2012 10:42 am ]
Post subject:  Re: passing values between programs

another question, how do you visually label a point that will stay with the contract's chart structure (vs a position on the screen)? i.e. label a price at time, so that it marks a significant bar, and stays relavent (like drawing an arrow) as time passes or the time period is changed.
Author:  gaheitman [ Tue Sep 25, 2012 11:07 am ]
Post subject:  Re: passing values between programs

jjasper7 wrote:another question, how do you visually label a point that will stay with the contract's chart structure (vs a position on the screen)? i.e. label a price at time, so that it marks a significant bar, and stays relavent (like drawing an arrow) as time passes or the time period is changed.
There are two kinds of "labels" you can add to the chart with the ObjectCreate() function. OBJ_TEXT moves with the chart, OBJ_LABEL stays on the same screen X/Y position. The ObjectCreate() online help entry gives an example of using both. As usual, it's not a great example, but you can see that the OBJ_TEXT object type takes a Date and Price coordinate and the OBJ_LABEL object type needs the second step to move it to the correct X/Y coordinate.

http://docs.mql4.com/objects/ObjectCreate

George
Author:  jjasper7 [ Tue Sep 25, 2012 8:41 pm ]
Post subject:  Re: passing values between programs

thank you
All times are UTC Page 1 of 1