Stops/adding variables?
-
I'm having a hard time doing a custom stop placement. So the strategy is first candle to make a new high over a bearish candle. And my goal is to place a stop at the low between the bearish candle and the breakout candle. pretty much the pivot between the two. I see I can do Modify stops of trades, Market properties, Lowest price (candle period) then choose a specific distance which is nice but i would like the end candle id to be the most previous bearish candle. Thanks for any thoughts.
this is what I have so far.
0_1569001438155_v.1.mq4

just some examples

-
You are using candle ID 0 on the right operand of block 7. That will always be problematic, as you are comparing with the current candle before it is closed. I recommend you to use candle ID 2 for thw left operand and then candle ID 1 for the right operand.
-
thanks for the tip
ill change it up. If anybody else has any suggestions i'm all ears. As you can tell im new. -
@chemdog Just to check, if I got you right ...

Candle 0 is the current, where the high of the last bear candle was broken.
SL should be the lowest low since that time or the low of the bear candel?However, first you need to loop to find the last bear candle. at the moment you just check if candle ID 1 was a bear candle, right?
If you know the last bear candle ID, you want to get the lowest low (of that candle) or the lowest low (of the candle since that time).Did I get that right?
What about a situation like this (just for bear candle determination)?

Which one would be the bear candle that defines the breakout? the big one or the one after?
Which would be the low to take? the lowest low since one of the bear candles or the last bear canlde (smaller one after big one?)Just want to make sure.
In any way you may need to loop to find the last bear candle's ID or the relevant one. Then you know the breakout level and can calculate ypur SL and TP which at least in you screenshot appear to be the candle size of the bear candle. Right?
-
For the first image that is correct. And the SL would be the low since that time. Between the breakout and the most recent bear candle. And atm yes i'm only checking candle id 1 is a bear candle (I think :D).
As for the second image it would look like this

thank you for the tip. Ill look into looping it back to find the most relevant bear candle. appreciate it
@trader-philipps -
@chemdog I think, if you looped back and found your last recent bear candle, you might check if that one is a recent low - which would be the case if the lows to the left and to the right are higher.
Maybe you would just look to the left in order to find the "relevant" bear candle.If you know the candle ID of the bear candle to trade, it's relatively easy to get all the infos you need such as candle size and candle low.
In order to get the lowest low of a period there is a a way to easily get this.

The other calculations may look like this ...

your_bear_candle_ID would be the resulting ID of your loop and you'd store that in a variable as well, which you would place where I just wrote the text.
-
@trader-philipps So I managed to consistently enter at the high of the recent bear candle and place a stop at the low between the two. Still having problems looping back to the bear candle. I think it's due to me not knowing how to combine two variables in one slot.
this is what I have so far.
0_1569051134573_v.12.mq4

-
@chemdog Haven't tested this, but should work like this.

I have defined an integer veriable "loop" for counting the cycle.
Modiy Variable block first resets the loop variable to 0
In the bear candle check condition I add +1 on every entry (white dot)
Iconnected yellow point to white point on condition block.
Once orange block (bear candle found) is hit, the loop exits and the last value of loop is the candle ID.Does that make sense?
-
@trader-philipps Yes you're starting loop variable at 0 and every time you loopback to check for a bear candle you add one till it finds it and you use that value as its ID.
-
@chemdog You may want to exit the loop in case that no bear candle is found within a pre-defined maximum number of bars. In that case make a condition block connected to the yellow dot of (Bear candle ?" block instead of the the yellow - white connection.

I took 10 as an example. Hence if loop didn't find a bear candle until candle ID 10, it would exit.
-
@trader-philipps So it seems that it's close to working but for some reason it wants to enter a trade right after a bear candle.
if you don't mind pointing out any mistakes that would be awesome.https://fxdreema.com/shared/drMzxxvxc
0_1569114719725_v.18.mq4 -
@chemdog Ok, I give it a try. From first look ..
a) Block 8. What for you need that? It checks if last candle was a bear candle. If that's not the case it will exit the routine.
b) After block 14 (orange) you should get the candle's high and low and maybe size and store it into a variable. After that you check if current price is bigger than the candle's highHowever, I feel there is still a flaw in the logic as you want to trigger that trade just once .. just assume that there are 3 bullish candle in a row that all pass the high of the last bear candle. In that case you don't want to open a trade each time, right?
But we will take a look for that later on.A bit off-topic: 9 and 20 are EMAs, 50 and 200 are SMAs .. is that your intention?
-
@trader-philipps Something like this?
https://fxdreema.com/shared/rQCuoIqVcRight, I only want to take the first breakout over the previous bear candle then once the trade closes then I look for another opportunity. And yes that is my intentions with the MAs, To only take this setup when conditions are in my favor potentially.
thanks again for your time
-
@chemdog Here you go.
0_1569124420946_1569114719916-v.18.mq4I updated the structure a bit.
In addition I made a little mistake when posting the loop stuff. Right would be this

For the adjustment you have to put the variable ID and add +1 .. here as loop is ID V1 you put V1+1
I run in tester. It does basically what you want. You may want to use stop orders instead of market orders. However, it was not very profitable. I think you need to add some minimal candle size of bear candle maybe. But check by yourself.
-
It is closer than when I started. I appreciate it, i'll keep working on it and i'll update you if any good news.
-
So i'm running into this problem
If you look at the first trade its reading the setup correctly (even though Conditions aren't met) But once it crosses the
MAs then it thinks conditions are met and enters the trade. setup is working right if you compare to the last 2 trades
-
Ok I fixed. it Looped back to find bear candle ID and made sure the close was above 50 MA
-
How would I go about giving each trade a group number and make sure they don't all close at once?
-
@chemdog working with groups you need a buy / sell block per group. Probably a variable would work as well.
However, are the close conditions different if there are more than 1 trade on same direction? -
@trader-philipps After a few days and coming back I got the stop to recalculate the way I wanted, thank you.
I have a few problems- Trades are exiting all at once and this doesn't give some of the newer trades time to mature.
- Trades are taking the same trigger level multiply times

- Sometimes trades trigger delayed and miss the initial breakout only to come back down and trigger a few
candles later. Or miss the move completely missing an opportunity.
I don't know if groups will help me individualize each trade but you could say each close condition is different if more than one trade is in the same direction.
using the daily for testing