GOLDpro/GOLDpro. 1m.mq5
2026-06-01 15:21:01 +00:00

61 lines
No EOL
1.8 KiB
MQL5

//+------------------------------------------------------------------+
//| GOLDpro 1m EA - Scalper for XAUUSD |
//+------------------------------------------------------------------+
#property copyright "GOLDpro"
#property version "1.00"
#include <Trade\Trade.mqh>
CTrade trade;
//--- Inputs
input double Lots = 0.10; // Lot Size
input int SL_Points = 300; // Stop Loss in points
input int TP_Points = 600; // Take Profit in points
input int MagicNumber = 20251005; // Magic Number
input int RSI_Period = 14; // RSI Period
input int RSI_Buy_Level = 30; // RSI Buy Level
input int RSI_Sell_Level = 70; // RSI Sell Level
input bool Use_BreakEven = true; // Use Break Even
input int BreakEven_Points = 200; // Break Even at +200 points
//--- Indicators
int rsi_handle;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
rsi_handle = iRSI(_Symbol, PERIOD_M1, RSI_Period, PRICE_CLOSE);
if(rsi_handle == INVALID_HANDLE)
{
Print("Failed to create RSI handle");
return(INIT_FAILED);
}
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
// Check if we already have position
if(PositionSelect(_Symbol))
return;
// Get RSI value
double rsi_val[];
if(CopyBuffer(rsi_handle, 0, 0, 1, rsi_val) <= 0)
return;
double point = _Point;
double sl_buy = SL_Points * point;
double tp_buy = TP_Points * point;
double sl_sell = SL_Points * point;
double tp_sell = TP_Points * point;
// Buy Signal: RSI below 30
if(rsi_val[0] < RSI_Buy_Level)
{
double buy_price = SymbolInfoDouble(_Symbol