Right.
I personally use "once per bar" on my every ea, everything starts with that block. It has sooo many benefits
Posts made by roar
-
RE: CROSS ABOVE CROSS BELOWposted in Questions & Answers
-
RE: CROSS ABOVE CROSS BELOWposted in Questions & Answers
just put an "once per bar" block on top of your logic tree
-
RE: CROSS ABOVE CROSS BELOWposted in Questions & Answers
But you do understand, the ea runs on every tick
So if the body touches the MA, it has crossed crossed it at some time.
If you dont want it to act so fast, maybe use the envelopes indicator instead of ma?
You can also run the ea on every bar only, maybe it helps you in this case. -
RE: CROSS ABOVE CROSS BELOWposted in Questions & Answers
I don't know your trade opening logic, but maybe you should use the previous candle on closing - set candle id 1.
-
RE: CROSS ABOVE CROSS BELOWposted in Questions & Answers
Ok, well, that's strange.
I assume you mean candle height, width is always the chart period (M5, M30..)Try making a cross condition with two blocks:
- previous candle (ID1) is below ma
- current candle (ID0) is above ma
Does the trade close correctly with this setup?
-
RE: CROSS ABOVE CROSS BELOWposted in Questions & Answers
I didn't quite catch what you mean

But I think the "cross" system just compares the current candle and last candle:
if last candle close is below MA, and current candle is above MA, crossing must have happened.
^You can also do this with two simple condition blocks, without crossing condition -
RE: trailing stop/trailing profitposted in Questions & Answers
@ggrobot said in trailing stop/trailing profit:
- if it goes 2020 with trailing stop 20pips and 1 pip step that means that at 2021 the stop with me modified from 1980 to 2021 ???
Not exactly, if price is at 2020 and you have 20 pips SL trail, the stop is at 2000. When price is 2021, and your trailing step is 1, the stop is now 2001. If your step is 2, the stop moves to 2002 only when price reaches 2022.
Trailing profit is useful too, but it is all about your strategy, you have to do your own reserch about what is better.
-
RE: trailing stop/trailing profitposted in Questions & Answers
Trailing means that the stop has a maximum distance from current price.
If you have 20 pips trailing stop (SL) in a buy trade, and the price goes upward, the stop also goes upward 20 pips behind current price. If the price then goes down, the stop doesn't move anywhere and the SL can trigger. -
RE: CROSS ABOVE CROSS BELOWposted in Questions & Answers
just leave the width to 1.
https://fxdreema.com/shared/HiuKscOsd
^This closes your trades when price crosses 20 MAYou can make a shared copy of your project from Projects menu at top left
-
RE: Trailing Stop (for group of trades)posted in Questions & Answers
You would have to assign different weight on each trade - if you have 1.00 lot buy at price 1.000 and 0.01 lot buy at price 2.000, the midpoint is not price 1.500 but close to 1.000..
There could be a way to calculate this, with a million variables, but its not very simple
Well, MT5 does this automatically, everytime...
-
RE: Total profit reduces by x % then close everything.posted in Questions & Answers
Yeah, the core principle seems to be working, now its just about improving the ea as whole

-
RE: Total profit reduces by x % then close everything.posted in Questions & Answers
Hehe, 19000 trades - the spread costs could be pain in the ass in live trading

-
RE: Total profit reduces by x % then close everything.posted in Questions & Answers
Hmm, yeah, could work

If you just want to delay the ea after something happens, this is what I usually do:
- create variable barcount
- on each bar, modify variable barcount to barcount +1 , so the variable just increases every bar
then, if you want to wait 3 bars after opening a trade: - reset the barcount at buy or sell,
- put a condition: barcount > 3
-
RE: Total profit reduces by x % then close everything.posted in Questions & Answers
All right

There is certainly a way to make the ea as you said, excluding the losses from new positions. But I'm afraid it won't be very simple or elegant solution.You would need a variable for the modified profit.
Then find out how much loss a new trade causes, this could be done with some more variables, one variable should show the profit a few candles ago, so when a trade happens, the loss could be calculated. The loss would then be subtracted from the "modified profit" variable.
Then there should be another variable that keeps track of the losses caused by opening trades, a "loss bank" variable. That "loss bank" could then be slowly drained to the "modified profit", so the losses would be taken into account after some time, and "modified profit" would get closer to the real profit.Anyway, thats how I would do it, but I'm not sure if its worth the trouble

-
RE: Total profit reduces by x % then close everything.posted in Questions & Answers
So you want to exclude the new positions from the profit calculation?
I would go with the 30-min condition, why not?
Or set the ratio lower, 0.8 for example? -
RE: CONDITION for close trades.posted in Questions & Answers
The ea runs every tree, on every tick.
If you are using mt4, you can have both buy and sell trades open.
If you don't want that, use a "no trade is running" block, for example.In the close trades -block, you can filter the trade type, so it closes only buys, for example.
If you want to show exactly what you are doing, create a shared copy from the Projects-menu (top left).
-
RE: CONDITION for close trades.posted in Questions & Answers
CONDITION --> BUY--> CONDITION -- CLOSE TRADES
This would not be very great, because it always closes a new trade, because the closing can't happen without buying...
Just separate the "logic trees":
Condition -> buy
Another condition -> close -
RE: CLOSE BAR HELP!posted in Bug Reports
I'm not sure if the link works - did you mean this project?

-
RE: Trailing Stop (for group of trades)posted in Questions & Answers
Hmm.. If your trades have different lot sizes, measuring the total profit as pips becomes difficult.
Maybe just close the trades based on account equity, or account profit?This could help you:
https://fxdreema.com/forum/topic/4858/total-profit-reduces-by-x-then-close-everything/2?page=1