High/Low
-
Greetings,
I would like to create an expert advisor that:
-
Place a line at the highest H1 open and lowest H1 open for the current day.
-
Sell short at the highest H1 open after price goes up through it and comes back down.
-
Buy at the lowest H1 open after price goes down through it and comes back up.
Stop loss is the current daily high or current daily low.
When trade is +5 or more, move stop to BE+1.
When trade is +10 or more, move to to BE+5- Do not wait for the bar to close to enter a trade.
For clarification purposes:
-
Sell short at the highest H1 open after price goes up through it and comes back down.
Price has to GO UP FIRST.
Price has to GO ABOVE the highest H1 open.
AFTER, price has risen above the highest H1 open, THEN AND ONLY THEN, do you enter a short trade when price falls back down to the highest H1 open. -
Buy at the lowest H1 open after price goes down through it and comes back up.
Price has to GO DOWN FIRST.
Price has to GO BELOW the lowest H1 open.
AFTER, price has dropped below the lowest H1 open, THEN AND ONLY THEN, do you enter a long trade when price rises back up to the lowest H1 open.
** M15 bar must open below the lowest H1 open before you can enter.
** M15 bar must open above the highest H1 open before you can enter.
-
-
@ramimoujaes Do you have any initial project to begin with?
-
Greetings @l-andorrà
No I do not because I do not know where to start.
-
@ramimoujaes Ok. Let's move step by step then. Who is sipposed to draw those high/low lines, the EA or you?
-
Greetings @l-andorrà ,
The EA
-
@ramimoujaes Ok. That will be this first element to deal with. Can you please detail how the EA is supposed to find those high/los prices? I read on your first post that you only consider those obtained from the H1 chart every day. I guess the previous day's values are ignored. Correct?
-
Greetings @l-andorrà ,
If price is within YESTERDAYS HIGH AND LOW price, we can then look at where price is in relation to TODAYS HIGH.....and TODAYS HIGHEST H1 OPEN price.
-
@ramimoujaes Then you will need 4 variables. Two for yesterday's high and low and the other two for today's high and low:

And then we can filter that price today is within yesterday's high and low by comparing them to today's high and low:

-
Greetings @l-andorrà ,
Thank you for your help. I would like to know something regarding the variables, the ones colored in blue.

What would be the type, name, and value when creating them
-
@ramimoujaes Here you will find information about them:
https://fxdreema.com/instructions/builder/constants-and-variables
Once you complete this first step, let me know.
-
Greetings @l-andorrà ,
I completed your instructions (Shared project link: https://fxdreema.com/shared/62DLTk8ae)What would be the next steps?
Sincerely
-
@ramimoujaes Good. Now you need to be sure those conditions are correct. We will ignore all the other now. You can connect a buy now or a sell now block at the bottom of this structure and a 'once per bar' block on top of it. Do some bactkest and confirm it is what you need.
-
Greetings @l-andorrà ,
So in this case, how do we proceed in to the following:
Stop loss is the current daily high or current daily low.
Adjust position size accordingly.Take profit by moving stop.
When trade is +5 or more, move stop to BE+1.
When trade is +10 or more, move to to BE+5M15 bar must open below the lowest H1 open before you can enter.
M15 bar must open above the highest H1 open before you can enter.
-
@ramimoujaes You will need an initial SL level when the trade is open. Which one is supposed to use? Later it can be modified, though.
-
Stop loss is the current daily high or current daily low.
When trade is +5 or more, move stop to BE+1.
When trade is +10 or more, move to to BE+5 -
@ramimoujaes This is the way to program the stop loss for a buy:

Obviously you will need the high for a sell. However, please notice that if a trade is open at the beginning of today's daily candle, the SL price will be the same as the open and the trade will immediately close. Are you aware of that?