SIR, YOU ARE GREAT, thank you sooooooooooo much now its working as i imagine, if could please send the mq4 file just IF YOU WANT,
MY BEST REGARDS TO YOU SIR.


MY BEST REGARDS TO YOU SIR.
1
I will code your pivot EAs for no charge 28 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
//+------------------------------------------------------------------+
//| EA_lsma_editing.mq4 |
//| Mr.Sun |
//| |
//+------------------------------------------------------------------+
#property strict
//---- base parameters:
input int KPeriod = 15; // Stochastic K period (9-26)
input int DPeriod = 3; // Stochastic D period (3-12)
input int Slowing = 5; // Stochastic slowing (3-6)
input ENUM_MA_METHOD MAMethod = MODE_LWMA; // Stochastic ma method
input ENUM_STO_PRICE PriceField = STO_LOWHIGH; // Stochastic price
input int LSMAPeriod = 26; // Smoothing period (9-52)
double lsma_sto[], sto[];
bool Sell_lsma;
bool Buy_lsma;
//---- setting for ORDER:
extern int pips_SL = 5000;
extern int pips_TP = 5000;
double lot = 0.01;
int ticket,i,j;
bool close,modify;
int bar_count=0;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//Set array sto + lsma
ArraySetAsSeries(sto, true);
ArrayResize(sto, KPeriod+DPeriod+Slowing);
ArraySetAsSeries(lsma_sto, true);
ArrayResize(lsma_sto, LSMAPeriod);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//------------------------------------//
//------- LSMA -----------------------//
//------------------------------------//
int limit = Bars - 1;
for(i = KPeriod+DPeriod+Slowing-1; i >= 0; i--)
{
sto[i] = iStochastic(NULL, 0, KPeriod, DPeriod, Slowing, MAMethod, PriceField, MODE_MAIN, i);
}
double lsma_sto1 = 3.0 * iMAOnArray(sto, 0, LSMAPeriod, 0, MODE_LWMA, 1) - 2.0 * iMAOnArray(sto, 0, LSMAPeriod, 0, MODE_SMA, 1);
double lsma_sto2 = 3.0 * iMAOnArray(sto, 0, LSMAPeriod, 0, MODE_LWMA, 2) - 2.0 * iMAOnArray(sto, 0, LSMAPeriod, 0, MODE_SMA, 2);
if (lsma_sto1 > lsma_sto2)
{
Buy_lsma = 1;
Sell_lsma =0;
}
if (lsma_sto1 < lsma_sto2)
{
Buy_lsma =0;
Sell_lsma = 1;
}
//------------------------------------//
//----------- BUY ---------------//
//------------------------------------//
if (Buy_lsma ==1 )
{
//---- Close SELL
for(i=OrdersTotal()-1;i>=0;i--)
{
if (OrderSelect(i,SELECT_BY_POS)==true&& OrderSymbol() == Symbol() && OrderType() ==1)
{
ticket = OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),10,clrNONE);
if (ticket<0&& GetLastError() != 0)
Alert("Loi close market: ",GetLastError());
}
}
//----------------------- BUY -------------------------
if((Bars - bar_count) >0 )
{
int ID_BUY = OrderSend(NULL,OP_BUY,lot,Ask,10,Ask - pips_SL*Point,Ask + pips_TP*Point);
bar_count = Bars;
}
}
//------------------------------------//
//----- SELL --------------------//
//------------------------------------//
if(Sell_lsma ==1)
{
//---- Close BUY
for(i=OrdersTotal()-1;i>=0;i--)
{
if (OrderSelect(i,SELECT_BY_POS)==true&& OrderSymbol() == Symbol())
{
if (OrderType()==0) // Close Buy order
{
ticket = OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),10,clrNONE);
if (ticket<0&& GetLastError() != 0)
Alert("Error close market: ",GetLastError());
}
}
}
//--------------- SELL -----------------------
if((Bars - bar_count) > 0)
{
int ID_SELL = OrderSend(NULL,OP_SELL,lot,Bid,10,Bid + pips_SL*Point,Bid - pips_TP*Point);
bar_count = Bars;
}
}
} Disliked{quote} thanks bro .may be you have magic wand !! everything ready available hahah lol.may GOd bless you.Ignored
Disliked{quote} /*-------------------------------------------------------------------- Change-log: sm3BarFractalBreak MTF v2.3.2 Date: 31-12-2024 By: MwlRCT -------------------------------------------------------------------- - Fixed "array out of range" error by initializing MTF arrays with `ArrayResize`: - Added `ArrayResize` for `mtfArrowUP`, `mtfArrowDN`, `mtfArrowFractalUP`, and `mtfArrowFractalDN` to match `barsToCopy`. - Ensured arrays are properly sized before data assignment to prevent out-of-range access. - Verified functionality through compilation...Ignored
Disliked{quote} {image} /*-------------------------------------------------------------------- Change-log: Smoothed LWMA (mtf+alerts+arrows)_EA_v1.2.1 Date: 2025-01-08 By: MwlRCT -------------------------------------------------------------------- - Implemented Equity Drop Protection and Drawdown Pause (v1.2.1): - Introduced `EquityDropThreshold` to allow users to specify the percentage drop in equity that triggers a trading halt. - Added `EnableDrawdownPause` to enable/disable the drawdown pause feature. - Added `PauseDurationMinutes` to allow users to...Ignored
Disliked2025.01.08 20:30:23.861 Smoothed LWMA (mtf+alerts+arrows)_EA_rev1.2.1 XAUUSD,H1: Trade closed on opposite signal: 208741862Ignored
input bool CloseOnOppositeSignal = FALSE; // Enable/Disable closing trades on opposite signal
Disliked1. first higher time frame for M15
2. second higher time frame for M30
3. third higher time frame for M60
Thus showing the lines for M15, M30 and M60 on M5 chartIgnored
/*--------------------------------------------------------------------
Change-log: sm3BarFractalBreak MTF v2.4.0
Date: 08-01-2025
By: MwlRCT
--------------------------------------------------------------------
- Enhanced instance isolation with improved uniqueID implementation:
- Added robust object management across timeframes to ensure proper cleanup and reuse of objects.
- Improved multi-instance support to allow multiple instances of the indicator on the same chart without conflicts.
- Ensured compatibility with both current and custom timeframes.
--------------------------------------------------------------------*/ DislikedPlease i need very simple indicator which draw 2 diagonals lines same in picture attached what ever the time frame is or even what ever the candles big or small, that's it, any one can help me? {image}Ignored
Disliked{quote} Thank you for your feedback. What i have learned from your feedback: - The problem is chart scale. - and number of Bars (The number of bars visible on your chart, is not the number of bars in history) v1.1 Changes Made and Why: Visible Bars Calculation: Implemented functionality to determine the number of visible bars on the chart using ChartGetInteger(0, CHART_VISIBLE_BARS). Ensured the indicator considers only the currently visible bars, adapting to the chart's zoom level and scale. Dynamic Anchor Points: Updated the calculation of anchor...Ignored
long height = ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS,0); long width = ChartGetInteger(0,CHART_WIDTH_IN_PIXELS,0);
Disliked{quote} Maybe you could use this to get the anchor time and price for OBJ_TREND? https://docs.mql4.com/chart_operatio...txytotimeprice And: long height = ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS,0); long width = ChartGetInteger(0,CHART_WIDTH_IN_PIXELS,0); So, one line goes from x=0 and y=0 to x=CHART_WIDTH_IN_PIXELS and y=CHART_HEIGHT_IN_PIXELS. The other line goes from x=0 and y=CHART_HEIGHT_IN_PIXELS to x=CHART_WIDTH_IN_PIXELS and y=0.Ignored
Disliked{quote} /*-------------------------------------------------------------------- Change-log: sm3BarFractalBreak MTF v2.4.0 Date: 08-01-2025 By: MwlRCT -------------------------------------------------------------------- - Enhanced instance isolation with improved uniqueID implementation: - Added robust object management across timeframes to ensure proper cleanup and reuse of objects. - Improved multi-instance support to allow multiple instances of the indicator on the same chart without conflicts. - Ensured compatibility with both current and custom...Ignored
Disliked{quote} {quote} Maybe you could use this to get the anchor time and price for OBJ_TREND? https://docs.mql4.com/chart_operatio...txytotimeprice And: long height = ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS,0); long width = ChartGetInteger(0,CHART_WIDTH_IN_PIXELS,0); So, one line goes from x=0 and y=0 to x=CHART_WIDTH_IN_PIXELS and y=CHART_HEIGHT_IN_PIXELS. The other line goes from x=0 and y=CHART_HEIGHT_IN_PIXELS to x=CHART_WIDTH_IN_PIXELS and y=0. {file} This is independent of the chart graph, itself - only reads the window size in...Ignored
/*--------------------------------------------------------------------
Change-log: foxyfox_DiagLines_v1.2
Date: 2025-01-08
By: MwlRCT
--------------------------------------------------------------------
- Implemented pixel-based coordinate system: CREDIT TO @BestTraderEv
- Replaced price-based anchor points with ChartXYToTimePrice conversion
- Added real-time chart dimension tracking using CHART_WIDTH_IN_PIXELS and CHART_HEIGHT_IN_PIXELS
- Implemented automatic line repositioning on chart resize
- Performance optimizations:
- Removed dependency on visible bars calculations
- Eliminated highest/lowest price calculations
- Streamlined coordinate updates through efficient event handling
- Enhanced responsiveness:
- Added CHARTEVENT_CHART_CHANGE event handling
- Implemented immediate line updates on chart changes
- Improved corner-to-corner positioning accuracy
- Code structure improvements:
- Added modular CreateDiagonalLines() function
- Implemented global dimension tracking variables
- Enhanced error handling and stability
- Verified functionality through compilation and testing on live charts
across multiple timeframes and chart conditions.
--------------------------------------------------------------------*/ DislikedSIR, YOU ARE GREAT, thank you sooooooooooo much now its working as i imagine, if could please send the mq4 file just IF YOU WANT, MY BEST REGARDS TO YOU SIR.Ignored
Disliked{quote} Best i just downloaded a file from mq5 Market now and in launching it i got the alert that the indicator needs a little history please educate me what does that mean and how do i go about getting the HISTORY, Is it something like going to Tools ...in my mt4 .....Thanks {image}Ignored
/*--------------------------------------------------------------------
Change-log: mrsunftu_LSMA_EA_ver1
Date: 2025-01-08
By: MwlRCT
--------------------------------------------------------------------
- Fixed array out of range errors across multiple currency pairs:
- Implemented dynamic array sizing based on required calculation periods
- Added proper array bounds checking in calculations
- Fixed array initialization sequence
- Enhanced array management:
- Added safety checks for ArrayResize operations
- Implemented proper ArraySetAsSeries for both sto[] and lsma_sto[] arrays
- Added validation for minimum required bars before calculations
- Improved LSMA calculation reliability:
- Separated LWMA and SMA calculations for better error tracking
- Added validation checks for MA calculations
- Implemented proper shifting mechanism for historical values
- Added robust error handling:
- Implemented comprehensive error checking for array operations
- Added validation for iStochastic and iMAOnArray results
- Enhanced error reporting for debugging purposes
- Optimized trading logic:
- Added time-based trade filtering
- Improved signal generation validation
- Enhanced order management system
- Testing results:
- Successfully resolved array out of range errors
- Verified EA operation across multiple currency pairs
- Confirmed proper trade execution and management
--------------------------------------------------------------------*/
//
//+--------------------------------------------------------------------+
//| EA_mrsunftu_LSMAver1.mq4 |
//| Mr.Sun |
//+------------------------------------------------------------------+
#property strict
//---- Debug Mode
#define DEBUG_MODE true
//---- base parameters:
input int KPeriod = 15; // Stochastic K period (9-26)
input int DPeriod = 3; // Stochastic D period (3-12)
input int Slowing = 5; // Stochastic slowing (3-6)
input ENUM_MA_METHOD MAMethod = MODE_LWMA; // Stochastic MA method
input ENUM_STO_PRICE PriceField = STO_LOWHIGH; // Stochastic price
input int LSMAPeriod = 26; // Smoothing period (9-52)
//---- Arrays with dynamic sizing
double lsma_sto[], sto[];
bool Sell_lsma;
bool Buy_lsma;
//---- setting for ORDER:
input int pips_SL = 500;
input int pips_TP = 500;
input double lot = 0.01;
//---- Internal variables
int ticket, i;
datetime last_signal_time = 0;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
// Calculate required buffer size
int requiredBars = MathMax(Bars, KPeriod + DPeriod + Slowing + LSMAPeriod + 100);
//---- Initialize arrays with proper sizing
ArraySetAsSeries(sto, true);
ArraySetAsSeries(lsma_sto, true);
// Ensure sufficient array size
if(!ArrayResize(sto, requiredBars))
{
Print("Failed to resize Stochastic array!");
return INIT_FAILED;
}
if(!ArrayResize(lsma_sto, requiredBars))
{
Print("Failed to resize LSMA array!");
return INIT_FAILED;
}
ArrayInitialize(sto, 0);
ArrayInitialize(lsma_sto, 0);
Print("Arrays initialized - Size: ", requiredBars);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
// Ensure minimum bars
if(Bars < KPeriod + DPeriod + Slowing + LSMAPeriod)
{
Print("Not enough bars for calculation");
return;
}
//---- Update Stochastic values
int limit = MathMin(Bars - 1, ArraySize(sto) - 1);
// Calculate Stochastic
for(i = 0; i <= limit; i++)
{
sto[i] = iStochastic(NULL, 0, KPeriod, DPeriod, Slowing,
MAMethod, PriceField, MODE_MAIN, i);
}
// Safety check for array bounds
if(limit < 2)
{
Print("Not enough data for LSMA calculation");
return;
}
//---- Calculate LSMA values
double lwma1 = iMAOnArray(sto, 0, LSMAPeriod, 0, MODE_LWMA, 1);
double sma1 = iMAOnArray(sto, 0, LSMAPeriod, 0, MODE_SMA, 1);
double lwma2 = iMAOnArray(sto, 0, LSMAPeriod, 0, MODE_LWMA, 2);
double sma2 = iMAOnArray(sto, 0, LSMAPeriod, 0, MODE_SMA, 2);
// Verify calculations
if(lwma1 == 0 || sma1 == 0 || lwma2 == 0 || sma2 == 0)
{
Print("Invalid MA calculations");
return;
}
double lsma_sto1 = 3.0 * lwma1 - 2.0 * sma1;
double lsma_sto2 = 3.0 * lwma2 - 2.0 * sma2;
//---- Generate signals
bool old_buy = Buy_lsma;
bool old_sell = Sell_lsma;
Buy_lsma = (lsma_sto1 > lsma_sto2);
Sell_lsma = (lsma_sto1 < lsma_sto2);
//---- Trade management
if(Buy_lsma && !old_buy)
{
CloseOrders(OP_SELL);
if(TimeCurrent() - last_signal_time > Period() * 60)
{
OpenOrder(OP_BUY);
last_signal_time = TimeCurrent();
}
}
if(Sell_lsma && !old_sell)
{
CloseOrders(OP_BUY);
if(TimeCurrent() - last_signal_time > Period() * 60)
{
OpenOrder(OP_SELL);
last_signal_time = TimeCurrent();
}
}
}
//+------------------------------------------------------------------+
//| Order management functions |
//+------------------------------------------------------------------+
void CloseOrders(int type)
{
for(int j = OrdersTotal() - 1; j >= 0; j--)
{
if(OrderSelect(j, SELECT_BY_POS) && OrderSymbol() == Symbol() && OrderType() == type)
{
bool result = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 10, clrNONE);
if(!result) Print("Error closing order: ", GetLastError());
}
}
}
void OpenOrder(int type)
{
double price = (type == OP_BUY) ? Ask : Bid;
double sl = (type == OP_BUY) ? price - pips_SL * Point : price + pips_SL * Point;
double tp = (type == OP_BUY) ? price + pips_TP * Point : price - pips_TP * Point;
ticket = OrderSend(Symbol(), type, lot, price, 10, sl, tp, NULL, 0, 0, clrNONE);
if(ticket < 0)
Print("Error opening order: ", GetLastError());
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
Comment("");
} Disliked{quote} What file? You provide zero practical information and you expect me to what? Read your mind??? How can I know what history, if I don't know what the file is doing and I don't have the code???Ignored
Disliked{quote} Easy Best take it easy you know the file cant work on your system unless you are the one that downloaded it from MQL5 Market.Thats the reason i did not post it here sorry if im not clear enough thats why i said you should educate me .Attached is the file and its always in ex.4 as you know from Market. {file} {image}Ignored
Disliked{quote} I didn't say you had to post the file, dude! You didn't even post the name of the indicator - which would be something concrete. You're getting the alert because of this input parameter: {image} You, most probably, don't have 150 days of data on your chart.Ignored
DislikedHi bro, I am stuck on iMAonArray for EA My code is below, I compiled with no error, but nothing happen whenIgnored