CROSS ABOVE CROSS BELOW
-
In the description it says that the cross area is calculated but comparing the previous bar with the last bar . what does that mean , that the closure of the last - closure of the previous gives a number? width?? i tried to set it a condition close trade when cross above or below a MA but the closure doesnt happen on cross of the indicator but more far... as if it doesnt care about the indicator but waits a kind of calculation. can anyone help me with this?
-
just leave the width to 1.
https://fxdreema.com/shared/HiuKscOsd
^This closes your trades when price crosses 20 MAYou can make a shared copy of your project from Projects menu at top left
-
it does do it like that , my test is exactly what your link shows, but it does not close the price when it crosses the MA20. for some reason it takes the width of the canlde and the width of the previous candle and if in that price area there is a cross at MA20 it wont close it. It closes it only if the price is away from the width of the 2 candles X , X-1 and if there is a cross then it closses it. this is helpful in ranging situations as it will not close it if it is in the same price level no matter the swings it does up and down MA20 but in other cases it does not close it properly. if you move your arrow on the width 1 there is an explanation.
aM I RIGHT ON THE ABOVE ASSUMPTIONS?? -
I didn't quite catch what you mean

But I think the "cross" system just compares the current candle and last candle:
if last candle close is below MA, and current candle is above MA, crossing must have happened.
^You can also do this with two simple condition blocks, without crossing condition -
if you try it you will see that if the price is in the range of the candle width that we opened the trade it wont close the trade no matter if there is a cross on MA20 , in order to do so as i saw in the strategy tester it needs to be away from the width of the canlde that we opened the trade and then only if there is a cross away from the width of the candle we opened the trade it closes it.
-
Ok, well, that's strange.
I assume you mean candle height, width is always the chart period (M5, M30..)Try making a cross condition with two blocks:
- previous candle (ID1) is below ma
- current candle (ID0) is above ma
Does the trade close correctly with this setup?
-
it will close it but in a swing up and down it will open and close all the time!! while the cross above would mean the whole body to be up or down
-
I don't know your trade opening logic, but maybe you should use the previous candle on closing - set candle id 1.
-
can the canlde total size solve this ??
-
Probably.
-
because sometimes it closes above or below MA but the body still touches it and this happens mostly in swings up and down.
-
But you do understand, the ea runs on every tick
So if the body touches the MA, it has crossed crossed it at some time.
If you dont want it to act so fast, maybe use the envelopes indicator instead of ma?
You can also run the ea on every bar only, maybe it helps you in this case. -
how do i run on every bar??
-
just put an "once per bar" block on top of your logic tree
-
by putting above the once per bar even though i am on tick event?
-
thank you...
-
Right.
I personally use "once per bar" on my every ea, everything starts with that block. It has sooo many benefits