Close trade using RSI and candle cross MA in a certain time period
-
https://fxdreema.com/shared/FMvvM6sNb
I want to close a trade when the 2 conditions are met. These 2 conditions may or may not happen at the same candle but one should happen and another one is following within, for example, 15 minutes.
I set the conditions in timer, it doesn't work. Could anyone please guild me what I did wrong. Thank you.
-
@kk-6 When two conditions can happen at different times you will definitely need variables. As soon as one of them happens, a boolen variable is changed to 'true'. Then the second condition will require a previous 'condition' block requesting the first one to be true. However, please remember that you will need to reinitiate both of them accordingly.
-
@l-andorrà Thank you for helping me out. Do you have some example regarding a boolean variable? It doesn't have to be exact criteria as mine. I just want to look how to set it up because I have never done it before, therefore I have no idea where to start. Thanks a bunch.
-
I suggest you can try connection the two condition block with AND block. So if both condition met regardless which one happen first, it should execute.
-
@biztet Thank you for helping. I want the action to happen in sequence and within a specific time period. AND block probably doesn't work with a concept. What do you think? I have adjusted an EA in link below.
@l-andorrà I have adjusted like this. https://fxdreema.com/shared/j9zTpQE6b on a timer tab. Is it what you mean?
I have made another version https://fxdreema.com/shared/zX1X0XXLb I think it is better in term of a sequence of action. -
So if you need it to be in sequence, just put the 1st above the 2nd. Put the time filter on top if you need it.
-
Why don't you just make it like this,
use once per bar > cond1 > cond2 > close allAnd you can play with timeframes for any block.
-
@biztet Ah! that simple! Thank you! One more question, the blocks are on Tick tab, right? If I want the actions to happen at anytime but within a15 minute range, should I use a Minutes filter block, start from 1 minute, end in 15 minutes?
-
I don't think you need the time filter. Since you use within 15 minutes time for closing, set the timeframe m15 in once per bar block, then run this ea on m1 chart. So it will check all minutes in m15 candle.
-
@biztet Brilliant! I appreciate your help. My previous question it was also you who helped me out, I remember. Thanks indeed. Have a beautiful weekend. Regards.
-
Goodluck!