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
You seem to be missing my point . . .
You said . . .
. . . you need to remember that price has passed into and out of the zone to initiate a buy, but this may have happened 4 days ago so you need to know when to forget that the price has passed into and out of the zone, hence my question earlier in this thread about when the condition is invalided so that you can "forget" that price went into and out of the zone. Don't think about code, get the logic right first . . .
I am trying :) I appreciate the help...
This all happens whilst Trend = uptrend.
If trend becomes a downtrend it resets everytning, and the zone changes.
Price just needs to "touch" the zone to validate. (I may add a one bar close in the zone later during testing if necessary to validate the setup further, but that is speculative for now and can be added later)
Naturally on the same bar price may move in and out of the zone. Is there some time series function I should be using?
I am trying :) I appreciate the help...
This all happens whilst Trend = uptrend.
If trend becomes a downtrend it resets everytning, and the zone changes.
Price just needs to "touch" the zone to validate. (I may add a one bar close in the zone later during testing if necessary to validate the setup further, but that is speculative for now and can be added later)
Naturally on the same bar price may move in and out of the zone. Is there some time series function I should be using?
OK, so does this make sense ( bear in mind that I don't fully understand your strategy ) . . .
OK, so does this make sense ( bear in mind that I don't fully understand your strategy ) . . .
hmmm - ok will have a play with that tomorrow and let you know.. thks
so BarCheck - checks price is in correct zone - as it is currently doing
and then BarCheckSet, encompasses Barcheck and price moving out again?
hmmm - ok will have a play with that tomorrow and let you know.. thks
so BarCheck - checks price is in correct zone - as it is currently doing
and then BarCheckSet, encompasses Barcheck and price moving out again?
BarCheckSet tells you that you have recorded the fact that BarCheck has returned tue and allows you to keep this value set. You are probably going to have to do something with BarCheckSet in the BarCheck function, maybe return true if BarCheckSet is true.
Didn't have much luck with adding the BarCheckSet - the principal of it makes complete sense to me, but unfortunately I couldn't work out where to put it so that when the BarCheck became false, it din't impact the BarCheckSet. I am guessing this has to do with the correct use of brackets, but my efforts didn't seem to work.
However whilst doing this I did manage to get BarCheck to not reset by principally changing where BarCheck is reset (yes I know this could now be used for BarCheckSet). But this led onto another issue in that even though Barcheck was set and ready for a trade, if price continued down and out the bottom of the zone before coming back up, it wasn't picking this up.
So what I am thinking is split out BarCheck to be two variables.
I am thinking I could then declare a variable that is the lowest low whilst trend is up (which I can then reset when necessary - but I wasn't sure how to achieve that - ilowest syntax seems to require the number of bars to lookback. So how can I get the lowest low since trend is up?
is it something like declare variable - int i then if (Trend = Uptrend) count bars ? Then use "i" in the ilowest syntax?
I am just not sure how I can construct that, or if it will do what I want.
Any suggestions?
I am thinking I could then declare a variable that is the lowest low whilst trend is up (which I can then reset when necessary - but I wasn't sure how to achieve that - ilowest syntax seems to require the number of bars to lookback. So how can I get the lowest low since trend is up?
is it something like declare variable - int i then if (Trend = Uptrend) count bars ? Then use "i" in the ilowest syntax?
If you know when the trend switched from down to up you can get the bar number from the datetime using iBarShift() . . . but if you need to look back and determine this you can probably just as easily get the bar number, one thing to be said for using the datetime, it doesn't change when a new bar forms, the bar number for the place where the trend changed will.
Thanks Raptor for all your help. I think I solved the issue for now.
I created the Highestprice and Lowestprice variables that I can use to compare. These get reset as well when the trend changes. So now the EA seems to be doing what it should.