Техническое задание
//+------------------------------------------------------------------+
//| AdvancedPriceAction.mq5 |
//| Copyright 2026, Trading Strategy AI |
//+------------------------------------------------------------------+
#property copyright "Trading Strategy AI"
#property version "1.00"
#property strict
#include <Trade\Trade.mqh>
input group "Trading Settings"
input double RiskPercent = 0.5;
input int MagicNumber = 123456;
input int MaxSpread = 20;
input int SlippagePoints = 10;
input bool AllowAutoTrading = true;
input bool AllowManualExit = true;
input group "Timeframe Settings"
input ENUM_TIMEFRAMES StructureTF = PERIOD_M15;
input ENUM_TIMEFRAMES SwingTF = PERIOD_M5;
input ENUM_TIMEFRAMES EntryTF = PERIOD_M1;
input group "Logic Settings"
input int SwingLookback = 120;
input int SwingDepth = 2;
input int LevelMergePoints = 25;
input int FanStepPoints = 150;
input int FanCount = 4;
input int StopBufferPoints = 20;
input int ReactionBufferPts = 15;
input double BreakoutRR = 2.0;
input double ReactionRR = 1.0;
CTrade trade;
string prefix = "APA_";
datetime last_entry_bar = 0;
double levels[];
double last_high = 0.0, last_low = 0.0;
datetime last_high_time = 0, last_low_time = 0;
double P() { return SymbolInfoDouble(_Symbol, SYMBOL_POINT); }
int SpreadPts() { return (int)SymbolInfoInteger(_Symbol, SYMBOL_SPREAD); }
double Norm(double v) { return NormalizeDouble(v, _Digits); }
double ClampLot(double lot)
{
double minv = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MIN);
double maxv = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MAX);
double step = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_STEP);
lot = MathMax(minv, MathMin(maxv, lot));
lot = MathFloor(lot / step) * step;
return NormalizeDouble(lot, 2);
}
double LotsByRisk(double sl_points)
{
if(sl_points <= 0) return ClampLot(SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MIN));
double bal = AccountInfoDouble(ACCOUNT_BALANCE);
double risk_money = bal * RiskPercent / 100.0;
double tick_value = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE);
double tick_size = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_SIZE);
if(tick_value <= 0 || tick_size <= 0) return ClampLot(SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MIN));
double value_per_point = tick_value * (P() / tick_size);
return ClampLot(risk_money / (sl_points * value_per_point));
}
bool NewBar(ENUM_TIMEFRAMES tf, datetime &stamp)
{
datetime t = iTime(_Symbol, tf, 0);
if(t == 0 || t == stamp) return false;
stamp = t;
return true;
}
bool HasOpenPosition()
{
for(int i = PositionsTotal() - 1; i >= 0; --i)
{
ulong ticket = PositionGetTicket(i);
if(ticket == 0) continue;
if(PositionGetString(POSITION_SYMBOL) == _Symbol && (int)PositionGetInteger(POSITION_MAGIC) == MagicNumber)
return true;
}
return false;
}
bool CloseByType(long pos_type = -1)
{
bool ok = true;
for(int i = PositionsTotal() - 1; i >= 0; --i)
{
ulong ticket = PositionGetTicket(i);
if(ticket == 0) continue;
if(PositionGetString(POSITION_SYMBOL) != _Symbol) continue;
if((int)PositionGetInteger(POSITION_MAGIC) != MagicNumber) continue;
long type = PositionGetInteger(POSITION_TYPE);
if(pos_type != -1 && type != pos_type) continue;
if(!trade.PositionClose(ticket)) ok = false;
}
return ok;
}
void AddLevel(double price)
{
double band = LevelMergePoints * P();
for(int i = 0; i < ArraySize(levels); ++i)
{
if(MathAbs(levels[i] - price) <= band)
{
levels[i] = (levels[i] + price) * 0.5;
return;
}
}
int n = ArraySize(levels);
ArrayResize(levels, n + 1);
levels[n] = price;
}
bool SwingAt(MqlRates &r[], int i)
{
for(int j = 1; j <= SwingDepth; ++j)
{
if(r[i].high <= r[i - j].high || r[i].high < r[i + j].high) return false;
}
return true;
}
bool SwingLowAt(MqlRates &r[], int i)
{
for(int j = 1; j <= SwingDepth; ++j)
{
if(r[i].low >= r[i - j].low || r[i].low > r[i + j].low) return false;
}
return true;
}
void BuildStructure()
{
MqlRates r[];
int n = CopyRates(_Symbol, SwingTF, 1, SwingLookback, r);
if(n <= SwingDepth * 2 + 1) return;
ArrayResize(levels, 0);
for(int i = SwingDepth; i < n - SwingDepth; ++i)
{
if(SwingAt(r, i))
{
last_high = r[i].high;
last_high_time = r[i].time;
AddLevel(r[i].high);
}
if(SwingLowAt(r, i))
{
last_low = r[i].low;
last_low_time = r[i].time;
AddLevel(r[i].low);
}
}
}
void DrawLevels()
{
for(int i = ObjectsTotal(0, 0, -1) - 1; i >= 0; --i)
{
string name = ObjectName(0, i, 0, -1);
if(StringFind(name, prefix + "LVL_") == 0 || StringFind(name, prefix + "FAN_") == 0)
ObjectDelete(0, name);
}
for(int i = 0; i < ArraySize(levels); ++i)
{
string name = prefix + "LVL_" + IntegerToString(i);
ObjectCreate(0, name, OBJ_HLINE, 0, 0, levels[i]);
ObjectSetInteger(0, name, OBJPROP_COLOR, clrSilver);
ObjectSetInteger(0, name, OBJPROP_STYLE, STYLE_DOT);
}
datetime t0 = (last_high_time > last_low_time ? last_high_time : last_low_time);
double p0 = (last_high_time > last_low_time ? last_high : last_low);
bool fromHigh = last_high_time > last_low_time;
for(int k = 1; k <= FanCount; ++k)
{
string name = prefix + "FAN_" + IntegerToString(k);
double p1 = fromHigh ? p0 - k * FanStepPoints * P() : p0 + k * FanStepPoints * P();
ObjectCreate(0, name, OBJ_TREND, 0, t0, p0, TimeCurrent() + PeriodSeconds(EntryTF) * 300, p1);
ObjectSetInteger(0, name, OBJPROP_RAY_RIGHT, true);
ObjectSetInteger(0, name, OBJPROP_COLOR, fromHigh ? clrTomato : clrLimeGreen);
}
}
bool CloseAbove(double level)
{
MqlRates b[2];
if(CopyRates(_Symbol, EntryTF, 1, 2, b) != 2) return false;
return (b[0].close > level && b[1].close <= level);
}
bool CloseBelow(double level)
{
MqlRates b[2];
if(CopyRates(_Symbol, EntryTF, 1, 2, b) != 2) return false;
return (b[0].close < level && b[1].close >= level);
}
bool BullReaction(double level)
{
MqlRates b[1];
if(CopyRates(_Symbol, EntryTF, 1, 1, b) != 1) return false;
double buf = ReactionBufferPts * P();
return (b[0].low <= level + buf && b[0].close > b[0].open && b[0].close > level);
}
bool BearReaction(double level)
{
MqlRates b[1];
if(CopyRates(_Symbol, EntryTF, 1, 1, b) != 1) return false;
double buf = ReactionBufferPts * P();
return (b[0].high >= level - buf && b[0].close < b[0].open && b[0].close < level);
}
bool NearLevel(double price, double &lvl)
{
double best = DBL_MAX;
bool found = false;
for(int i = 0; i < ArraySize(levels); ++i)
{
double d = MathAbs(price - levels[i]);
if(d < best)
{
best = d;
lvl = levels[i];
found = true;
}
}
return found && best <= (LevelMergePoints + ReactionBufferPts) * P();
}
void Buy(double sl, double tp)
{
double ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
double lot = LotsByRisk(MathAbs(ask - sl) / P());
trade.SetExpertMagicNumber(MagicNumber);
trade.SetDeviationInPoints(SlippagePoints);
trade.Buy(lot, _Symbol, ask, Norm(sl), Norm(tp), "APA BUY");
}
void Sell(double sl, double tp)
{
double bid = SymbolInfoDouble(_Symbol, SYMBOL_BID);
double lot = LotsByRisk(MathAbs(sl - bid) / P());
trade.SetExpertMagicNumber(MagicNumber);
trade.SetDeviationInPoints(SlippagePoints);
trade.Sell(lot, _Symbol, bid, Norm(sl), Norm(tp), "APA SELL");
}
void EvaluateSignals()
{
if(!AllowAutoTrading || SpreadPts() > MaxSpread || HasOpenPosition()) return;
MqlRates b[1];
if(CopyRates(_Symbol, EntryTF, 1, 1, b) != 1) return;
double c = b[0].close;
double lvl = 0.0;
if(last_high > 0 && CloseAbove(last_high))
{
double sl = last_low - StopBufferPoints * P();
double tp = c + (c - sl) * BreakoutRR;
Buy(sl, tp);
return;
}
if(last_low > 0 && CloseBelow(last_low))
{
double sl = last_high + StopBufferPoints * P();
double tp = c - (sl - c) * BreakoutRR;
Sell(sl, tp);
return;
}
if(NearLevel(c, lvl))
{
if(BullReaction(lvl))
{
double sl = lvl - StopBufferPoints * P();
double tp = c + (c - sl) * ReactionRR;
Buy(sl, tp);
}
else if(BearReaction(lvl))
{
double sl = lvl + StopBufferPoints * P();
double tp = c - (sl - c) * ReactionRR;
Sell(sl, tp);
}
}
}
void Panel()
{
string b = prefix + "BTN_";
if(ObjectFind(0, b + "ALL") < 0)
{
ObjectCreate(0, b + "ALL", OBJ_BUTTON, 0, 0, 0);
ObjectSetInteger(0, b + "ALL", OBJPROP_XDISTANCE, 20);
ObjectSetInteger(0, b + "ALL", OBJPROP_YDISTANCE, 20);
ObjectSetInteger(0, b + "ALL", OBJPROP_XSIZE, 90);
ObjectSetInteger(0, b + "ALL", OBJPROP_YSIZE, 22);
ObjectSetString(0, b + "ALL", OBJPROP_TEXT, "Close All");
}
if(ObjectFind(0, b + "BUY") < 0)
{
ObjectCreate(0, b + "BUY", OBJ_BUTTON, 0, 0, 0);
ObjectSetInteger(0, b + "BUY", OBJPROP_XDISTANCE, 120);
ObjectSetInteger(0, b + "BUY", OBJPROP_YDISTANCE, 20);
ObjectSetInteger(0, b + "BUY", OBJPROP_XSIZE, 90);
ObjectSetInteger(0, b + "BUY", OBJPROP_YSIZE, 22);
ObjectSetString(0, b + "BUY", OBJPROP_TEXT, "Close Buy");
}
if(ObjectFind(0, b + "SELL") < 0)
{
ObjectCreate(0, b + "SELL", OBJ_BUTTON, 0, 0, 0);
ObjectSetInteger(0, b + "SELL", OBJPROP_XDISTANCE, 220);
ObjectSetInteger(0, b + "SELL", OBJPROP_YDISTANCE, 20);
ObjectSetInteger(0, b + "SELL", OBJPROP_XSIZE, 90);
ObjectSetInteger(0, b + "SELL", OBJPROP_YSIZE, 22);
ObjectSetString(0, b + "SELL", OBJPROP_TEXT, "Close Sell");
}
}
void Status()
{
string n = prefix + "STATUS";
string txt = "APA | spread=" + IntegerToString(SpreadPts()) + " | levels=" + IntegerToString(ArraySize(levels));
if(ObjectFind(0, n) < 0)
{
ObjectCreate(0, n, OBJ_LABEL, 0, 0, 0);
ObjectSetInteger(0, n, OBJPROP_XDISTANCE, 20);
ObjectSetInteger(0, n, OBJPROP_YDISTANCE, 52);
ObjectSetInteger(0, n, OBJPROP_COLOR, clrWhite);
}
ObjectSetString(0, n, OBJPROP_TEXT, txt);
}
int OnInit()
{
trade.SetExpertMagicNumber(MagicNumber);
trade.SetDeviationInPoints(SlippagePoints);
Panel();
return INIT_SUCCEEDED;
}
void OnDeinit(const int reason) { Comment(""); }
void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam)
{
if(id != CHARTEVENT_OBJECT_CLICK || !AllowManualExit) return;
if(sparam == prefix + "BTN_ALL") CloseByType(-1);
if(sparam == prefix + "BTN_BUY") CloseByType(POSITION_TYPE_BUY);
if(sparam == prefix + "BTN_SELL") CloseByType(POSITION_TYPE_SELL);
}
void OnTick()
{
if(NewBar(EntryTF, last_entry_bar))
{
BuildStructure();
DrawLevels();
EvaluateSignals();
Status();
}
}
//| AdvancedPriceAction.mq5 |
//| Copyright 2026, Trading Strategy AI |
//+------------------------------------------------------------------+
#property copyright "Trading Strategy AI"
#property version "1.00"
#property strict
#include <Trade\Trade.mqh>
input group "Trading Settings"
input double RiskPercent = 0.5;
input int MagicNumber = 123456;
input int MaxSpread = 20;
input int SlippagePoints = 10;
input bool AllowAutoTrading = true;
input bool AllowManualExit = true;
input group "Timeframe Settings"
input ENUM_TIMEFRAMES StructureTF = PERIOD_M15;
input ENUM_TIMEFRAMES SwingTF = PERIOD_M5;
input ENUM_TIMEFRAMES EntryTF = PERIOD_M1;
input group "Logic Settings"
input int SwingLookback = 120;
input int SwingDepth = 2;
input int LevelMergePoints = 25;
input int FanStepPoints = 150;
input int FanCount = 4;
input int StopBufferPoints = 20;
input int ReactionBufferPts = 15;
input double BreakoutRR = 2.0;
input double ReactionRR = 1.0;
CTrade trade;
string prefix = "APA_";
datetime last_entry_bar = 0;
double levels[];
double last_high = 0.0, last_low = 0.0;
datetime last_high_time = 0, last_low_time = 0;
double P() { return SymbolInfoDouble(_Symbol, SYMBOL_POINT); }
int SpreadPts() { return (int)SymbolInfoInteger(_Symbol, SYMBOL_SPREAD); }
double Norm(double v) { return NormalizeDouble(v, _Digits); }
double ClampLot(double lot)
{
double minv = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MIN);
double maxv = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MAX);
double step = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_STEP);
lot = MathMax(minv, MathMin(maxv, lot));
lot = MathFloor(lot / step) * step;
return NormalizeDouble(lot, 2);
}
double LotsByRisk(double sl_points)
{
if(sl_points <= 0) return ClampLot(SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MIN));
double bal = AccountInfoDouble(ACCOUNT_BALANCE);
double risk_money = bal * RiskPercent / 100.0;
double tick_value = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE);
double tick_size = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_SIZE);
if(tick_value <= 0 || tick_size <= 0) return ClampLot(SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MIN));
double value_per_point = tick_value * (P() / tick_size);
return ClampLot(risk_money / (sl_points * value_per_point));
}
bool NewBar(ENUM_TIMEFRAMES tf, datetime &stamp)
{
datetime t = iTime(_Symbol, tf, 0);
if(t == 0 || t == stamp) return false;
stamp = t;
return true;
}
bool HasOpenPosition()
{
for(int i = PositionsTotal() - 1; i >= 0; --i)
{
ulong ticket = PositionGetTicket(i);
if(ticket == 0) continue;
if(PositionGetString(POSITION_SYMBOL) == _Symbol && (int)PositionGetInteger(POSITION_MAGIC) == MagicNumber)
return true;
}
return false;
}
bool CloseByType(long pos_type = -1)
{
bool ok = true;
for(int i = PositionsTotal() - 1; i >= 0; --i)
{
ulong ticket = PositionGetTicket(i);
if(ticket == 0) continue;
if(PositionGetString(POSITION_SYMBOL) != _Symbol) continue;
if((int)PositionGetInteger(POSITION_MAGIC) != MagicNumber) continue;
long type = PositionGetInteger(POSITION_TYPE);
if(pos_type != -1 && type != pos_type) continue;
if(!trade.PositionClose(ticket)) ok = false;
}
return ok;
}
void AddLevel(double price)
{
double band = LevelMergePoints * P();
for(int i = 0; i < ArraySize(levels); ++i)
{
if(MathAbs(levels[i] - price) <= band)
{
levels[i] = (levels[i] + price) * 0.5;
return;
}
}
int n = ArraySize(levels);
ArrayResize(levels, n + 1);
levels[n] = price;
}
bool SwingAt(MqlRates &r[], int i)
{
for(int j = 1; j <= SwingDepth; ++j)
{
if(r[i].high <= r[i - j].high || r[i].high < r[i + j].high) return false;
}
return true;
}
bool SwingLowAt(MqlRates &r[], int i)
{
for(int j = 1; j <= SwingDepth; ++j)
{
if(r[i].low >= r[i - j].low || r[i].low > r[i + j].low) return false;
}
return true;
}
void BuildStructure()
{
MqlRates r[];
int n = CopyRates(_Symbol, SwingTF, 1, SwingLookback, r);
if(n <= SwingDepth * 2 + 1) return;
ArrayResize(levels, 0);
for(int i = SwingDepth; i < n - SwingDepth; ++i)
{
if(SwingAt(r, i))
{
last_high = r[i].high;
last_high_time = r[i].time;
AddLevel(r[i].high);
}
if(SwingLowAt(r, i))
{
last_low = r[i].low;
last_low_time = r[i].time;
AddLevel(r[i].low);
}
}
}
void DrawLevels()
{
for(int i = ObjectsTotal(0, 0, -1) - 1; i >= 0; --i)
{
string name = ObjectName(0, i, 0, -1);
if(StringFind(name, prefix + "LVL_") == 0 || StringFind(name, prefix + "FAN_") == 0)
ObjectDelete(0, name);
}
for(int i = 0; i < ArraySize(levels); ++i)
{
string name = prefix + "LVL_" + IntegerToString(i);
ObjectCreate(0, name, OBJ_HLINE, 0, 0, levels[i]);
ObjectSetInteger(0, name, OBJPROP_COLOR, clrSilver);
ObjectSetInteger(0, name, OBJPROP_STYLE, STYLE_DOT);
}
datetime t0 = (last_high_time > last_low_time ? last_high_time : last_low_time);
double p0 = (last_high_time > last_low_time ? last_high : last_low);
bool fromHigh = last_high_time > last_low_time;
for(int k = 1; k <= FanCount; ++k)
{
string name = prefix + "FAN_" + IntegerToString(k);
double p1 = fromHigh ? p0 - k * FanStepPoints * P() : p0 + k * FanStepPoints * P();
ObjectCreate(0, name, OBJ_TREND, 0, t0, p0, TimeCurrent() + PeriodSeconds(EntryTF) * 300, p1);
ObjectSetInteger(0, name, OBJPROP_RAY_RIGHT, true);
ObjectSetInteger(0, name, OBJPROP_COLOR, fromHigh ? clrTomato : clrLimeGreen);
}
}
bool CloseAbove(double level)
{
MqlRates b[2];
if(CopyRates(_Symbol, EntryTF, 1, 2, b) != 2) return false;
return (b[0].close > level && b[1].close <= level);
}
bool CloseBelow(double level)
{
MqlRates b[2];
if(CopyRates(_Symbol, EntryTF, 1, 2, b) != 2) return false;
return (b[0].close < level && b[1].close >= level);
}
bool BullReaction(double level)
{
MqlRates b[1];
if(CopyRates(_Symbol, EntryTF, 1, 1, b) != 1) return false;
double buf = ReactionBufferPts * P();
return (b[0].low <= level + buf && b[0].close > b[0].open && b[0].close > level);
}
bool BearReaction(double level)
{
MqlRates b[1];
if(CopyRates(_Symbol, EntryTF, 1, 1, b) != 1) return false;
double buf = ReactionBufferPts * P();
return (b[0].high >= level - buf && b[0].close < b[0].open && b[0].close < level);
}
bool NearLevel(double price, double &lvl)
{
double best = DBL_MAX;
bool found = false;
for(int i = 0; i < ArraySize(levels); ++i)
{
double d = MathAbs(price - levels[i]);
if(d < best)
{
best = d;
lvl = levels[i];
found = true;
}
}
return found && best <= (LevelMergePoints + ReactionBufferPts) * P();
}
void Buy(double sl, double tp)
{
double ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
double lot = LotsByRisk(MathAbs(ask - sl) / P());
trade.SetExpertMagicNumber(MagicNumber);
trade.SetDeviationInPoints(SlippagePoints);
trade.Buy(lot, _Symbol, ask, Norm(sl), Norm(tp), "APA BUY");
}
void Sell(double sl, double tp)
{
double bid = SymbolInfoDouble(_Symbol, SYMBOL_BID);
double lot = LotsByRisk(MathAbs(sl - bid) / P());
trade.SetExpertMagicNumber(MagicNumber);
trade.SetDeviationInPoints(SlippagePoints);
trade.Sell(lot, _Symbol, bid, Norm(sl), Norm(tp), "APA SELL");
}
void EvaluateSignals()
{
if(!AllowAutoTrading || SpreadPts() > MaxSpread || HasOpenPosition()) return;
MqlRates b[1];
if(CopyRates(_Symbol, EntryTF, 1, 1, b) != 1) return;
double c = b[0].close;
double lvl = 0.0;
if(last_high > 0 && CloseAbove(last_high))
{
double sl = last_low - StopBufferPoints * P();
double tp = c + (c - sl) * BreakoutRR;
Buy(sl, tp);
return;
}
if(last_low > 0 && CloseBelow(last_low))
{
double sl = last_high + StopBufferPoints * P();
double tp = c - (sl - c) * BreakoutRR;
Sell(sl, tp);
return;
}
if(NearLevel(c, lvl))
{
if(BullReaction(lvl))
{
double sl = lvl - StopBufferPoints * P();
double tp = c + (c - sl) * ReactionRR;
Buy(sl, tp);
}
else if(BearReaction(lvl))
{
double sl = lvl + StopBufferPoints * P();
double tp = c - (sl - c) * ReactionRR;
Sell(sl, tp);
}
}
}
void Panel()
{
string b = prefix + "BTN_";
if(ObjectFind(0, b + "ALL") < 0)
{
ObjectCreate(0, b + "ALL", OBJ_BUTTON, 0, 0, 0);
ObjectSetInteger(0, b + "ALL", OBJPROP_XDISTANCE, 20);
ObjectSetInteger(0, b + "ALL", OBJPROP_YDISTANCE, 20);
ObjectSetInteger(0, b + "ALL", OBJPROP_XSIZE, 90);
ObjectSetInteger(0, b + "ALL", OBJPROP_YSIZE, 22);
ObjectSetString(0, b + "ALL", OBJPROP_TEXT, "Close All");
}
if(ObjectFind(0, b + "BUY") < 0)
{
ObjectCreate(0, b + "BUY", OBJ_BUTTON, 0, 0, 0);
ObjectSetInteger(0, b + "BUY", OBJPROP_XDISTANCE, 120);
ObjectSetInteger(0, b + "BUY", OBJPROP_YDISTANCE, 20);
ObjectSetInteger(0, b + "BUY", OBJPROP_XSIZE, 90);
ObjectSetInteger(0, b + "BUY", OBJPROP_YSIZE, 22);
ObjectSetString(0, b + "BUY", OBJPROP_TEXT, "Close Buy");
}
if(ObjectFind(0, b + "SELL") < 0)
{
ObjectCreate(0, b + "SELL", OBJ_BUTTON, 0, 0, 0);
ObjectSetInteger(0, b + "SELL", OBJPROP_XDISTANCE, 220);
ObjectSetInteger(0, b + "SELL", OBJPROP_YDISTANCE, 20);
ObjectSetInteger(0, b + "SELL", OBJPROP_XSIZE, 90);
ObjectSetInteger(0, b + "SELL", OBJPROP_YSIZE, 22);
ObjectSetString(0, b + "SELL", OBJPROP_TEXT, "Close Sell");
}
}
void Status()
{
string n = prefix + "STATUS";
string txt = "APA | spread=" + IntegerToString(SpreadPts()) + " | levels=" + IntegerToString(ArraySize(levels));
if(ObjectFind(0, n) < 0)
{
ObjectCreate(0, n, OBJ_LABEL, 0, 0, 0);
ObjectSetInteger(0, n, OBJPROP_XDISTANCE, 20);
ObjectSetInteger(0, n, OBJPROP_YDISTANCE, 52);
ObjectSetInteger(0, n, OBJPROP_COLOR, clrWhite);
}
ObjectSetString(0, n, OBJPROP_TEXT, txt);
}
int OnInit()
{
trade.SetExpertMagicNumber(MagicNumber);
trade.SetDeviationInPoints(SlippagePoints);
Panel();
return INIT_SUCCEEDED;
}
void OnDeinit(const int reason) { Comment(""); }
void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam)
{
if(id != CHARTEVENT_OBJECT_CLICK || !AllowManualExit) return;
if(sparam == prefix + "BTN_ALL") CloseByType(-1);
if(sparam == prefix + "BTN_BUY") CloseByType(POSITION_TYPE_BUY);
if(sparam == prefix + "BTN_SELL") CloseByType(POSITION_TYPE_SELL);
}
void OnTick()
{
if(NewBar(EntryTF, last_entry_bar))
{
BuildStructure();
DrawLevels();
EvaluateSignals();
Status();
}
}
Откликнулись
1
Оценка
Проекты
0
0%
Арбитраж
0
Просрочено
0
Свободен
2
Оценка
Проекты
509
23%
Арбитраж
60
57%
/
25%
Просрочено
59
12%
Загружен
3
Оценка
Проекты
0
0%
Арбитраж
0
Просрочено
0
Свободен
4
Оценка
Проекты
95
32%
Арбитраж
9
22%
/
56%
Просрочено
5
5%
Работает
5
Оценка
Проекты
4
0%
Арбитраж
1
100%
/
0%
Просрочено
1
25%
Свободен
6
Оценка
Проекты
1
0%
Арбитраж
1
0%
/
0%
Просрочено
0
Работает
7
Оценка
Проекты
6
50%
Арбитраж
0
Просрочено
0
Работает
Опубликовал: 1 пример
8
Оценка
Проекты
1
0%
Арбитраж
0
Просрочено
1
100%
Свободен
9
Оценка
Проекты
0
0%
Арбитраж
0
Просрочено
0
Свободен
10
Оценка
Проекты
0
0%
Арбитраж
0
Просрочено
0
Свободен
11
Оценка
Проекты
0
0%
Арбитраж
0
Просрочено
0
Свободен
12
Оценка
Проекты
1
0%
Арбитраж
0
Просрочено
0
Свободен
13
Оценка
Проекты
144
46%
Арбитраж
20
40%
/
20%
Просрочено
32
22%
Свободен
14
Оценка
Проекты
0
0%
Арбитраж
0
Просрочено
0
Свободен
15
Оценка
Проекты
0
0%
Арбитраж
0
Просрочено
0
Свободен
16
Оценка
Проекты
1
0%
Арбитраж
0
Просрочено
0
Свободен
Опубликовал: 1 пример
Похожие заказы
Wise Legend
30 - 500 USD
I want this robot to alert me on a good entry point on the trading flat form ether to buy or to sell. And also alert me when to close the market. And alert me on market continuations
I have an existing MT5 Expert Advisor with the original MQ5 source code. I need an experienced MQL5 developer to review, debug and professionally improve the existing EA, not build an unrelated EA from scratch. The EA is mainly for XAUUSD and already contains entry signals, EMA filters, automatic lot sizing, basket profit management, spread/margin protection, news filtering and recovery logic. The main problem is the
Exact Pine Script Conversion: The EA must replicate my Pine Script exactly — including Support/Resistance, Liquidity Grab/Sweep, 30 EMA, Entry, SL, TP, Partial Booking and Breakeven . No assumptions or changes to the logic. Accurate Entries: The EA must enter exactly according to the Pine Script conditions, including the correct candle and price level after the Support/Resistance or Liquidity Sweep setup. SL & TP: SL
I buy EA for USDEUR or XAUUSD for FTMO with proven backtest. Send me images with backtest reports where daily max dd is 1% on 200k account. I can buy several eas if you have them with proofs. Need images of backtesting for 5 years
Cerco uno sviluppatore MQL5 esperto per lavorare su un Expert Advisor (EA) XAUUSD per MetaTrader 5 già esistente , versione attuale XAU_V59.mq5 . L'obiettivo è modificare, correggere e sviluppare il codice esistente senza stravolgere la logica già presente , mantenendo le regole ei parametri già definiti, salvo le modifiche espressamente richieste. REQUISITI FONDAMENTALI Il codice deve essere scritto in MQL5 nativo e
Project Title: Modular Session Breakout & Multi-MA EA with Anti-Whipsaw Filters Requirements: Please build an EA where every feature can be individually turned ON/OFF via an independent toggle switch and configured via adjustable parameters. The EA should function as an efficient "Entry Engine" that works in tandem with external risk managers (e.g., KT Equity Protector). 1. Global Settings Master Switch: Global
I need an MT5 Expert Advisor for a mean-reversion strategy on EURUSD: single entry at local price extremes, fixed stop loss and take profit, no grid and no averaging. Position size must be calculated automatically so that risk per trade is capped at a fixed USD amount, with a daily loss limit and a pause after consecutive losses. I will send the full specification — entry conditions, filters and all input parameters
I would like expert Advisor
30+ USD
I’m seeking a high‑reliability Expert Advisor that operates on ADX and Moving Average signals, capable of executing trades with strict error‑handling to ensure every operation is processed safely and efficiently. The EA should base its entry and exit logic on the direction of the Moving Average and the latest candle price , use ADX to confirm trend strength, allow a customizable lot size , and maintain robust
Maritangle based algo
100+ USD
Upgrade the existing advisor from work #245622 (Martingale EA) for use on FOREX currency pairs. Martingale-based advisor with risk management elements. Management of trading account ID and expiration time. Details in the technical specifications
Create EA based on indicator, Basic Harmonic Pattern
60 - 100 USD
I trade NAS 100 using Harmonic Patterns. I want to create a MT5 EA to trade based on this indicator: https://www.mql5.com/en/market/product/78325?source=Site +Market+MT5+Indicator+Search+Rating006%3abasic+harmonic+patterns I want the EA to have the same take profit levels as indicator: TP1, TP2, TP3 (select in inputs which TP to use). The EA should also use the same Stop Loss as indicator, with the option to adjust
Информация о проекте
Бюджет
30+ USD
Заказчик
Размещено заказов1
Количество арбитражей0