happy-scalper-solid

byStar Bro

//+------------------------------------------------------------------+ //| ScalpRush EA - generated by ScalpRush terminal | //| EMA + RSI + ATR scalper with risk-based auto-staking | //| TEST ON DEMO ACCOUNT BEFORE ANY LIVE USE | //+------------------------------------------------------------------+ #property copyright "ScalpRush" #property version "1.00" #property strict #include <Trade\Trade.mqh> CTrade trade; input group "=== Strategy Parameters ===" input int InpFastEMA = 9; // Fast EMA period input int InpSlowEMA = 21; // Slow EMA period input int InpRSIPeriod = 14; // RSI period input int InpATRPeriod = 14; // ATR period input double InpRSILow = 38; // RSI low filter input double InpRSIHigh = 68; // RSI high filter input bool InpTrendOnly = true; // Trend-only entries input group "=== Risk Management ===" input double InpRiskPercent = 1; // Risk per trade, % of balance input double InpTPMult = 2; // Take-profit x ATR input double InpSLMult = 1; // Stop-loss x ATR input int InpMaxHoldBars = 10; // Max bars in position input int InpCooldownBars = 2; // Bars between trades input group "=== Trade ===" input double InpSlippage = 10; // Slippage (points) int g_handleFast, g_handleSlow, g_handleRSI, g_handleATR; datetime g_lastBarTime = 0; datetime g_lastTradeBar = 0; double g_slDist; bool g_signalLong = false, g_signalShort = false; //+------------------------------------------------------------------+ int OnInit() { string tf = _Period == PERIOD_M1 ? "M1" : _Period == PERIOD_M5 ? "M5" : _Period == PERIOD_M15 ? "M15" : IntegerToString(_Period) + "min"; Print("ScalpRush EA running on ", _Symbol, " (", tf, "). FastEMA=", InpFastEMA, " SlowEMA=", InpSlowEMA, " RSI=", InpRSIPeriod, " ATR=", InpATRPeriod, " Risk=", InpRiskPercent, "%"); g_handleFast = iMA(_Symbol, _Period, InpFastEMA, 0, MODE_EMA, PRICE_CLOSE); g_handleSlow = iMA(_Symbol, _Period, InpSlowEMA, 0, MODE_EMA, PRICE_CLOSE); g_handleRSI = iRSI(_Symbol, _Period, InpRSIPeriod, PRICE_CLOSE); g_handleATR = iATR(_Symbol, _Period, InpATRPeriod); if(g_handleFast == INVALID_HANDLE || g_handleSlow == INVALID_HANDLE || g_handleRSI == INVALID_HANDLE || g_handleATR == INVALID_HANDLE) { Print("Failed to create indicator handles."); return(INIT_FAILED); } trade.SetDeviationInPoints(InpSlippage); trade.SetTypeFillingBySymbol(_Symbol); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ void OnDeinit(const int reason) { if(g_handleFast != INVALID_HANDLE) IndicatorRelease(g_handleFast); if(g_handleSlow != INVALID_HANDLE) IndicatorRelease(g_handleSlow); if(g_handleRSI != INVALID_HANDLE) IndicatorRelease(g_handleRSI); if(g_handleATR != INVALID_HANDLE) IndicatorRelease(g_handleATR); } //+------------------------------------------------------------------+ void OnTick() { datetime barTime = iTime(_Symbol, _Period, 0); // --- Close position after max hold bars ------------------------- if(PositionSelect(_Symbol)) { long openBar = (long)(barTime / PeriodSeconds(_Period)) - (long)(PositionGetInteger(POSITION_TIME) / PeriodSeconds(_Period)); if(openBar >= InpMaxHoldBars) { if(trade.PositionClose(_Symbol)) Print("Time-stop: closed ", PositionGetString(POSITION_SYMBOL), " after ", openBar, " bars."); } } // --- Analyze once per new bar ----------------------------------- if(barTime == g_lastBarTime) return; g_lastBarTime = barTime; double fast[], slow[], rsi[], atr[]; int f1 = CopyBuffer(g_handleFast, 0, 0, 3, fast); int f2 = CopyBuffer(g_handleSlow, 0, 0, 3, slow); int f3 = CopyBuffer(g_handleRSI, 0, 0, 3, rsi); int f4 = CopyBuffer(g_handleATR, 0, 0, 3, atr); if(f1 < 3 || f2 < 3 || f3 < 3 || f4 < 3) return; double prevFast = fast[1], prevSlow = slow[1]; double curFast = fast[2], curSlow = slow[2]; double rsiNow = rsi[2]; double atrNow = atr[2]; bool crossedUp = prevFast <= prevSlow && curFast > curSlow; bool crossedDown = prevFast >= prevSlow && curFast < curSlow; bool rsiOk = rsiNow >= InpRSILow && rsiNow <= InpRSIHigh; g_signalLong = rsiOk && (crossedUp || (InpTrendOnly && curFast > curSlow)); g_signalShort = rsiOk && (crossedDown || (InpTrendOnly && curFast < curSlow)); // Don't trade twice within cooldown if(barTime - g_lastTradeBar < InpCooldownBars * PeriodSeconds(_Period)) return; if(PositionSelect(_Symbol)) return; // one position at a time if(g_signalLong) OpenTrade(ORDER_TYPE_BUY, atrNow); if(g_signalShort) OpenTrade(ORDER_TYPE_SELL, atrNow); } //+------------------------------------------------------------------+ void OpenTrade(ENUM_ORDER_TYPE type, double atrNow) { double price = SymbolInfoDouble(_Symbol, type == ORDER_TYPE_BUY ? SYMBOL_ASK : SYMBOL_BID); double slDist = atrNow * InpSLMult; double tpDist = atrNow * InpTPMult; double sl = type == ORDER_TYPE_BUY ? price - slDist : price + slDist; double tp = type == ORDER_TYPE_BUY ? price + tpDist : price - tpDist; // --- Auto stake: risk a fixed % of balance over the SL distance double tickSize = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_SIZE); double tickValue = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE); double slPoints = slDist / tickSize; double riskMoney = AccountInfoDouble(ACCOUNT_BALANCE) * InpRiskPercent / 100.0; double lots = 0; if(slPoints > 0 && tickValue > 0) lots = riskMoney / (slPoints * tickValue); lots = NormalizeDouble(lots, 2); double minLot = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MIN); double maxLot = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MAX); lots = MathMax(minLot, MathMin(lots, maxLot)); if(!trade.Buy(lots, _Symbol, 0, sl, tp, "ScalpRush")) Print("BUY open failed: ", trade.ResultRetcodeDescription()); else { g_lastTradeBar = iTime(_Symbol, _Period, 0); Print("BUY " + DoubleToString(lots, 2) + " @ " + DoubleToString(price, _Digits) + " SL=" + DoubleToString(sl, _Digits) + " TP=" + DoubleToString(tp, _Digits) + " (risk " + DoubleToString(riskMoney, 2) + ")"); } } //+------------------------------------------------------------------+ upgrade this web and also fix bugs , make it an app

No preview

Comments (0)

No comments yet. Be the first!

Project Tasks

14 planning tasks
#1

Generate system requirement document

1m 6s0.1 cr usedDone
#2

Generate personas & user flows

0m 30s0.1 cr usedDone
#7

Create flow for Trader

0m 11sDone
#8

Landing

Backlog
#9

Login

Backlog
#10

Dashboard

Backlog
#11

Settings

Backlog
#12

Signals

Backlog
#13

Positions

Backlog
#14

Trade History

Backlog
#15

Diagnostics

Backlog
#16

Demo Monitor

Backlog
#5

Architecture

0.1 cr neededBacklog
#6

Workspace task plan

0.1 cr neededBacklog

No completed page designs yet.

Completed design pages will appear here when they are ready to preview.

Landing: View strategy intro
Login: Self-enroll account
Login: Sign in
Dashboard: View strategy status
Settings: 1. Configure strategy parameters
Settings: 2. Save settings
Diagnostics: 3. Run diagnostics
Diagnostics: 4. View readiness issues
Demo Monitor: Confirm demo readiness
Dashboard: Start strategy
Signals: Review trading signals
Positions: View open positions
Positions: Close position
Trade History: Browse trade history
Trade History: Filter results
Dashboard: Stop strategy

No completed page designs yet.

Completed design pages will appear here when they are ready to preview.

Landing: View strategy intro
Login: Self-enroll account
Login: Sign in
Dashboard: View strategy status
Settings: 1. Configure strategy parameters
Settings: 2. Save settings
Diagnostics: 3. Run diagnostics
Diagnostics: 4. View readiness issues
Demo Monitor: Confirm demo readiness
Dashboard: Start strategy
Signals: Review trading signals
Positions: View open positions
Positions: Close position
Trade History: Browse trade history
Trade History: Filter results
Dashboard: Stop strategy