CCI & Stochastic levels cross
-
Hi everyone,
I apologize if this topic has been addressed before, but I searched both in the forum and in the help material and didn't seem to find any mention of it.
What I'm looking for is how to make an EA that opens or closes a position when a certain level is crossed. Take the CCI for instance. Say I want to go long when the CCI's signal line crosses above the 100 level, and I want to go short when it crosses below the -100 level.
I can't seem to find a block that will do this in fxdreema.
Kind thanks,
Alex -
Here is some example: https://fxdreema.com/shared/bkV80cXlc
Result is here: http://prntscr.com/4m1fer -
Thank you so much Admin! That's great!
-
Dear Admin, actually, I've just discovered a small issue!
The levels I gave are just an example, the real values I want to use are here: https://fxdreema.com/shared/99SwDTCV
I tested the above EA, and if you take a look at the first attached picture, at the bar between the two green vertical lines, you'll see a trade was opened, but the CCI below didn't go above zero. It probably did touch the zero level because of the tail of the candle, but the CCI was still (re)painting because the candle didn't close.
So basically I would like an EA that acts only on closed candles. I tried adding the "once per bar" above the series of blocks, but it didn't give the desired result! If you look at the second attached pic, a buy position should've been opened at the red vertical line, but the EA didn't open a position, probably because it compared the bar to the previous one (the green line), and it saw that the CCI was already above the zero line. At least that's my interpretation; maybe that's not the real problem.
I'm also attaching the CCI indicator I'm using to make for easier visual reference. (Disregard the divergences, I'm only interested in the bars.)
So is there a way to make the EA take correct action only once a bar has finished?
Thanks again for all your time and effort here!
......
1.JPG
2.JPG
CCI_Divergence_v1.mq4 -
Well, in the first case the EA is looking for certain conditions on the current candle, which is unfinished. What you see at the end of the test is not all the information.
"Once per bar" also works, depending on where it is placed. You can also try with different Candle ID parameter (for example 1).
Here is how the crossover works in "Condition" block: https://fxdreema.com/documentation/proj ... er%20works
-
I tried the Candle ID (1) and everything seems to be working fine now!
Again, thanks for all your help.