Specification
// Forex Strategy for Consistency in Profit
// Input parameters
input int FastMAPeriod = 10; // Period for the fast moving average
input int SlowMAPeriod = 30; // Period for the slow moving average
input double StopLossPips = 50; // Stop loss in pips
input double TakeProfitPips = 100; // Take profit in pips
// Global variables
int ticket = 0; // Order ticket number
// Indicator buffers
double fastMABuffer[];
double slowMABuffer[];
// Initialization function
int OnInit()
{
// Define indicator buffers
SetIndexBuffer(0, fastMABuffer);
SetIndexBuffer(1, slowMABuffer);
// Set indicator plot type
SetIndexStyle(0, DRAW_LINE);
SetIndexStyle(1, DRAW_LINE);
// Set indicator colors
SetIndexLabel(0, "Fast MA");
SetIndexLabel(1, "Slow MA");
SetIndexDrawBegin(0, SlowMAPeriod);
SetIndexDrawBegin(1, SlowMAPeriod);
// Set indicator parameters
SetIndexShift(0, 0);
SetIndexShift(1, 0);
SetIndexEmptyValue(0, 0);
SetIndexEmptyValue(1, 0);
// Return successful initialization
return INIT_SUCCEEDED;
}
// Trading function
void OnTick()
{
// Calculate moving averages
ArraySetAsSeries(fastMABuffer, true);
ArraySetAsSeries(slowMABuffer, true);
int fastMA = iMA(Symbol(), 0, FastMAPeriod, 0, MODE_SMA, PRICE_CLOSE);
int slowMA = iMA(Symbol(), 0, SlowMAPeriod, 0, MODE_SMA, PRICE_CLOSE);
// Check for a crossover
if (fastMA > slowMA && fastMABuffer[1] <= slowMABuffer[1])
{
// Close any existing positions
if (ticket > 0 && OrderSelect(ticket, SELECT_BY_TICKET))
{
if (OrderClose(ticket, OrderLots(), OrderClosePrice(), Slippage, Red))
{
ticket = 0; // Reset ticket number
}
}
// Open a new buy position
ticket = OrderSend(Symbol(), OP_BUY, 0.1, Ask, Slippage, Ask - StopLossPips * Point, Ask + TakeProfitPips * Point, "Buy Order", 0, 0, Green);
}
else if (fastMA < slowMA && fastMABuffer[1] >= slowMABuffer[1])
{
// Close any existing positions
if (ticket > 0 && OrderSelect(ticket, SELECT_BY_TICKET))
{
if (OrderClose(ticket, OrderLots(), OrderClosePrice(), Slippage, Red))
{
ticket = 0; // Reset ticket number
}
}
// Open a new sell position
ticket = OrderSend(Symbol(), OP_SELL, 0.1, Bid, Slippage, Bid + StopLossPips * Point, Bid - TakeProfitPips * Point, "Sell Order
Responded
1
Rating
Projects
66
12%
Arbitration
12
58%
/
42%
Overdue
1
2%
Free
2
Rating
Projects
32
28%
Arbitration
5
60%
/
40%
Overdue
6
19%
Free
3
Rating
Projects
2
0%
Arbitration
1
0%
/
0%
Overdue
2
100%
Free
4
Rating
Projects
655
33%
Arbitration
41
41%
/
46%
Overdue
11
2%
Busy
5
Rating
Projects
641
41%
Arbitration
25
48%
/
36%
Overdue
46
7%
Working
6
Rating
Projects
4
50%
Arbitration
4
0%
/
75%
Overdue
0
Free
Similar orders
Mk
30+ USD
I need a fully automated trading robot designed to generate consistent profits while strictly controlling risk and minimizing losses. The robot should use a combination of strategies, including trend-following, scalping, and price action, and must be able to adapt to different market conditions such as trending and ranging markets. It should analyze the market using indicators like Moving Averages, RSI, MACD, and
1. IF price forms: - Higher highs + higher lows → TREND = BUY - Lower highs + lower lows → TREND = SELL ELSE → NO TRADE 2. IF: - Trend = BUY - Price retraces to support zone - Bullish engulfing candle forms - TDI green crosses above red (optional) THEN: - Execute BUY 3. IF: - Trend = SELL - Price retraces to resistance - Bearish engulfing forms - TDI confirms THEN: - Execute SELL 4. Risk per trade = 1% of account Lot
Project information
Budget
30+ USD
Deadline
from 1 to 30 day(s)