Specification
here's the code,
+------------------------------------------------------------------+
//| kama.mq4 |
//| Copyright 2022, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//| Heikin/Kaufman Strategy Expert Advisor |
//| By OpenAI (ChatGPT) |
//+------------------------------------------------------------------+
// Inputs
input int Length = 5;
input double Fastend = 2.5;
input int Slowend = 20;
input int test = 0;
input int sloma = 20;
// Indicator buffers
double nAMABuffer[];
double fmaBuffer[];
double smaBuffer[];
double ha_closeBuffer[];
double mha_closeBuffer[];
// External variables
extern double LotSize = 0.01; // Trading lot size
extern int StopLoss = 50; // Stop loss in pips
extern int TakeProfit = 100; // Take profit in pips
// Trading parameters
int ticket = -1;
int slippage = 3;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void OnCalculate(const int rates_total, const int prev_calculated, const datetime& time[], const double& open[], const double& high[], const double& low[], const double& close[], const long& tick_volume[], const long& volume[], const int& spread[])
{
int start = prev_calculated > 0 ? prev_calculated - 1 : 0;
ArrayResize(nAMABuffer, rates_total);
ArrayResize(fmaBuffer, rates_total);
ArrayResize(smaBuffer, rates_total);
ArrayResize(ha_closeBuffer, rates_total);
ArrayResize(mha_closeBuffer, rates_total);
double nfastend = 2 / (Fastend + 1);
double nslowend = 2 / (Slowend + 1);
for(int i = start; i < rates_total; i++)
{
double xPrice = (high[i] + low[i] + close[i]) / 3;
double xvnoise = MathAbs(xPrice - xPrice[test]);
double nsignal = MathAbs(xPrice - xPrice[i - Length]);
double nnoise = 0;
for(int j = i - Length + 1; j <= i; j++)
{
double xv = MathAbs((high[j] + low[j] + close[j]) / 3 - (high[j - 1] + low[j - 1] + close[j - 1]) / 3);
nnoise += xv;
}
double nefratio = nnoise != 0 ? nsignal / nnoise : 0;
double nsmooth = MathPow(nefratio * (nfastend - nslowend) + nslowend, 2);
nAMABuffer[i] = i > 0 ? nAMABuffer[i - 1] + nsmooth * (xPrice - nAMABuffer[i - 1]) : xPrice;
int ha_t = iCustom(NULL, 0, "Heikin Ashi", 0, i);
ha_closeBuffer[i] = iCustom(NULL, 0, "Heikin Ashi", 2, i, ha_t);
mha_closeBuffer[i] = iCustom(NULL, res1, "Heikin Ashi", 1, i, ha_t);
if(i >= test)
{
fmaBuffer[i] = iMAOnArray(mha_closeBuffer, rates_total, 1, 0, test, i);
}
if(i >= sloma)
{
smaBuffer[i] = iMAOnArray(ha_closeBuffer, rates_total, sloma, 0, MODE_EMA, i);
}
}
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int OnInit()
{
SetIndexBuffer(0, fmaBuffer);
SetIndexBuffer(1, smaBuffer);
SetIndexStyle(0, DRAW_LINE);
SetIndexStyle(1, DRAW_LINE);
SetIndexLabel(0, "MA");
SetIndexLabel(1, "SMA");
double emptyBufferArray[];
{
int totalBars = ArraySize(open); // Retrieve the size of the 'open' array
int start = prev_calculated > 0 ? prev_calculated - 1 : 0;
// Rest of your code...
for(int i = start; i < totalBars; i++)
{
// Processing for each bar
}
// Rest of your code...
}
SetIndexBuffer(2, emptyBufferArray, INDICATOR_DATA);
double emptyBufferArray2[];
ArrayResize(emptyBufferArray2, rates_total);
SetIndexBuffer(3, emptyBufferArray2, INDICATOR_DATA);
SetIndexStyle(2, DRAW_ARROW);
SetIndexStyle(3, DRAW_ARROW);
SetIndexArrow(2, SYMBOL_ARROWUP);
SetIndexArrow(3, SYMBOL_ARROWDOWN);
SetIndexEmptyValue(2, 0);
SetIndexEmptyValue(3, 0);
return INIT_SUCCEEDED;
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
ArrayFree(nAMABuffer);
ArrayFree(fmaBuffer);
ArrayFree(smaBuffer);
ArrayFree(ha_closeBuffer);
ArrayFree(mha_closeBuffer);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void OnTick()
{
if(ticket == -1 && OrdersTotal() == 0)
{
int rates_total = RatesTotal();
int start = MathMax(0, rates_total - 1 - 1000);
for(int i = start; i < rates_total; i++)
{
if(fmaBuffer[i - 1] > smaBuffer[i - 1] && fmaBuffer[i] < smaBuffer[i])
{
ObjectCreate("CrossUnder", OBJ_TRIANGLE, 0, Time[i], High[i], 0);
ObjectSet("CrossUnder", OBJPROP_STYLE, STYLE_SOLID);
ObjectSet("CrossUnder", OBJPROP_WIDTH, 1);
ObjectSet("CrossUnder", OBJPROP_BACK, Red);
ObjectSetText("CrossUnder", "S", 8, "Arial", Red);
}
}
if(fmaBuffer[rates_total - 2] > smaBuffer[rates_total - 2] && fmaBuffer[rates_total - 1] < smaBuffer[rates_total - 1])
{
ticket = OrderSend(Symbol(), OP_BUY, LotSize, Ask, slippage, Ask - StopLoss * Point, Ask + TakeProfit * Point);
if(ticket < 0)
Print("Error opening buy order:", GetLastError());
}
else
{
if(ticket == -1 && OrdersTotal() == 0)
{
int crossUnderBar = -1;
{
if(fmaBuffer[i - 1] > smaBuffer[i - 1] && fmaBuffer[i] < smaBuffer[i])
{
crossUnderBar = i;
}
}
if(crossUnderBar != -1)
{
double crossUnderPrice = Low[crossUnderBar];
ObjectCreate("CrossUnder", OBJ_TRIANGLE, 0, Time[crossUnderBar], crossUnderPrice, 0);
ObjectSet("CrossUnder", OBJPROP_STYLE, STYLE_SOLID);
ObjectSet("CrossUnder", OBJPROP_WIDTH, 1);
ObjectSet("CrossUnder", OBJPROP_BACK, Red);
ObjectSetText("CrossUnder", "S", 8, "Arial", Red);
}
// Rest of your code...
}
// Rest of your code...
}
{
ticket = OrderSend(Symbol(), OP_SELL, LotSize, Bid, slippage, Bid + StopLoss * Point, Bid - TakeProfit * Point);
if(ticket < 0)
Print("Error opening sell order:", GetLastError());
}
}
if(ticket >= 0)
{
if(OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES))
{
if(OrderType() == OP_BUY && Bid - OrderStopLoss() > TakeProfit * Point)
{
if(OrderModify(ticket, OrderOpenPrice(), Bid - TakeProfit * Point, OrderTakeProfit(), 0, Green))
{
ticket = -1;
}
else
{
Print("Error modifying buy order:", GetLastError());
}
}
else
if(OrderType() == OP_SELL && OrderStopLoss() - Ask > TakeProfit * Point)
{
if(OrderModify(ticket, OrderOpenPrice(), Ask + TakeProfit * Point, OrderTakeProfit(), 0, Green))
{
ticket = -1;
}
else
{
Print("Error modifying sell order:", GetLastError());
}
}
}
else
{
Print("Error selecting order:", GetLastError());
ticket = -1;
}
}
}
//+------------------------------------------------------------------+
Responded
1
Rating
Projects
968
46%
Arbitration
32
38%
/
34%
Overdue
96
10%
Free
Published: 6 codes
2
Rating
Projects
72
22%
Arbitration
13
46%
/
15%
Overdue
5
7%
Free
3
Rating
Projects
641
41%
Arbitration
23
52%
/
30%
Overdue
46
7%
Working
4
Rating
Projects
10
50%
Arbitration
6
17%
/
50%
Overdue
3
30%
Working
5
Rating
Projects
226
80%
Arbitration
18
33%
/
44%
Overdue
11
5%
Working
Published: 24 articles, 1882 codes
6
Rating
Projects
18
28%
Arbitration
3
67%
/
33%
Overdue
1
6%
Free
7
Rating
Projects
195
72%
Arbitration
0
Overdue
0
Free
8
Rating
Projects
102
23%
Arbitration
12
25%
/
17%
Overdue
13
13%
Free
9
Rating
Projects
194
42%
Arbitration
10
10%
/
40%
Overdue
9
5%
Working
Published: 3 codes
10
Rating
Projects
73
5%
Arbitration
33
15%
/
36%
Overdue
6
8%
Working
Similar orders
I need an Expert advisor based on AOX signal . it must have check and handing of trade operation..errors. The main criterin for opening and dosing a position : moving average direction the price is higher than the previous bar Trade lots is input parameter bar
Here's a detailed description of a Trend Following and Mean Reversion strategy-based Expert Advisor (EA): Strategy Overview The EA will implement a hybrid strategy combining trend following and mean reversion techniques. It will identify trending markets, ride the trend, and also capitalize on mean reversion opportunities
Overview Create a MetaTrader 5 (MT5) indicator that: Pulls live sentiment data from multiple broker APIs. Calculates Net Sentiment (Long% – Short%) and plots each broker as a moving average line on the chart. Displays a weighted average line when ≥2 feeds are active. Saves all data to CSV files per broker for efficient historical loading and performance. Supported Brokers Broker Abbr. Color OandaFX
I Have A project done dusted For sale; Title: Strong Reversal Indicator [No Repaint, No Offset, Low Lag] 17 minutes ago MQL5 Indicators Design Forex Trading robot/indicator debugging Strategy optimization Statistics and mathematics Strategy modules Uploading data to a website Specification EN Overview: A professional MT5 reversal indicator designed to detect market turning points with no repainting, no
Safe Monthly Profit Strategy
30 - 60 USD
Manage my live forex account with a disciplined, low-risk approach that produces steady monthly income. My priority is capital protection, so each trade must be sized conservatively, anchored by firm stop-loss orders, and designed to keep drawdown minimal. High-risk tactics such as martingale, grid systems, or excessive leverage are off the table; a measured, rules-based strategy is essential. I will connect the
Supply Demand Indicator MT4/MT5 Trading....
30 - 60 USD
Indicator that finds zones. All details in word document Ask questions if need I’d also like to to change from finding bullish marker and main candles to bearish marker and main candles if price crosses past inputted price The document is showing zones for bullish price action. Id like to also change manually in setting for it to show bearish price action ( it will look for bullish candle markers and main) Zones
EA Pair Limit Remover & Port
30 - 60 USD
I already have an Expert Advisor coded in MQL4, but it refuses to trade anything other than its hard-coded symbol. I want that filter gone so the same strategy can fire on any instrument—forex, indices, metals such as XAUUSD—across any timeframe. The trading logic, money management and inputs must stay exactly as they are; I simply need universal symbol support. After the MT4 file is fixed and compiles cleanly, I
Description: Gildepak is a purchasing cooperative for packaging materials. We need a program to calculate and fairly distribute the annual bonus (received from preferred suppliers) among our member companies (partners and members). The program should work with a set of predefined tables and data flows, and it must be able to import and export Excel files. Main Tables: Member Companies Company ID Company Name Partner
PLEASE READ: IF YOU ARE NOT GOING TO ACCEPT THE BELOW THEN PLEASE MOVE ON TO THE NEXT CLIENT. I NEED SOMEONE WHO WILL DO THE WORK FIRST AND THEN CREATE A BUILT-IN DEMO INDI AS PER SPECIFICATIONS BELOW WHICH HAS AN EXPIRY (A DAY OR 2) SO THAT I TEST THE INDI BEFORE WE CREATE THE ORDER. I HAVE HAD PEOPLE WHO PRESSURE ME TO CREATE THE ORDER AND THEN THEY END UP DEVELOPING A FAULTY INDICATOR. AND I HAVE GIVEN THEM THE
Fractal Multi-Timeframe Strategy (H4→M15→M2) — Developer Spec Abstract This document specifies a fractal trading workflow leveraging H4 for regime identification, M15 for Area of Value (AoV) location, and M2 for execution using CHoCH-based triggers. The goal is a robust, developer-friendly specification that minimizes ambiguity and matches the operational style already discussed (Liquidity → Order Block →
Project information
Budget
40+ USD
For the developer
36
USD