Spécifications
#property version "2.10"
#property description "Chizzy Trend Rider - HFM-ready (hedging/netting safe)"
#include <Trade/Trade.mqh>
CTrade trade;
//================ INPUTS =================//
input double LotSize = 0.01; // Fixed lot (used if RiskPercent = 0)
input double RiskPercent = 0.0; // Risk % of balance per trade (0 = use LotSize)
input ulong MagicNumber = 220026;
input ENUM_TIMEFRAMES TrendTF = PERIOD_H1;
input ENUM_TIMEFRAMES EntryTF = PERIOD_M15;
input int FastEMA = 20;
input int SlowEMA = 50;
input int PullbackEMA = 20;
input int ATRPeriod = 14;
input double ATR_SL = 1.5;
input double RR = 2.0;
input double MinTrendGap = 0.30; // Min EMA gap (x ATR) to call it a trend
input double PullbackTol = 0.30; // Pullback tolerance (x stop distance)
input bool UseBreakEven = true;
input double BE_Trigger_R = 1.0; // Move SL to entry after this many R
input int MaxSpread = 25; // Points (adjust per symbol on HFM)
input int StartHour = 8; // SERVER time
input int EndHour = 18; // SERVER time
input double MaxDailyLossPercent = 3.0; // Stop trading for the day (0 = off)
//================ GLOBALS =================//
int hFast, hSlow, hPullback, hATR;
datetime LastBar = 0;
//================ INIT =================//
int OnInit()
{
trade.SetExpertMagicNumber(MagicNumber);
trade.SetDeviationInPoints(20);
trade.SetTypeFillingBySymbol(_Symbol); // important on HFM (IOC/FOK differs by symbol)
hFast = iMA(_Symbol, TrendTF, FastEMA, 0, MODE_EMA, PRICE_CLOSE);
hSlow = iMA(_Symbol, TrendTF, SlowEMA, 0, MODE_EMA, PRICE_CLOSE);
hPullback = iMA(_Symbol, EntryTF, PullbackEMA, 0, MODE_EMA, PRICE_CLOSE);
hATR = iATR(_Symbol, EntryTF, ATRPeriod);
if(hFast==INVALID_HANDLE || hSlow==INVALID_HANDLE ||
hPullback==INVALID_HANDLE || hATR==INVALID_HANDLE)
return INIT_FAILED;
return INIT_SUCCEEDED;
}
void OnDeinit(const int reason)
{
if(hFast!=INVALID_HANDLE) IndicatorRelease(hFast);
if(hSlow!=INVALID_HANDLE) IndicatorRelease(hSlow);
if(hPullback!=INVALID_HANDLE) IndicatorRelease(hPullback);
if(hATR!=INVALID_HANDLE) IndicatorRelease(hATR);
Comment("");
}
//================ HELPERS =================//
bool NewBar()
{
datetime t = iTime(_Symbol, EntryTF, 0);
if(t != LastBar) { LastBar = t; return true; }
return false;
}
bool SessionOK()
{
MqlDateTime tm;
TimeToStruct(TimeCurrent(), tm);
return (tm.hour >= StartHour && tm.hour < EndHour);
}
double SpreadPts()
{
return (SymbolInfoDouble(_Symbol,SYMBOL_ASK) -
SymbolInfoDouble(_Symbol,SYMBOL_BID)) / _Point;
}
bool SpreadOK() { return SpreadPts() <= MaxSpread; }
// Works on both hedging and netting accounts
bool PositionExists()
{
for(int i=PositionsTotal()-1; i>=0; i--)
{
ulong ticket = PositionGetTicket(i);
if(ticket==0) continue;
if(PositionGetString(POSITION_SYMBOL)==_Symbol &&
PositionGetInteger(POSITION_MAGIC)==(long)MagicNumber)
return true;
}
return false;
}
double DailyPnL()
{
datetime dayStart = iTime(_Symbol, PERIOD_D1, 0);
if(!HistorySelect(dayStart, TimeCurrent())) return 0;
double pnl = 0;
for(int i=HistoryDealsTotal()-1; i>=0; i--)
{
ulong d = HistoryDealGetTicket(i);
if(HistoryDealGetInteger(d,DEAL_MAGIC)!=(long)MagicNumber) continue;
if(HistoryDealGetString(d,DEAL_SYMBOL)!=_Symbol) continue;
pnl += HistoryDealGetDouble(d,DEAL_PROFIT)
+ HistoryDealGetDouble(d,DEAL_SWAP)
+ HistoryDealGetDouble(d,DEAL_COMMISSION);
}
return pnl;
}
bool DailyLossOK()
{
if(MaxDailyLossPercent <= 0) return true;
double limit = -AccountInfoDouble(ACCOUNT_BALANCE) * MaxDailyLossPercent / 100.0;
return (DailyPnL() > limit);
}
double NormLot(double lots)
{
double mn = SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN);
double mx = SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MAX);
double st = SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_STEP);
lots = MathFloor(lots/st)*st;
lots = MathMax(mn, MathMin(mx, lots));
return NormalizeDouble(lots, 2);
}
double CalcLots(double stopDistance)
{
if(RiskPercent <= 0) return NormLot(LotSize);
double riskMoney = AccountInfoDouble(ACCOUNT_BALANCE) * RiskPercent / 100.0;
double tickVal = SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_VALUE);
double tickSize = SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_SIZE);
if(tickVal<=0 || tickSize<=0 || stopDistance<=0) return NormLot(LotSize);
double lossPerLot = (stopDistance / tickSize) * tickVal;
return NormLot(riskMoney / lossPerLot);
}
bool StopsValid(double stopDistance)
{
double minDist = (double)SymbolInfoInteger(_Symbol,SYMBOL_TRADE_STOPS_LEVEL) * _Point;
double freeze = (double)SymbolInfoInteger(_Symbol,SYMBOL_TRADE_FREEZE_LEVEL) * _Point;
return (stopDistance > MathMax(minDist, freeze));
}
void ManageBreakEven()
{
if(!UseBreakEven) return;
for(int i=PositionsTotal()-1; i>=0; i--)
{
ulong ticket = PositionGetTicket(i);
if(ticket==0) continue;
if(PositionGetString(POSITION_SYMBOL)!=_Symbol) continue;
if(PositionGetInteger(POSITION_MAGIC)!=(long)MagicNumber) continue;
long type = PositionGetInteger(POSITION_TYPE);
double open = PositionGetDouble(POSITION_PRICE_OPEN);
double sl = PositionGetDouble(POSITION_SL);
double tp = PositionGetDouble(POSITION_TP);
double buf = SpreadPts() * _Point;
if(type==POSITION_TYPE_BUY && sl<open)
{
double risk = open - sl;
double bid = SymbolInfoDouble(_Symbol,SYMBOL_BID);
if(bid - open >= risk*BE_Trigger_R)
trade.PositionModify(ticket, NormalizeDouble(open+buf,_Digits), tp);
}
else if(type==POSITION_TYPE_SELL && sl>open)
{
double risk = sl - open;
double ask = SymbolInfoDouble(_Symbol,SYMBOL_ASK);
if(open - ask >= risk*BE_Trigger_R)
trade.PositionModify(ticket, NormalizeDouble(open-buf,_Digits), tp);
}
}
}
void Dashboard(string trend, string status)
{
string tf = EnumToString(EntryTF);
Comment(
"========================\n",
" CHIZZY TREND RIDER v2.1\n",
"========================\n",
"Symbol: ", _Symbol, "\n",
"Entry TF: ", tf, "\n\n",
"Trend: ", trend, "\n",
"Status: ", status, "\n",
"Session: ", (SessionOK()?"OPEN":"CLOSED"), "\n\n",
"Lot: ", DoubleToString(LotSize,2), (RiskPercent>0?" (risk-based)":""), "\n",
"Spread: ", DoubleToString(SpreadPts(),1), " pts\n\n",
"Balance: $", DoubleToString(AccountInfoDouble(ACCOUNT_BALANCE),2), "\n",
"Equity: $", DoubleToString(AccountInfoDouble(ACCOUNT_EQUITY),2)
);
}
//================ MAIN =================//
void OnTick()
{
ManageBreakEven();
double fast[], slow[], pullback[], atr[];
ArraySetAsSeries(fast,true);
ArraySetAsSeries(slow,true);
ArraySetAsSeries(pullback,true);
ArraySetAsSeries(atr,true);
// Closed bars only (shift 1 and 2) -> no repainting
if(CopyBuffer(hFast,0,1,2,fast)!=2) return;
if(CopyBuffer(hSlow,0,1,2,slow)!=2) return;
if(CopyBuffer(hPullback,0,1,1,pullback)!=1) return;
if(CopyBuffer(hATR,0,1,1,atr)!=1) return;
double gap = MathAbs(fast[0]-slow[0]);
bool strong = (gap >= atr[0]*MinTrendGap);
// Trend: EMAs ordered, separated, and fast EMA sloping the same way
bool uptrend = strong && fast[0]>slow[0] && fast[0]>fast[1];
bool downtrend = strong && fast[0]<slow[0] && fast[0]<fast[1];
string trend = "SIDEWAYS";
if(uptrend) trend = "BUY";
if(downtrend) trend = "SELL";
Dashboard(trend, "Watching");
if(!NewBar()) return;
if(!SessionOK()) return;
if(!SpreadOK()) return;
if(!DailyLossOK()) return;
if(PositionExists()) return;
double ask = SymbolInfoDouble(_Symbol,SYMBOL_ASK);
double bid = SymbolInfoDouble(_Symbol,SYMBOL_BID);
double o = iOpen(_Symbol,EntryTF,1);
double c = iClose(_Symbol,EntryTF,1);
double h = iHigh(_Symbol,EntryTF,1);
double l = iLow(_Symbol,EntryTF,1);
double stop = atr[0]*ATR_SL;
if(!StopsValid(stop)) return;
double lots = CalcLots(stop);
// BUY: wick touched/near EMA, candle closed back above it and bullish
if(uptrend)
{
bool touched = (l <= pullback[0] + stop*PullbackTol);
if(touched && c > pullback[0] && c > o)
{
double sl = NormalizeDouble(ask - stop, _Digits);
double tp = NormalizeDouble(ask + stop*RR, _Digits);
if(!trade.Buy(lots,_Symbol,0,sl,tp,"CTR BUY"))
Print("Buy failed: ", trade.ResultRetcode(), " ", trade.ResultRetcodeDescription());
return;
}
}
// SELL
if(downtrend)
{
bool touched = (h >= pullback[0] - stop*PullbackTol);
if(touched && c < pullback[0] && c < o)
{
double sl = NormalizeDouble(bid + stop, _Digits);
double tp = NormalizeDouble(bid - stop*RR, _Digits);
if(!trade.Sell(lots,_Symbol,0,sl,tp,"CTR SELL"))
Print("Sell failed: ", trade.ResultRetcode(), " ", trade.ResultRetcodeDescription());
return;
}
}
}
Répondu
1
Évaluation
Projets
309
76%
Arbitrage
14
71%
/
0%
En retard
6
2%
Chargé
2
Évaluation
Projets
184
25%
Arbitrage
25
16%
/
76%
En retard
16
9%
Gratuit
3
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
Publié : 2 codes
4
Évaluation
Projets
16
19%
Arbitrage
2
0%
/
50%
En retard
3
19%
Chargé
5
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Travail
Publié : 2 codes
6
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
7
Évaluation
Projets
12
33%
Arbitrage
0
En retard
2
17%
Travail
Publié : 1 code
8
Évaluation
Projets
2
0%
Arbitrage
1
0%
/
100%
En retard
0
Gratuit
9
Évaluation
Projets
2
0%
Arbitrage
0
En retard
0
Gratuit
10
Évaluation
Projets
18
33%
Arbitrage
0
En retard
1
6%
Travail
11
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
12
Évaluation
Projets
850
61%
Arbitrage
33
27%
/
45%
En retard
24
3%
Travail
Publié : 1 code
13
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
14
Évaluation
Projets
26
38%
Arbitrage
3
33%
/
67%
En retard
3
12%
Gratuit
15
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
Commandes similaires
Self sufficient Trading robot
30+ USD
Indicators: Fast MA (Period 10, Exponential) and Slow MA (Period 50, Exponential). Buy Signal: When Fast MA crosses above Slow MA. Sell Signal: When Fast MA crosses below Slow MA. Risk Management & Parameters: Customizable Lot Size (Default: 0.01). Stop Loss (SL) and Take Profit (TP) in pips. Trailing Stop options. Max Spread filter. Platform: MetaTrader 5 (MQL5)
Writing of an Expert Advisor
30+ USD
Indicators: Fast MA (Period 10, Exponential) and Slow MA (Period 50, Exponential). Buy Signal: When Fast MA crosses above Slow MA. Sell Signal: When Fast MA crosses below Slow MA. Risk Management & Parameters: Customizable Lot Size (Default: 0.01). Stop Loss (SL) and Take Profit (TP) in pips. Trailing Stop options. Max Spread filter. Platform: MetaTrader 5 (MQL5)
A robot
30+ USD
Je souhaite trouver un développeur pour réaliser ce travail et effectuer les paiements via cette application. Je m'engage à ne communiquer avec les candidats que par cette application, y compris par messageries tierces, correspondance personnelle ou courriel. Je comprends que toute personne ne respectant pas ces conditions sera interdite de publier des commandes sur la plateforme Freelance
I am looking for an experienced MQL5/MT5 developer to develop a custom Expert Advisor based on a complete technical architecture already prepared by the client. This is not a request to design a trading strategy from scratch . The strategy architecture, entry/exit concepts, filters, risk-management requirements and testing requirements are already documented. The main responsibility will be MQL5 development
EAs
100+ USD
To apply, you must already have your EA running on an active MT5 trading account connected to the market. The account must have genuine trading history that can be independently reviewed and verified. EA Requirements 1. Prop-Firm Compatible Risk Management - The EA must include daily and overall drawdown protection. - Required inputs: "MaxDailyLoss = 5%" "MaxTotalDrawdown = 10%" - Once either limit is
Strategy
40 - 60 USD
yo i have a strategy i would really like to turn into a signal bot basically please this is very technical and serious to me the strategy needs more time 1 time frame and the bot most be 100% accurate
Ready to use bot
100+ USD
seller must provide the following to be considered... i will answer to all who fit this description, and can purchase more than 1 EA... - brief strategy description - overall EA expectancy - 1 week limited trial version, with whatever settings you consider best (can be blocked on demo, i don't really care) - investor password from a reputable broker (if history is available... live / demo, same thing, doesn't really
I want you to develop a professional HFT trading robot for MT5/MQL5 , initially focused on XAUUSD . The robot should be designed for high-speed tick-level trading , analyzing real-time bid/ask movement, spread, tick velocity, momentum, volatility, price acceleration and short-term market microstructure to identify very short-term opportunities. The core strategy should be capable of opening 5–10+ positions in a
can you help me use a Tickblaze Algo NRBO on the NT platform? I have it somewhat set up, but I have other questions about running it & knowing how to operate it in NT. Thank you if anyone have experience in this kindly bib and let do it asap
I need a fully automated custom Expert Advisor for MetaTrader 5 (MQL5). The EA is intended for use on a The5ers $100,000 2-Step prop-firm account. IMPORTANT DELIVERY REQUIREMENT: I must receive the complete editable .mq5 source code as well as the compiled .ex5 file. Compiled-only delivery is NOT acceptable. The EA must be coded specifically for this project and must not copy trades, use external trading signals or
Informations sur le projet
Budget
30+ USD
Client
Commandes passées1
Nombre d'arbitrages0