checking trade price
-
Is there a block that can flag the price of the trade?
For example, if "current price" is > then "price of trade" then bla bla bla.?
-
A follow up question would be to mark WHEN a trade was made.
For example I would like to compare a current condition to a condition 3 candles ago but only 3 candles from the TRADE, not before.
Is there a time block I can use so that it waits "n" candles after the trade before running the condition?
-
Think I figured it out...Use "if trade" and then connect orange to "every 'n' bars"?
That should keep the condition from running until a trade has been made and then 'n' bars after that.
Did I get it right?
-
Maybe it will work. It's probably not the best way to do something like that, but if it works... The best way is to check parameters of the trade itself - time, price, whatever
-
I am joining the discussion because this is exactly what I need to do now, where I can check the parameters for a specific trade and then add blocks depending of the level?
-
"For each Trade" loads specific trade (or trades) and then it's parameters can be get from "Condition", from other blocks, or using the rest of the pink blocks.
-
I sort of understand.
Basically, I want a condition to run only after x bars from the trade.
As you describe it, I'm having trouble differentiating between "for each trade" and "if trade".
-
"For each Trade" finds how many trades there are (depending on the filter settings) and starts to load each one, one after another. For each loaded trade the orange output becomes active => what is connected there runs. For each trade only its parameters are loaded - open-price, stop-loss, whatever... All the other pink blocks are designed to work with those parameters, to check them, to modify them. In other words this block creates "for" loop where the body of the loop is represented by all blocks connected after "For each Trade".
"If trade" finds how many trades there are, depending on the filter settings. Then it decides to pass or not. That's all.
X bars from the trade.... What is that mean? Because:
- Each bar has Time attribute, along with Open, High, Low, Close and Volume attributes. That Time attribute equals to the rounded time when the bar was created. For H1 the first bar of the day has the Time that is translated to 00:00 at this day. The second candle of the day has Time that is 01:00. Not 01:00:04 or something like that. This can be easily seen in the Histry Center:
http://prntscr.com/a6ue5y
http://i.imgur.com/WkgRBTH.png - Each trade has two Time attributes - Open Time and Close Time. If we take Open Time for example, this is the exact time when the trade was opened. This time is not rounded to the nearest minute or hour.
http://prntscr.com/a6ug7s
http://i.imgur.com/8r5AxLu.png
So what X bars from the trade really means? If you are in H1 and a trade is opened at 00:59, visually it will appear that the trade is opened within the very first bar in the day, but in fact it is opened at the last minute of that candle. Then what means 1 bar after that trade? It is something after 01:00 or is it something after 01:59?
- Each bar has Time attribute, along with Open, High, Low, Close and Volume attributes. That Time attribute equals to the rounded time when the bar was created. For H1 the first bar of the day has the Time that is translated to 00:00 at this day. The second candle of the day has Time that is 01:00. Not 01:00:04 or something like that. This can be easily seen in the Histry Center:
-
I see what you mean.
Basically 1HR of the trade would effectively serve the purpose. (or 2hr or 3hr etc.)
So, in other words, I can use the block for time from trade to withhold running block or stop running blocks after a trade depending on these settings.
-
Here is for example how to close a trade if it's older than 1 hour - https://fxdreema.com/shared/QKXmhyGWb Of course, something else can be used instead "close".
There is actually a function to turn any Time value into candle offset - https://docs.mql4.com/series/ibarshift I wonder if it's a good idea to add it in Condition -> (in loop)... , but I'm not sure
