Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your difficulty.
No free help (2017)
Or pay someone. Top of every page is the link Freelance.
Hiring to write script - General - MQL5 programming forum (2018)
We're not going to code it for you (although it could happen if you are lucky or the issue is interesting).
No free help (2017)
Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your difficulty.
No free help (2017)
Or pay someone. Top of every page is the link Freelance.
Hiring to write script - General - MQL5 programming forum (2018)
We're not going to code it for you (although it could happen if you are lucky or the issue is interesting).
No free help (2017)
this is my effort:
//+------------------------------------------------------------------+ //| Candle ID Printer | //| Copyright 2023, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "2023, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property strict //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { // Subscribe to the trade events EventSetMillisecondTimer(1000); // Set a timer to check trades every second return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { // Unsubscribe from the trade events EventKillTimer(); // Kill the timer } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTimer() { // Check all open trades for (int i = 0; i < OrdersTotal(); i++) { if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { // Check if it's a closed sell trade with a loss if (OrderType() == OP_SELL && OrderClosePrice() < OrderOpenPrice() && OrderProfit() < 0) { Print("Trade ID: ", OrderTicket()); datetime previousCandleTime = Time[1]; // Time of the previous candle int previousCandleID = iBarShift(Symbol(), Period(), previousCandleTime); if (previousCandleID >= 0) { Print("Previous Candle ID: ", previousCandleID); } else { Print("Error retrieving previous candle ID."); } } } } } //+------------------------------------------------------------------+as i said i am just getting to code in MQL4 is it a bad thing i need help, please i will be glad if you can help
- No idea what you mean by “fail.”
- If the type is a sell, OrderClosePrice is the Ask. If the OCP is below the open price, you are in profit. Your code prints nothing.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am just learning MQL4 and trying to implement as many thing to learn many concept. So i am just playing by building an expert advisor that if a trade fail print it candle id on the journal terminal
please i will be glad if anyone can help