Thank you.

- Joined Aug 2010 | Status: Life is easy, life is delightful. | 3,122 Posts
And you will leave pain to take care of itself.
I will code your pivot EAs for no charge 25 replies
I will code your scalping EAs for no charge 163 replies
Oanda MT4 - Indicators and EAs not showing 2 replies
EAs and indicators relating to moutaki... 22 replies
InterbankFX has loaded its MT4 platform with custom EAs, indicators and scripts 1 reply
The EA code as it is now cannot "see" pre-existing "manual" orders that were opened before the EA was attached to the chart in the sense of managing or controlling them. Close all existing open and pending orders on the trading account for the currency pair you are attaching the EA to before attaching the EA. Failing to do so will result in a pop-up alert with the message "Critical error: Failed to place order after 2 attempts". After attaching the EA and following these steps, use the "Buy" or "Sell" button on the chart to initiate a manual order and instantly the Grid Trading Expert Advisor's operations will start
/*-------------------------------------------------------------------- Change-log: Grid Trading Expert Advisor_jonnylorenz_v4.00 Date: 2025-02-19 By: MwlRCT Filename: Grid Trading Expert Advisor_jonnylorenz_v4.00.mq4 -------------------------------------------------------------------- - Removed "StartGridButton" and all associated functionality. - Relocated "BuyButton" and "SellButton" to the far-right side of the chart. - Added "+" and "-" buttons for adjusting current lot size ("LotSizePlusButton", "LotSizeMinusButton"). - Added "+" and "-" buttons for adjusting current lot increment ("LotIncrementPlusButton", "LotIncrementMinusButton"). - Added "LotSizeLabel" to display the current lot size. - Added "LotIncrementLabel" to display the current lot increment. - Implemented dynamic UI updates on chart resize (CHARTEVENT_CHART_CHANGE). - Removed input parameters: manualLotSize, orderExpirationMinutes. - Renamed input parameter: initialLotSize to InitialLotSizeForManualTrade. - Added global variables: currentLotSize, currentLotIncrement, lotSizeStep, lotIncrementStep. - Initialized currentLotSize and currentLotIncrement in OnInit(). - Modified ExecuteManualTrade to place the first pending order 50 pips away, using currentLotIncrement. - Modified ManageGrid to use a fixed 50-pip grid spacing and the correct lot size calculation. - Added AdjustLotSize and AdjustLotIncrement functions for +/- button functionality. - Updated CreateChartObjects to handle UI creation and dynamic resizing, using WindowWidth(). - Ensured all helper functions use currentLotSize and currentLotIncrement correctly. - Added comprehensive error handling in PlacePendingOrder. - Performed thorough code cleanup and added comments for clarity. - Verified correct functionality in both visual mode and Strategy Tester. - Fixed grid spacing to 50 pips for pending order. --------------------------------------------------------------------*/
Disliked{quote} Dear MwIRCT, Dear Best Trader EV unfortunately we are not there yet. There are some things that I do not understand, and I would like to make it easier for everyone by making the following changes: Once the manual Sell is opened, as you can see from the attached chart, it does not execute the grid set to 50 Pips by default which I assume are 50 points and not Pips. Please specify if they are Points or Pips. Thanks 1- Remove the gray label " Start Grid " from the chart and I do not understand what it is for. If active, does it execute the...Ignored
Disliked{quote} Sorry Sir, Now alerts are generated on attaching to chart and alerts every min for all instruments with M1 setting.... Problem 1.... still checking on M5 setting also.Ignored
- Specific Problem: - Expected Behavior: - Current Behavior: - Previous Attempts: - Questions/Concerns:
The logic of the indicator remains the same—just adding these alerts and visual signals. Let me know if you need the indicator file. Thanks in advance for your help!
Best regards,
/*-------------------------------------------------------------------- Change-log: 2slopeBs_hgeus Date: 19-02-2025 By: MwlRCT -------------------------------------------------------------------- - Implemented Logic Direction Reversal Feature. - Added input parameter 'logic_direction' to allow users to select between DirectLogic and ReversalLogic trading modes. - Modified entry signal logic (buysignal, sellsignal) to reverse buy/sell decisions when 'logic_direction' is set to ReversalLogic. - Modified closing signal logic (closebuy, closesell) to align with the reversed entry signals in ReversalLogic mode. --------------------------------------------------------------------*/
extern LogicDirection logic_direction = DirectLogic; // Corrected declaration
//+------------------------------------------------------------------+ //| 2slopeBs_hgeus.mq4 | //| Copyright 2020, Fxautomated.com | //| http://www.fxautomated.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2020, Fxautomated.com" #property link "http://www.fxautomated.com" #property version "1.02" #property strict // Define enum for logic direction enum LogicDirection { DirectLogic, ReversalLogic }; //---- input parameters extern double Lots=0.1; extern int Slip=5; extern string StopSettings="Set stops below"; extern double TakeProfit=150; extern double StopLoss=100; extern string TrailingStopSettings="Settings for trailing stop"; // trailing stop extern bool AllowTrailingStop=true; extern int TrailDistance=50; extern int TrailTrigger=50; extern double TrailStepPips=5; extern bool AllowBuy=true; extern bool AllowSell=true; extern bool CloseOnReverseSignal=true; extern string TimeSettings="Set the time range the EA should trade"; extern string StartTime="00:00"; extern string EndTime="23:59"; extern string SlopeDirection="Settings for slope indicator"; input string SlopeTerminalName="Slope_Direction_Line_Alert"; extern int speriod=20; extern int method=1; // MODE_SMA extern int price=0; extern string SecondSlopeDirection="Settings for slope indicator"; extern int speriod2=40; extern int method2=1; // MODE_SMA extern int price2=0; extern string BsTrendIndicatorSettings="Settings for bstrend indicator"; extern bool AllowBsTrend=true; extern int period=12; extern string MagicNumbers="Set different magicnumber for each timeframe of a pair"; extern int MagicNumber=1003; //---- Logic Direction Setting ---- extern string LogicDirectionSettings="Logic Direction Settings"; extern LogicDirection logic_direction = DirectLogic; // Corrected declaration string freeze; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int init() { return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { //---- int StopMultd=10; int Slippage=Slip*StopMultd; int i, closesell=0, closebuy=0; double TP=NormalizeDouble(TakeProfit*StopMultd,Digits); double SL=NormalizeDouble(StopLoss*StopMultd,Digits); //-------------------------------------------------------------------+ //Check open orders //-------------------------------------------------------------------+ int haltbuy=0, haltsell=0; if(OrdersTotal()>0) { for(i=1; i<=OrdersTotal(); i++) // Cycle searching in orders { if(OrderSelect(i-1,SELECT_BY_POS)==true) // If the next is available { if(OrderMagicNumber()==MagicNumber && OrderSymbol()==Symbol() && OrderType()==OP_BUY) { haltbuy=1; } if(OrderMagicNumber()==MagicNumber && OrderSymbol()==Symbol() && OrderType()==OP_SELL) { haltsell=1; } } } } //-------------------------------------------------------------------+ // time check //------------------------------------------------------------------- int TradeTimeOk; if((TimeCurrent()>=StrToTime(StartTime)) && (TimeCurrent()<=StrToTime(EndTime))) { TradeTimeOk=1; } else { TradeTimeOk=0; } //----------------------------------------------------------------- // indicator checks //----------------------------------------------------------------- // BsTrend double Bsbc0=iCustom(NULL,0,"bstrend-indicator",period,0,0); double Bsbc1=iCustom(NULL,0,"bstrend-indicator",period,0,1); double Bsbc2=iCustom(NULL,0,"bstrend-indicator",period,0,2); // slope1 double SlopeBlue0=iCustom(NULL,0,SlopeTerminalName,speriod,method,price,1,1,1,0); double SlopeBlue1=iCustom(NULL,0,SlopeTerminalName,speriod,method,price,1,1,1,1); double SlopeRed0=iCustom(NULL,0,SlopeTerminalName,speriod,method,price,1,1,2,0); double SlopeRed1=iCustom(NULL,0,SlopeTerminalName,speriod,method,price,1,1,2,1); // slope2 double Slope2Blue0=iCustom(NULL,0,SlopeTerminalName,speriod2,method2,price2,1,1,1,0); double Slope2Blue1=iCustom(NULL,0,SlopeTerminalName,speriod2,method2,price2,1,1,1,1); double Slope2Red0=iCustom(NULL,0,SlopeTerminalName,speriod2,method2,price2,1,1,2,0); double Slope2Red1=iCustom(NULL,0,SlopeTerminalName,speriod2,method2,price2,1,1,2,1); //-----------------compute indicators--------------------------------------- // Bstrend string BsFil="none"; if(Bsbc0>0&&Bsbc1>0/*&&Bsbc2>0*/) { BsFil="buy"; } if(Bsbc0<0&&Bsbc1<0/*&&Bsbc2<0*/) { BsFil="sell"; } if(AllowBsTrend==false) { BsFil="off"; } // slope1 string slope1="none"; if(SlopeBlue1!=EMPTY_VALUE) { slope1="blue"; } if(SlopeRed1!=EMPTY_VALUE) { slope1="red"; } // slope2 string slope2="none"; if(Slope2Blue1!=EMPTY_VALUE) { slope2="blue"; } if(Slope2Red1!=EMPTY_VALUE) { slope2="red"; } //------------------opening criteria------------------------ bool buysignal, sellsignal; if(logic_direction == DirectLogic) { if((BsFil=="buy"||BsFil=="off")&&slope1=="blue"&&slope2=="blue") { buysignal=true;} else { buysignal=false; } if((BsFil=="sell"||BsFil=="off")&&slope1=="red"&&slope2=="red") { sellsignal=true;} else { sellsignal=false; } } else { // Reversal Logic // In Reversal Logic mode: // Original Sell signal conditions now trigger a BUY signal if((BsFil=="sell"||BsFil=="off")&&slope1=="red"&&slope2=="red") { buysignal=true;} else { buysignal=false; } // Original Buy signal conditions now trigger a SELL signal if((BsFil=="buy"||BsFil=="off")&&slope1=="blue"&&slope2=="blue") { sellsignal=true;} else { sellsignal=false; } } //------------------------------closing criteria-------------- if(logic_direction == DirectLogic) { if(sellsignal==true) { closebuy=1; } else { closebuy=0; } if(buysignal==true) { closesell=1; } else { closesell=0; } } else { // Reversal Logic // In Reversal Logic mode: // Reversed Buy signal (original Sell logic) now triggers closing of BUY orders if(buysignal==true) { closebuy=1; } else { closebuy=0; } // Reversed Sell signal (original Buy logic) now triggers closing of SELL orders if(sellsignal==true) { closesell=1; } else { closesell=0; } } //----------------------------------------------------------------------------------------------------- // Opening criteria //----------------------------------------------------------------------------------------------------- int openbuy=0, opensell=0; // Open buy if((buysignal==true) && (closebuy!=1) && (freeze!="Buying trend") && (TradeTimeOk==1)) { if(AllowBuy==true && haltbuy!=1) openbuy=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,0,0,"Xtrader hgeus buy order",MagicNumber,0,Blue); } // Open sell if((sellsignal==true) && (closesell!=1) && (freeze!="Selling trend") && (TradeTimeOk==1)) { if(AllowSell==true && haltsell!=1) opensell=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,0,0,"Xtrader hgeus sell order",MagicNumber,0,Red); } if(buysignal==true) { freeze="Buying trend"; } if(sellsignal==true) { freeze="Selling trend"; } //------------------------------------------------------------------------------------------------- // Closing criteria //------------------------------------------------------------------------------------------------- if(closesell==1 || closebuy==1 || openbuy<1 || opensell<1) { if(OrdersTotal()>0) { for(i=1; i<=OrdersTotal(); i++) { if(OrderSelect(i-1,SELECT_BY_POS)==true) { if(CloseOnReverseSignal==true) { if(OrderMagicNumber()==MagicNumber && closebuy==1 && OrderType()==OP_BUY && OrderSymbol()==Symbol()) { bool oc1=OrderClose(OrderTicket(),OrderLots(),Bid,Slippage,CLR_NONE); } if(OrderMagicNumber()==MagicNumber && closesell==1 && OrderType()==OP_SELL && OrderSymbol()==Symbol()) { bool oc2=OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,CLR_NONE); } } // set stops // Calculate take profit double tpb=NormalizeDouble(OrderOpenPrice()+TP*Point,Digits); double tps=NormalizeDouble(OrderOpenPrice()-TP*Point,Digits); // Calculate stop loss double slb=NormalizeDouble(OrderOpenPrice()-SL*Point,Digits); double sls=NormalizeDouble(OrderOpenPrice()+SL*Point,Digits); if(TakeProfit>0) { if((OrderMagicNumber()==MagicNumber) && (OrderTakeProfit()==0) && (OrderSymbol()==Symbol()) && (OrderType()==OP_BUY)) { bool om1=OrderModify(OrderTicket(),0,OrderStopLoss(),tpb,0,CLR_NONE); } if((OrderMagicNumber()==MagicNumber) && (OrderTakeProfit()==0) && (OrderSymbol()==Symbol()) && (OrderType()==OP_SELL)) { bool om2=OrderModify(OrderTicket(),0,OrderStopLoss(),tps,0,CLR_NONE); } } if(StopLoss>0) { if((OrderMagicNumber()==MagicNumber) && (OrderStopLoss()==0) && (OrderSymbol()==Symbol()) && (OrderType()==OP_BUY)) { bool om3=OrderModify(OrderTicket(),0,slb,OrderTakeProfit(),0,CLR_NONE); } if((OrderMagicNumber()==MagicNumber) && (OrderStopLoss()==0) && (OrderSymbol()==Symbol()) && (OrderType()==OP_SELL)) { bool om4=OrderModify(OrderTicket(),0,sls,OrderTakeProfit(),0,CLR_NONE); } } } } } } //--------------Trailing stop------------------------------- TrailStop(AllowTrailingStop,TrailDistance,TrailTrigger,TrailStepPips,MagicNumber); //---- Error Handling int Error=GetLastError(); if(Error==130) { Alert("Wrong stops. Retrying."); RefreshRates(); } if(Error==133) { Alert("Trading prohibited."); } if(Error==2) { Alert("Common error."); } if(Error==146) { Alert("Trading subsystem is busy. Retrying."); Sleep(500); RefreshRates(); } //---- return(0); } //+--------------------------------End----------------------------------+ //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void TrailStop(bool tsActive,int tsDistance,int tsTrigger,double tsStep,int tsMagicNumber) { if(OrdersTotal()>0) { for(int tsi=1; tsi<=OrdersTotal(); tsi++) { if(OrderSelect(tsi-1,SELECT_BY_POS)==true && OrderMagicNumber()==tsMagicNumber && OrderSymbol()==Symbol()) { if(tsActive==true) { double FinalTrailDistance=tsDistance*Point; int FinalTrailTrigger=tsTrigger; double FinalTrailTriggerPoint=FinalTrailTrigger*Point; double TrailStepR=tsStep*Point; if(OrderType()==OP_BUY) { if((OrderStopLoss()<Bid-(FinalTrailDistance+TrailStepR) && Bid-OrderOpenPrice()>FinalTrailTriggerPoint) || ((OrderStopLoss()==0 || OrderStopLoss()<OrderOpenPrice()) && Bid-OrderOpenPrice()>FinalTrailTriggerPoint) ) { double newbsl=Bid-FinalTrailDistance; if(Bid-newbsl>SYMBOL_TRADE_FREEZE_LEVEL*_Point) { bool tsOrdMod1=OrderModify(OrderTicket(),OrderOpenPrice(),newbsl,OrderTakeProfit(),0,Yellow); } } } if(OrderType()==OP_SELL) { if((OrderStopLoss()>Ask+(FinalTrailDistance+TrailStepR) && OrderOpenPrice()-Ask>FinalTrailTriggerPoint) || ((OrderStopLoss()==0 || OrderStopLoss()>OrderOpenPrice()) && OrderOpenPrice()-Ask>FinalTrailTriggerPoint) ) { double newssl=Ask+FinalTrailDistance; if(newssl-Ask>SYMBOL_TRADE_FREEZE_LEVEL*_Point) { bool tsOrdMod2=OrderModify(OrderTicket(),OrderOpenPrice(),newssl,OrderTakeProfit(),0,Yellow); } } } } } } } } //------------------------------------------------------------------------------------
DislikedDear Coders, is it possible to make a reverse option in this EA? (sell instead of buy and buy instead of sell) I would be very grateful. {file}Ignored
DislikedNota bene: il codice EA, così com'è, non può "vedere" gli ordini "manuali" preesistenti che sono stati aperti prima che l'EA fosse associato al grafico, nel senso di gestirli o controllarli. Chiudi tutti gli ordini aperti e in sospeso esistenti sul conto di trading per la coppia di valute a cui stai associando l'EA prima di associare l'EA. In caso contrario, verrà visualizzato un avviso pop-up con il messaggio "Errore critico: impossibile effettuare l'ordine dopo 2 tentativi". Dopo aver collegato l'EA e seguito questi passaggi, usa il pulsante "Acquista"...Ignored
- Specific Problem: - Expected Behavior: - Current Behavior: - Previous Attempts: - Questions/Concerns:
DislikedCan you fix them perhaps with larger buttons on the right side of the chart under the EA writing ?? .Ignored
Dislikedsetting with a value of 3 pips to see if the second operation enters. Should I give a value of 30 if it were in point ?? Or 0.3 ?? Let me know. Thanks.Ignored
Disliked{quote} - Specific Problem: - Expected Behavior: - Current Behavior: - Previous Attempts: - Questions/Concerns:Ignored
Disliked/*-------------------------------------------------------------------- Change-log: 2slopeBs_hgeus Date: 19-02-2025 By: MwlRCT -------------------------------------------------------------------- - Implemented Logic Direction Reversal Feature. - Added input parameter 'logic_direction' to allow users to select between DirectLogic and ReversalLogic trading modes. - Modified entry signal logic (buysignal, sellsignal) to reverse buy/sell decisions when 'logic_direction' is set to ReversalLogic. - Modified closing signal logic (closebuy, closesell) to...Ignored
DislikedCan anyone help me code mq4 code into mq5 EA code?, it's been 2.5 years i have been trying to solve the code but every time i am being unsuccessful. is there anyone here who can help me convert mq4 indicator code into mq5 EA code? {file}Ignored
/*-------------------------------------------------------------------- Change-log: Gann High-Low_Cross_Dashboard_With_Alert_1.04 Date: 19-02-2025 By: MwlRCT -------------------------------------------------------------------- - Refactored Alert Trigger Logic: - Modified the `SendNotifications` function within the `ValueCell` class to trigger alerts only when the Gann direction changes compared to the previous bar's direction. - Introduced the `_previousDirection` member variable in the `ValueCell` class to store the previous direction for each symbol/timeframe combination. - Removed the redundant `_lastDatetime` check, as alerts are now triggered based on direction change, not time. - Ensured alerts are triggered at the beginning of the new bar following the direction change, effectively at candle close. - Reduced Initial Alerting (Improved): - Removed the `isInitialRun` variable and related logic for managing initial alerts. - Initializing the `_previousDirection` variable to neutral (0) in the `ValueCell` constructor now *reduces* spurious alerts on indicator initialization and MT4 restarts. Specifically, it prevents an immediate alert if the initial Gann direction is neutral. However, if the Gann direction is initially Up or Down upon indicator load, a single alert *may* still be triggered on the first tick, as this is technically a change from the initialized neutral state. Further logic to completely suppress all alerts on initial load was deemed unnecessary as the current implementation significantly mitigates the issue. - Formatted Alert Messages: - Modified the `alert_Body` and `alert_Subject` within `SendNotifications` to generate alert messages in the following formats: - Upward Change: "HiLo Cross on [Symbol]/[Timeframe] : Up" - Downward Change: "HiLo Cross on [Symbol]/[Timeframe] : Dn" - Neutral to Up: "HiLo Cross on [Symbol]/[Timeframe] : Up" - Neutral to Down: "HiLo Cross on [Symbol]/[Timeframe] : Dn" - No alert is generated when changing from Up/Down to Neutral. - Improved Code Robustness: - Changed the `GetTimeFrame()` return to `""` when period not found. - Added final `else` statement to `SendNotifications()` function for completeness. --------------------------------------------------------------------*/
Disliked{quote} Specific Problem : and Current Behaviour : with respect to this file posted by you.{file} (A) On attaching the dashboard to the chart or restarting MT4, it generates alerts for all instruments on the dashboard which show arrows Up/Dn on chart in the form of "HiLo cross on EURUSD/H4". (B) If MI timeframe is selected it will generate similar alerts every minute at the close of M1 candle.. Same for all other timeframes. (C) no alerts are generated if the color is neutral. Expected Behaviour : (A) There should be no alerts when the dashboard...Ignored
Disliked{quote} Dear MwIRCT, Unfortunately the ex4 file does not work and also when I put your addition code in the original code I get the following error when compiling. Can you tell me what to do about it? Regards. {image}Ignored