Interesting. I don't understand why it doesn't work on MT5. 
Posts made by l'andorrà
-
RE: How can I check the last closed trade was open on candle ID 0?posted in Questions & Answers
-
RE: FxDreema exports issuesposted in Bug Reports
Por desgracia no, debe ser manual. Aun así, puedes ahorrarte muchos errores si substituyes todos los bloques rosa "For each trade" de MT4 por los de "For each position" de MT5.
-
RE: failed buy stop 0.01 XAUUSD at 4100 [invalid price]posted in Bug Reports
Not necessarily. I have no idea what values that variable can store. I see they depend on previous calculations. That means some time the value can be higher than other. Those days were the distance is very short should be the reason for that behaviour.
-
RE: Overlap Gridposted in Questions & Answers
Not sure I completely get it. Isn't the grid used exactly to avoid that?
-
RE: failed buy stop 0.01 XAUUSD at 4100 [invalid price]posted in Bug Reports
Probably the issue is with the value of the variable used to determine the price offset. Depending on the result of the calculations prior to the order programming, the variable result is too close to the programmed open price. That makes the broker to block it. You should ask your broker which minimum distance is accepted between current price and an accepted pending order. Then you should check your variable should always be bigger than that distance.
-
RE: How can I check the last closed trade was open on candle ID 0?posted in Questions & Answers
@l-andorrà This is what ChatGPY created.
//+------------------------------------------------------------------+
//| Function to check if trade was opened and closed in same candle |
//+------------------------------------------------------------------+
bool IsTradeClosedInSameCandle(ulong ticket)
{
// Get trade history by ticket
HistorySelect(0, TimeCurrent());
ulong history_ticket = HistoryOrderGetTicket(ticket);if(history_ticket == 0)
return false;// Get trade open and close times
datetime open_time = (datetime)HistoryOrderGetInteger(history_ticket, ORDER_TIME_OPEN);
datetime close_time = (datetime)HistoryOrderGetInteger(history_ticket, ORDER_TIME_DONE);if(open_time == 0 || close_time == 0)
return false;// Get current timeframe in seconds
ENUM_TIMEFRAMES current_tf = Period();
int tf_seconds = PeriodSeconds(current_tf);// Calculate candle start times
datetime open_candle_start = open_time - (open_time % tf_seconds);
datetime close_candle_start = close_time - (close_time % tf_seconds);// Check if both open and close are in same candle
return (open_candle_start == close_candle_start);
}How could I make it work below a 'For each position' block?
-
RE: failed buy stop 0.01 XAUUSD at 4100 [invalid price]posted in Bug Reports
Can you please share the link to the project?
-
RE: How can I check the last closed trade was open on candle ID 0?posted in Questions & Answers
I'm afraid it didn't work.

-
How can I check the last closed trade was open on candle ID 0?posted in Questions & Answers
I need to identify those trades that were open and closed within candle ID 0. I'm not sure why this config is not working:

Is the comparison searching for the exact UNIX time the current candle was open, maybe? The trade can be closed at any moment AFTER the current candle was open. It doesn't need to be open at the first tick of the current candle, as this setting is apparently doing.
Am I missing something?
-
RE: Count the number of K-lines where at least two bullish candles (between 2 and 5 US dollars) appear, with an intraday range of less than 8 US dollars.posted in Questions & Answers
Those distances in money depend on many factors (lot size, leverage...). You should use pips or points instead in order to make it more replicable to any chart.
-
RE: Could you please explain how to split trades into Group 1 and Group 2?posted in Questions & Answers
@iQLv99 You can try something like this, as jstap explained:

-
RE: Can somebody please help?posted in Questions & Answers
@nomi01 Please don't kidnap the thread for your issue. You should open a new thread for it, please.
-
RE: Pips Away from an open price, but without the loopposted in Questions & Answers
Can you please share the link to the project instead of uploading the screenshot? I need to see more blocks settings.
-
RE: Can somebody please help?posted in Questions & Answers
You are requesting the MACD on M15 to confirm the trend, but you're doing it at the candle's open price only. If you are using very fast MACD period values, the inevitable correction in the middle of a candle will happen and will ruin the value taken at the open price. Just mu two cents.
-
RE: Pips Away from an open price, but without the loopposted in Questions & Answers
Yes, that can be a valid option, but some weird results can happen if many trades are open right now and most of them are having close open prices. Be careful with that.
-
RE: Pips Away from an open price, but without the loopposted in Questions & Answers
@choppedice This structure will do exactly that for the last open trade only, so the computer will be doing far less calculations per tick:

Because there will only be a new open trade X pips above the last one, you don't need to care about any of the previous one.
-
RE: Trailing Stop Based on SLposted in Questions & Answers
Yes, I understand that, but are those unit selected manually via input parameter or fully automatic through internal calculations?
-
RE: Trailing Stop Based on SLposted in Questions & Answers
How are those TP levels established? Are they a fixed pips distance from open price, maybe?