
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi pipPod, the varaible is datetime declared within the OnTick{} block (so I guess local) and is not static. I am a bit confused about the 'static' in the fact that..., does it Scenario A. - retain the value assigned to it during the 'lifetime' of the EA, in other words until removed from the chart?, or does it Scenario B. - retain the value all the way through the whole code until it reaches the bottom and then can get a new value once a new tick comes along?
I will try your suggestion changing the code to static, but the reason I asked the question above is because I need this variable ready to get a new value once the actual candle it is working on completes and a new 'Bar' opens, opening the readiness of the variable to get a new value.
It retains the value until a new value is assigned to it when the order is sent( UBand01_OOT=Time[0];). If it's declared locally or non-static, every time a new tick comes in, the variable will be equal to zero. So Time[0] will always be bigger than UBand01_OOT.
The following will only open an order once per bar for each condition, iow maximum 2 orders per bar.
I mean a simple 1 Minute delay between orders.
If you need less then use a simple counter.