| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Clearing stored variables for the EA https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=5446 |
Page 1 of 1 |
| Author: | c1borg [ Wed Apr 25, 2018 5:24 pm ] |
| Post subject: | Clearing stored variables for the EA |
Anybody know how to reset a variable for an EA. For example I have a daily profit set at say 1% of my balance which is say $6, it has reached $3 but want to stop the EA and restart without the EA trying to bank the target and restart fresh from tomorrow. Probably havent explained it very well |
|
| Author: | Letsarb [ Wed Apr 25, 2018 6:14 pm ] |
| Post subject: | Clearing stored variables for the EA |
It is very dangerous to modify the external variables with the EA because every time you start again your EA, every Empty4 crash or whatever, the original external variables are used and replace the modified values.... |
|
| Author: | c1borg [ Wed Apr 25, 2018 6:27 pm ] |
| Post subject: | Clearing stored variables for the EA |
So if I restart the EA the variables are reset to 0 is that correct? |
|
| Author: | Letsarb [ Wed Apr 25, 2018 6:59 pm ] |
| Post subject: | Clearing stored variables for the EA |
They are reset to the initialisation value, not especially 0... The easy way would be to transform this variable as an normal variable, not an external any more... |
|
| Author: | Radar [ Fri Apr 27, 2018 1:52 pm ] |
| Post subject: | Clearing stored variables for the EA |
Hey C1borg, If the EA sending a TP with the trade, then it doesn't matter if you restart the EA... Unless, of course, you have set the EA to close all trades on removal (Why would you do that??). If the EA is not sending a TP with the trade, is it calculating the TP based on current balance, or balance when the trade was opened? If TP is being calculated on current balance, then you can only ever have one trade open at any time, because any change in balance would cause a change in the calculated TP. Now, if you're calculating TP based on the balance when the trade is opened, and storing it in an internal variable, you will lose the TP as soon as you stop the EA or the terminal. The safest way I know of to do it, (other than send the TP to the broker's server to look after), is to calculate it once, and store the TP in a GlobalVariable (GV), and just check if Ask/Bid is below/above the price stored in the GV and close as appropriate. Just make sure you give the GV a unique name (I use EAName_Symbol_MagicNumber. If your EA sends multiple trades per symbol, just add the ticket number to the name). Have fun! Radar =8^) |
|
| Author: | Selim [ Thu Nov 09, 2023 3:38 am ] |
| Post subject: | Re: Clearing stored variables for the EA |
He can Instead of storing each order tp in GlobalVariable store the balance in GlobalVariable and this GlobalVariable value does not change until there is no order in the market |
|
| Author: | c1borg [ Thu Nov 09, 2023 1:28 pm ] |
| Post subject: | Re: Clearing stored variables for the EA |
Wow, this is from 2018, thanks for the reply |
|
| All times are UTC | Page 1 of 1 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|