Specifiche
//+------------------------------------------------------------------+
//| 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();
}
}
Con risposta
1
Valutazioni
Progetti
0
0%
Arbitraggio
0
In ritardo
0
Gratuito
2
Valutazioni
Progetti
509
23%
Arbitraggio
60
57%
/
25%
In ritardo
59
12%
Caricato
3
Valutazioni
Progetti
0
0%
Arbitraggio
0
In ritardo
0
Gratuito
4
Valutazioni
Progetti
95
32%
Arbitraggio
9
22%
/
56%
In ritardo
5
5%
In elaborazione
5
Valutazioni
Progetti
4
0%
Arbitraggio
1
100%
/
0%
In ritardo
1
25%
Gratuito
6
Valutazioni
Progetti
1
0%
Arbitraggio
1
0%
/
0%
In ritardo
0
In elaborazione
7
Valutazioni
Progetti
6
50%
Arbitraggio
0
In ritardo
0
In elaborazione
Pubblicati: 1 codice
8
Valutazioni
Progetti
1
0%
Arbitraggio
0
In ritardo
1
100%
Gratuito
9
Valutazioni
Progetti
0
0%
Arbitraggio
0
In ritardo
0
Gratuito
10
Valutazioni
Progetti
0
0%
Arbitraggio
0
In ritardo
0
Gratuito
11
Valutazioni
Progetti
0
0%
Arbitraggio
0
In ritardo
0
Gratuito
12
Valutazioni
Progetti
1
0%
Arbitraggio
0
In ritardo
0
Gratuito
Ordini simili
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
I am looking for a professional and market-savvy MQL developer to build a disciplined, stable Scalping Expert Advisor (EA). The ideal developer must have a solid understanding of Trend Identification, Fibonacci Levels, and Technical Indicators , alongside strict risk management implementation. Key Focus Areas & Developer Requirements: Market & Analysis Expertise: ⚬ Deep understanding of Trend direction (Market
NYC
30+ USD
I need a ready-made professional trading EA similar to my current scalping bot, but improved for consistent profit and better risk control. Requirements: - Works on XAUUSD (M5 timeframe) - Fixed lot option (start with 0.01) - Opens only one trade at a time (no multiple positions) - Small, fast entries (scalping style) - Better risk-reward (SL must NOT be bigger than TP) - Breakeven function - Trailing stop to secure
Looking for an experienced MQL4 developer to restore functionality for an MT4 Expert Advisor I've used for 3 years. The software is showing a startup validation error, and I cannot reach the original developer. I'll provide all necessary files and proof of ownership. I don't have the code source just the .ex4 file. Scope of work: - Diagnose the startup validation error of the Expert Advisor - Restore normal
Profitable EAs wanted.
30 - 35 USD
profitable EAs wanted with at least 3 to 5 years backtest. you be submit your proofs such as graphic results, backtesting results, and your demo or weekly the eas has traded
Informazioni sul progetto
Budget
30+ USD
Cliente
Ordini effettuati1
Numero di arbitraggi0