Exit after certain higher highs and lower lows
-
For each trade , exit after 2 consecutive higher highs or 2 consecutive lower lows . What would be the correct way to arrange the blocks??
-
@rebearv Do you mean higher/lower prices? Then you should use variables storing those values and comparing them 'on tick'. Is that that what you mean or higher/lower balance?
-
@l-andorrà The thing I want to do is to close a buy trade by having 2 consecutive higher high candle for taking profit and by 2 consecutive lower low candles as a stop loss.
I want the next candle after taking my trade print a higher high than the candle where I enter my trade and another candle with a higher high than the last one .. then close trade.
I hope I have explain myself . Thanks for responding
-
@l-andorrà I think storing the values in a variable for then compare them can be a solution. But I don´t know how to. Any examples of how to store future price session values in a variable ?
-
@rebearv In the upper(ish) right section of FXDreema you have the variable section, create with any name you want, double = numeric, put this into a modify variables block(place under a pass block to ensure it works) in the modify block place the condition that you want in the variable.
-
@jstap Hey . Thanks for your reply . I am new on this , I barely understand you what to do . Let me share the link of the project .
Please tell me if the parts of what you have instructed me are in order , and also where in a condition block can I set the info I want to store .I would want to know the highs and lows of the very next two candles after taking a trade.
-
@jstap I am researching how to use variables and store values, it must be something around the corner .
Do you think I have to introduce a math formula to do this , or there's a way with blocks and variables ? -
@rebearv This https://fxdreema.com/shared/qXjr2FZ4e will move and save the candle prices once every candle.
This can be done with mathematics (code) and is the typical meta trader way but this is all contained within FXDreema.
-
it sounds as if you will want to use the zigzag indicator to determine the HH and LL as you were seeking originally.
use the modify variables block to then define what the variables will be.
var 1 is HH1, var 2 is LL1, var 3 is HH2, and var4 is LL2
within the modify variables block specifically now, you will select each of those variables and then define each like this:
var1 = indicators (zigzag, mode HH, ID0)
var2 = indicators (zigzag, mode LL, ID0)
var3 = indicators (zigzag, mode HH, ID1)
var4 = indicators (zigzag, mode LL, ID1)I think thats about all you would need to define what you're seeking.
to verify, put a comment block under once per bar (1 minute), and draw a horizontal line that is redrawn at the value of each variable. -
@jstap Hey , thanks for your support. I'm trying to understand what you shared for implementing it . The route to take is more clear now that I see how it is done and it´s logic..
You have been very helpful. -
@rebearv Your welcome
-
@tipsywisdom Hey man. Thanks. I was trying something like that , but I think I´m still dealing with candle id logic, as I was trying for candle id 1 and 2 .
And after this four variables are set , I suppose I have to compare them to get what I want, isn´t ? This would be done with a condition block?
-
Hey! I am trying to do it like I show in the image . But trades are not closing after 2 consecutive highs or 2 consecutive lows . What can it be wrong? I a setting the variables at candles asking for the high and lows of id 1 and 2 and then I am trying to compare the values with a condition block.
According my test , trades are closing just after entering , and also I noticed the test is printing a line on all lower wicks and in all high wicks , like making a channel. !
0_1654394565361_Capture.PNG -
@rebearv Is hard to say from pictures, looks like it should work, what is inside the close blocks? put a shared project link here.
-
@jstap Sure! https://fxdreema.com/shared/WEkQcaI0e
Thanks for give it a look. -
@rebearv You don't need the pass or once per bar, the once per bar would have worked under the conditions but above means if conditions are false it will wait until the next bar to try again. Do you want both buys and sells and sells to close on either condition? This is likely causing trades to close prematurely.

-
@jstap Ohh ok... I get it . I was using once per bar incorrectly , and I suppose the pass block is unnecessary or redundant . I think I was making the once per bar mistake in other projects.
In fact the strategy is only for buys, I forgot to filter the type... the idea is to play with consecutive higher highs for exit in profit as a dynamic target, and with consecutive lower lows for exit as a dynamic stop loss.
Thanks for your support. I though it was something on the variables arrange, but not. This is good as I can keep going forward and try other things with variables like store other candle data. I will tell you if it started to give me good results. -
@rebearv Ok
-
Hey @jstap .. I´m bringing back this project . Please check the last links we share each other, and if you are so kind , can you confirm me please if the project I shared on that days was ok despite what you tell me about once per bar and pass block. Since that day I haven´t been sure if it was a good solution. I didn´t understand the project you share on that days as I didn´t understand the logic behind it. Also I have to say it is my first project with variables.
I was trying yesterday another strategy with the same logic of exiting trades after a sort of consecutive higher higher and lower lows trying it to resolve it with check distance between higher highs between candle 1 and 2 But it is giving me other results.
https://fxdreema.com/shared/6FwfWg0feLets say I want to exit a buy trade after 2 consecutive higher highs for profit and 2 consecutive lower lows for sl . What would be the correct and ultimate way to do it ??
Thanks for the support.
-
@rebearv With a standard condition block, candle 1 high is above candle 2 high and the close block beneath, if though this is true when a trade is placed it will instantly close so you need some other logic to prevent.