@biztet First check your conditions a they appear always to be true - hence an opened trade gets closed immediately.

@biztet First check your conditions a they appear always to be true - hence an opened trade gets closed immediately.

@khalids222 I really have no idea what your strategy could be, but it looks a bit dangerous! However, let's first get the errors out.
You have a constant called LOT and a variable. Delete the variable and use the constant in the BUY and the SELL block. Alternatively you might use a variable block on the init tab and specify the value of the constant (rename it before) and put it as value for the LOT variable.
Next you need to specify where the reset should appear. I reset the variable on entering of the close trade block (#41).
https://fxdreema.com/shared/jJthvY2Rd
Check it out and let me know, if that's what you want to achieve!
@alphaomega It's already there or did I oversee something?

just import the indicator and use the buffers!?!
@rajiah
In total your condition may look like this (check for min body size to fit your requirements!)

Maybe a once per bar block before the sequence would be good.
Usually we don't want to work with current candle as it is not closed yet. Hence we check if candle ID4 was a bear candle and if candle ID 1 to 3 were bull candles. Does that make sense?
@rajiah Is the sequence 1 bear and then 3 bulls or could it also be 4 bulls in a row? However, the blocks you should use are probably those ..

@rajiah Wow, 25 rules? You should bring them in a logical order that a program can transform it to binary 1 or 0!
@ambrogio If you have the source code you just need to copy the enum declaration if it's not imported correctly like that ..

If you have only the compiled file, you might save the settings in order to see which value is stored for each of the options.
@biztet Well, I think I do. Did you read through all PDFs?
Basically the higher TF gives the trend direction. Than you try to enter the market in the same direction on price pull backs giving you a good risk reward opportunity.
@seb-0 Alternatively you might create a project link and store them somerwhere. It will store the project exactly in the state when you created the link.
@tibortrade If all 3 conditions have to be true, you could chain them after eacg other or let them be processed in parallel followed by an AND block (I prefer 1st alternative). If you could share your projectm we might rather help not just guess!
@biztet If I will find the time, I'll make a prototype EA. The fascinating thing is the good risk reward that you can achieve. I tested visually an 1:6 risk reward was not so rarely.
Read the PDFs I'll focus on 2 timeframes for begining.
@biztet I did some modifications already and managed to get green and red signals in backtest. Than I noticed that going back on candles doesn't work well. So I also removed the empty value statement. Hence both buffers will have a value everytime. However, the results are still not satisfying. Finally I seeked help from Mr Google and ended up with this project, which fascinated me that much that I forgot about your issue - sorry!
@edmundtan Did you uncheck the ray option?
@l-andorrà Well, in theory a hedge seems to be a good way, but on every hedge trade you'll loose a bit (spread, swap, commissions, etc). Furthermore you will find yourself babysitting your account rather than enjoy the trading. Believe me, I've been through this including a hedge EA and manual trading. You'll notice that market sleeps less than you need sleep.
So to come to @luisjunior1224 question:
And most of all: Trade and don't gamble! Learn the basics before risking your hard owned money!
@l-andorrà Variables can have a name and a value. You add 1 variable with name of the ticket to the first trade with no value (or a dummy one). When the hedge trade for that first trade is opened, you'd set the value of the variable with the ticket number of the hedge trade. Once the hedge trade is closed, you'd delete the value of the hedge (or set a dummy one). Once the first trade is closed, you'd delete (don't know if that is possible) the variable or set it to a value that you consider to be closed.
Check this or for working with global variables.
I think you need something that "survives" a MT4 restart or you'd come up with a better solution and maybe close all trades when EA is loaded. But in that case you wouldn't be able to change a setting of EA without forcing it to close all trades.
@biztet I tried to build the project to make it work, but there must be some strange thing wrong with your indicator as my EA only opens sell trades. When I back-test the indicator only, it also produces only sell signals.

If you place it on a chart the result is different.
However, for the condition block, I just took those ..
https://fxdreema.com/forum/assets/uploads/files/1576864393628-untitled-1.jpg
Sell trades work fine somehow. I also saw sometimes that the indicator shows both buffers to be 16. so maybe need to check each others values as well.
@l-andorrà If you want to identify a certain trade and its hedge trade maybe use a global variable and store the ticket number at it?!? delete the variable if the hedge is closed. Hence you would at least per each trade know, which one is hedged already. Just a thought. Alternatively you may put this information in the comment, but that would give some logic viewable by your broker.
@biztet Check your condition blocks!
First you adjust each value by the indicator to 16. And then you check if 16 == green, which will never be true.
Remove the adjust and set the right side to value >= 16
@l-andorrà My crystal ball says: How can I set SL on low of candle ID1. I want to measure how far that SL is and set same distance as TP or a multiplied value of the distance (eg times 2). 